EZ Xbee Tutorial: Peer-to-Peer Connections
How to set up Xbees for Easy Wireless Transmition with Arduinos
Often, I have looked online for an easy Xbee tutorial that covers everything, but is written for non-engineers. Here is an easy-to-follow tutorial - yeap, a video works great, but sometimes having text and pictures works better.
What you need:
There are a few flavors of Xbees; the best Xbee depends on your needs for a wireless network. In my case, I need a simple peer-to-peer connection so the XBee 1mW Chip Antenna - Series 1 (802.15.4) is good one. This is also low cost.
- 2 Xbee Adaptors
My favorites are the XBee Explorer USB and the XBee Explorer Regulated, both from Sparkfun.
- 1 Arduino
Lilypad, UNO or similar
- 1 USB cable
- 1 Mini USB cable
- XCTU software
Download for free here:
Windows or Wine on a Mac
The XCTU software runs on Windows (grrrrrrr) it can also run on a Mac using Wine. Details on this are out of the scope of this tutorial.
Any 22g wire will work.
- Soldering Gun
Any cheap one will work.
TIME FOR FUN
After you have installed your XCTU software and you can see the icon, it's time to think about how to set up the Xbees. Xbees in a crazy nut shell: they are powerfull, low energy consumers and low price. They can work with or without an arduino, but this tutorial focuses on wireless communication with arduinos. There are many different kinds to fit your varying needs.
They are capable of having a unique "network" so that they only talk to Xbees within the network you create; this avoids confusion. Give each Xbee a unique "name" in order to keep it organized (see below). Since we are doing a peer-to-peer connection, we only need a "network name" and Xbee "name".
So we have 2 Xbees - 1 sends data from the arduino and the other receives data.
The Xbee jargon:
ATID = Network
ATMY = Xbee Name
ATDH = Destination Address High
ATDL = Who Talks to Who
ATBD = Speed to Talk
For more info about Xbees, get the datasheet here:
Now it's time to do some writting on paper. Change the following values to your needs, however, make sure you maintain the same number of digits in each value. Warning: If another person has the same configuration on their Xbees and by chance your Xbees end up in the same room, your Xbee will go crazy and perhaps not work properly. How did I come up with these values? The ATMY and ATID are random, but notice that the blue numbers are the same and the red numbers are also the same. Very important!
|XBEE 1||XBEE 2|
|ATMY (Xbee Name)
|ATDL (Who Talks to Who)
It helps if you write your values on paper.
Next, download the latest Xbee firmware. The latest version is found under the Modem configuration tab.
Plug in your Xbee.
On the XCTU software under the PC setting tab, click "Test / Query"
A message, similar to the graphic, indicating connection will pop up:
It will also show the firmware version. If you already have 10EC or higher, you may not need to make an update.
If you need an upgrade, go to the Modem Configuration Tab.
Click on "Read" button.
The Xbee info will show in the window like this:
Add a check mark on "Always Update Firmware". REMEMBER TO REMOVE THE CHECK MARK AFTER THE UPGRADE PROCESS IS DONE.
Click on "Write" and let the update run.
When the update is finished, remove the check mark from "Always Update Firmware" and click on "Read".
Follow the same update proces for the other Xbee.
NOW IT'S TIME TO SET UP THE XBEES.
Remember the table that has the ATMY, ATDL, ETC. ETC.? We are going to copy those numbers in the Xbee configuration.
So let's configure Xbee 1, which you already have connected.
Add the values of Xbee 1 in to their respective area:
When you have finished, DOUBLE AND TRIPLE CHECK THIS. Then, for good measure, check again.
Click on "Write" and these values will be sent to the Xbee.
After the write process is finished, click on "Read" and your values will now show in the window. They should match the numbers you entered.
THAT'S IT - you have just configured an Xbee module!
Repeat this process for the second Xbee, making sure that you add different values. That is why I suggest writting the numbers on paper so you don't accidentally duplicate.
OPTIONAL but not required: If you need to change the baud rates speed of your Xbee. do it under the Serial Interfacing (BD):
NOW IT'S TIME FOR THE HARWARE CONNECTION.
Plug Xbee 1 into your computer with the Xbee Explorer:
Plug one side of your wire into the TX pin on the arduino. The other side goes to RX or Din on the Xbee Adaptor:
Do not forget to give power 5 volts of power and ground.
Now sit back and enjoy the world of wireless data!