How to add an Xbee wireless link between a measurement arduino and an ethernet arduino
Ladyada has written a really good tutorial on how to do most of this and supplies Xbee modules and Xbee adapters that make it easy to use the xbee's with the 5.0V provided by the arduino, the links to the adapter assembly and point-to-point communication tutorials can be found below. This guide just add's some details on the arduino sketches needed for sending data and receiving data and converting the received character stream back into double values.
A note on range: I bought two 1mw Xbee's however I've been having a few problems with range. If your wondering which Xbee to get I would recommend going for higher wattage xbee's and maybe the one's with a socket for an aerial too.
Step One
The first step in adding an Xbee link using adafruit adapters is to assemble the xbee adapters, as they come in kit form. Ladyada's assembly tutorial can be found here:
Xbee adapter assembly page
Step Two
The next step is to use a USB TTL-232 cable to configure the xbee's to work as a simple point-to-point link. Ladyada's tutorial can be found here:
Xbee radios: Basic point-to-point communication
Note: If your using linux X-CTU seems to work fine in wine.
Step Three
Now that you have two xbee's configured you can connect one up to the arduino that's taking the measurements and the other to the ethernet arduino.
In the sketch below the measurement arduino has digital pins 6 (Arduino RX) connected to Xbee TX and 7(Arduino TX) connected to Xbee RX assigned for communication with the xbee.
The ethernet arduino has digital pins 2 (Arduino RX) connected to Xbee TX and 3(Arduino TX) connected to Xbee RX.
The nice thing about the Xbee point to point link is that the Arduino just sends the data via serial to the Xbee and the xbee does all the packet creation and other clever things, you can take the xbee's out and replace them with a cable and the arduino sketch's dont need to be changed. When I built the energy monitor I wasn't sure If I would use the Xbee's or just have a wire link and so I made it modular so that the Xbee's can be removed fairly easily. The smaller box in the pictures below are the xbee+xbee adapter modules:
Left: Xbee module on top of the main box. Middle: Xbee module on top of the ethernet box.
The wire link between the xbee and the arduino has 4 wires: 5V, GND, DATA1, DATA2.
There is then a little mini adapter on the Xbee side that routes the 4 wires to the right pins on the xbee.
Left: Xbee module top removed. Right: Arduino to xbee wiring in the ethernet unit.
Step Four - Arduino Software
The two sketches below demonstrate the xbee link independently of any of the other energy monitor code and hardware. The measurement side sketch simply Serial.prints() double values to the xbee. While the Ethernet side sketch reads in the data in character form and converts it back to double values so that they can be used again for useful things.
Download measurement side arduino sketch: XbeeSend.tar.gz
Download ethernet side arduino sketch: XbeeRecieve.tar.gz
Step one - compile and upload the sketches to their respective arduino's. For a guide on compiling and uploading the sketch to the Arduino have a look here.
Step two - power up both arduino's and listen with the arduino serial monitor to the ethernet arduino, hopefully you should see values being printed to the serial monitor. If you do and they are the same values that you sent, exellent you have set up your wireless link!
| Attachment | Size |
|---|---|
| xbee partlist.xls | 10.5 KB |
| xbee partlist.ods | 24.43 KB |
| XbeeSend1.1.tar.gz | 841 bytes |
| XbeeRecieve1.1.tar.gz | 981 bytes |



Re: How to add an Xbee Link
I'd written an intial request to see if these is a cheaper method of wireless transmission than the XBEE which is just a bit expensive for what is a low-budget project. My suggestion the the 433 Mhz frequency IC's such as are used by weather stations and commercial power meters, e.g. currentcost.
Search for "hoperf rf receiver" on one of them search engine things for another example of an RF receiver.
Regards / Colm
Re: How to add an Xbee Link
A 433 Mhz transmitter, WRL-08946
Re: How to add an Xbee Link
Hey Colm, Thanks for the heads up on the 433Mhz wireless ! I've been using these which I find to work well, still need to write up about it here...