Introduction: How to Use XBee Modules As Transmitter & Receiver - Arduino Tutorial

In this tutorial we will use two xBee (series 1) modules with the Arduino uno board. We will configure them to act as a receiver and transmitter to control the brightness of an LED wirelessly by using one potentiometer.

The xBee - series 1 - modules take the 802.15.4 stack (the basis for Zigbee) and wrap it into a simple to use serial command set. These modules allow a very reliable and simple communication between micro controllers, computers or other systems by using just a serial port!

They can communicate up to 300 Ft (~100m), they have 2.4GHz frequency , use the 802.15.4 protocol and have data rate up to 250kbps. They have also a 1mW wire antenna on them. They supports Point to point and multi-point networks.

You can see the result of this tutorial on the below video :

So, let's get started!

Step 1: What You Will Need

For this tutorial you will need:

  • 2x Arduino uno boards
  • 2x xBee series 1 modules
  • 2x XBee Explorer Regulated boards
  • XBee Explorer USB
  • 220 Ohm resistor
  • potentiometer (e.g. 2k)
  • led
  • 2x breadboards
  • some breadboard cables

Step 2: XCTU - Setup Your XBee Modules

Download the XCTU software from here.

Run the program and connect the XBee Explorer USB board with your computer.

Click on the "Discover devices" icon to add your xBee in the XCTU software.

Now click on it (first image above) and set the CH field to e.g. "C" and the ID field to e.g. "1001". These values must be the same to all xBee modules to communicate with each other. Now as this xBee will be our transmitter, set the CE field as "Coordinator". If the baud rate isn't set to 9600bps, change it to this value.

Now click the "Write" button to save the changes in your xBee module.

Disconnect the xBee explorer board from your computer and connect the other xBee module on it.

Connect the explorer board with your computer again and follow the same procedure (second image above) but this time set the CE field as "End device".

Finally the configuration for our xBees must be:

For xBee transmitter:

  • CH: C
  • ID: 1001
  • CE: Coordinator
  • Baud rate: 9600 bps

For xBee receiver:

  • CH: C
  • ID: 1001
  • CE: End point
  • Baund rate: 9600 bps

Step 3: The Code

Here's the "xBee Transmitter" code, embedded using Codebender!

Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino uno board with this sketch!

And here's the "xbee Receiver" code, connect the second Arduino uno board with your computer and press the "Run on Arduino " button.

Step 4: The Circuit

The connections are pretty easy, see the above image with the breadboard circuit schematics.

Power on both Arduino uno boards and try to fade the led by turning the potentiometer.

Step 5: Well Done!

You have successfully completed one more "How to" tutorial and you learned how to fade an LED wirelessly by using the xBee S1 modules.

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!

Comments

author
MuhammadI275 (author)2017-05-22

Does the receiver code have to use all three programs?

author

Hello friend, would there be a difference if S1 Pros were used instead of regular S1?

author
archiaa made it! (author)2017-04-10

i made it !!!!!!!!!

IMG_20170410_145648.jpg
author
HemaA2 (author)2016-10-01

IN XCTU I DONT FIND CE COORDINATOR

author
Gelfling6 (author)HemaA22017-01-07

for the Series-1, it SHOULD be within the first page, as shown, at the bottom.. (step 2, of this instructable) at least for the S1 (series-1).. I can't remember (or find mine at this time) where exactly it is on the S2 versions in the set-up parameters. One radio, must be configured as a coordinator, and for S1's others are as End devices, and I believe S2's have a 3rd mode, Router, which relay signals to the end points.

author
Gelfling6 (author)Gelfling62017-01-07

All else failes, You can return the device to Factory default (on the read, Write Restore, click Restore, then re-read the settings. it should be default (S1 & S2) as coordinator.

author
FahdA8 (author)2016-12-28

hi everyone

I want to ask about the Xbee

I want to send analog signal by Xbee and receiver the signal by arduino because i have ECG signal please i need help

author
123smile (author)2016-07-21

Can i use the same procedure to transfer data?

author
xMarYx (author)2016-05-21

Hi, Great tutorial.

I am doing something similar. Just one thing though, i cant seems to properly tweak the receiving coding to get another set of analog input to control another LED. I have 2 POT and 2 LED. One to control another

author
AndrewW180 (author)2016-04-08

Nice Job! Well done!

About This Instructable

23,199views

46favorites

License:

Bio: Arduino Tutorials by Codebender.cc Team
More by codebender_cc:How to use a magnetic door switch / sensor with ArduinoHow to Measure LUX With ArduinoHow to Control an RGB LED Strip - Arduino Tutorial
Add instructable to: