File Exchange

image thumbnail

Wireless control and monitoring of an LED using XBee

version (711 KB) by MathWorks MATLAB Hardware Team
Acquire data from wireless sensors using Xbee from MATLAB


Updated 23 May 2014

View License

In this example, MATLAB® is used to wirelessly control an LED using two XBee® Series 2 modules. A mini photocell is used to wirelessly monitor the state of the LED. The example illustrates how you can control,acquire and analyze data from sensors that are connected wirelessly through XBee modules.
XBee is a registered trademark of Digi International,

Cite As

MathWorks MATLAB Hardware Team (2020). Wireless control and monitoring of an LED using XBee (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Takaaki Yamazaki

What do you want to do if you want to send data by serial communication from END devices?

tamo Toto

I have an XBee THT Grove Development Board, and xbee s1. I'm trying to read out the analog and digital pin with Matlab already from few days.
I always get these error messages:
"No response from your remote node. Check the destination address or SIFS parameter if you want to increase the waiting
Time. "
"Responses = obj.remoteAtCommand (command, destadd);"
"[CurPinMode, sources] = obj.getPinMode (pin, destadd);"
Can someone help me
Thank you

Madina Ibragimova

Hello! Thank you very much for very useful file!
I want to get data from remote xbee, which is connected with arduino by RX TX, and how I understand I need use function output = extractFrameData(frameData, remoteATCommand), but I don't know Which remote AT Command I should use. I will appreciate for any help.

vidtor sirip

I'm trying to need throughput, delay and packet loss.
how can i do it. pleas help me.

Madina Ibragimova

Yossi Dukarker

i'm trying to send data from arduino to matlab using Xbee SERIES 1 802.15.4
how can i do it? and what matlab code should i use?
thanks ahead

ricardo ortiz

hi, im trying to use the plug for creating an Xbee object but Matlab does not recognise the command. is there any other package i need t install before being able to use this feature ?? please help.

>> x = xbee('COM6');
Error using xbee
Error: File: xbee.m Line: 4 Column: 5
Unexpected MATLAB expression.

Donghai Wang

i'm new to xbee programming

wonder to know what's difference for AT mode or API mode in matlab coding -- can you point me which code depends on API mode?


Benjamin Kraus

@Tim: This code was written specifically for the series 2 XBees running in API mode, so it will not work with series 1 XBees. However, if you have series 1 XBees (or series 2 XBees running in AT mode), you should be able to use the "serial" function/object directly without any special wrapper. Try:

>> doc serial

Regarding your keyboard: This is just a guess (I am not familiar with this aspect of Macs, but I am familiar with Linux, I'm guessing they are similar), but you are most likely providing the wrong address for the serial port. Instead of providing the address for the XBees, you are giving it the address for your keyboard. Try incrementing the number at the end of the serial port address until it works (with the "serial" command, it won't work with the "xbee" command).


Would Matlab R2013a be able to recognize the word 'xbee' or do I need a latest version of matlab?


I have two Xbees S1 and want to transmit sensor data to Matlab.
Does the xbee class also work with S1-series? Are there any known issues?

As soon as I create the Xbee object, my keyboard (OS X 10.10) stops working. Any ideas on that?


Eun Kyung Lee


Updated description and file.

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux