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 Xbees with the 5.0V provided by the Arduino. Links to the adapter assembly and point-to-point communication tutorials can be found below. This guide adds 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 Xbees. However I've been problems with range. If you're wondering which Xbee to get, I recommend the higher output Xbees and maybe the ones with a connector 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 are in kit form. Ladyada's assembly guide is here:
Xbee adapter assembly page
Step Two
The next step is to use a USB TTL-RS232 cable to configure the Xbees to work as a simple point-to-point link. Ladyada's tutorial is here:
Xbee radios: Basic point-to-point communication
Note: If you're using Linux, X-CTU seems to work fine running under Wine.
Step Three
Now that you have two Xbees configured, you can connect one to the Arduino that's taking the measurements and the other to the Ethernet Arduino.
In the sketch below, the measurement Arduino has digital pin 6 (Arduino RX) connected to Xbee TX and digital pin 7(Arduino TX) connected to Xbee RX.
The Ethernet Arduino has digital pin 2 (Arduino RX) connected to Xbee TX and digital pin 3 (Arduino TX) connected to Xbee RX.
The nice thing about the Xbee point-to-point link is the Arduino just sends the data via serial to the Xbee. The Xbee does all the "heavy lifting." You can remove the Xbees, replace them with a cable, and the Arduino sketches still work.
The smaller box in the pictures below are the Xbee and 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 a mini adapter on the Xbee side that routes the 4 wires to 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 the data in character form and converts it back to double values.
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 Arduinos. For a guide on compiling and uploading the sketch to the Arduino, have a look here.
Step two - Power up both Arduinos and listen with the Arduino serial monitor to the Ethernet Arduino.You should see values being printed to the serial monitor. If they match the transmitted values, your wireless link is working properly.
Re: How to add an Xbee Link
should i add these sketches to the other sketches or they should be uploaded seperately??
Re: How to add an Xbee Link
the program they are using the X-CTU are only compatible with windows xp,200...i have vista..what im going to do??
Re: How to add an Xbee Link
I cant understand one things... can I just buy the Xbee's ready, or should I buy the kit, and assemble it on my own???
Re: How to add an Xbee Link
The Xbee itself is a chip that is capable of communication, but it requires a 3.3V supply.
The supply has to be maintained at 3.3V else the chip will be damaged.
So to avoid damaging the chip we build a shield for it to regulate the voltage at 3.3V. The design and PCB in the article is one of the many types of shields available commercially.
Sparkfun Labs sells a shield that is simply a plug and play device, one connects the Xbee chip to the shield and the shield simply sits on the arduino board. Just upload your sketch without the shield connected.
Since the chips are expensive its better to invest in a good shield.
One can either buy a breakout board and solder the parts of the shield or you can simply buy a readymade shield.
Re: How to add an Xbee Link
so the xbee should be bought ready, or it should be assembled on the pcb ????
Re: How to add an Xbee Link
Yup the xbee has to be bought seperately
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-zb-module.jsp#overview
--The above link shows you wat an xbee chip looks like (minus the PCB/shield) , this ismanufactured digi international.
The xbee is itself a chip that is capable of communication via zigbee protocol.
But as I said before one needs a shield to provide a perfect 3.3V supply . For this reason a shield is required.
Now coming to the PCB/ shield, you have a choice, you can either design and fabricate a shield yourself or you can buy a readymade one.
http://www.sparkfun.com/products/9588
--The above link shows you what a readymade PCB/shield looks like.
Ofcourse there are various shield breakout boards(boards that have the PCB layout etched but do not have the electronic components soldered) available. These are usually for individuals who d like to use their own components instead of the manufacturer's.
The choice of xbee module is upto you and quite honestly depends on the range of communication. Various versions and series are available . If your project is required for long ranges a higher power xbee is advisable.
So in all you have to get two things
1. XBee Chip/module
2. Xbee Shield
Re: How to add an Xbee Link
i bought the kit from adafruit.. so now i need to buy the xbee chip right??
Re: How to add an Xbee Link
Does your kit from adafruit industries have a component that looks like the following-
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-zb-module.jsp#overview
If yes, then you do not need to purchase the Xbee module.
I checked on the adafruit site, they say they 'do not include' an Xbee module in the Xbee Adapter Kit V1.1.
If you have bought the Xbee Adapter V1.1 kit then you need to make an additional purchase of an Xbee module.
Re: How to add an Xbee Link
Just found a 433Mhz shield google "433mhz-receiver-shield freetronics"
Seems more involved, and expensive, than is needed for the specific energy monitor application, but then again I've never built anything, just a excess of un-built ideas !!
/ Colm
Just found more, a receiver for US€6, google "kajordahl weather"
Sorry about the google but the original links gave spam filter problems on this site, fair game.
Re: How to add an Xbee Link
I know I'm a few months late, but I figured I'd share my thoughts anyway...for those that come across this later on.
From my experience wireless communication is one of those things where you trade money for reliability and simplicity. Sure, the 433Mhz modules are dirt cheap, but they make up for it in the complications of using them reliably. They say that they are simple serial cable replacements. NOT TRUE. I used the 433MHz modules in my last project and it took me just as long to get the modules working reliably as it did for the entire rest of my project. At a minimum, they require a preamble to balance out the receive circuitry prior to sending real data and even then you should probably send a checksum of some sort afterwards just to be sure. At the end of the day, it's a minimum of 20:1 ratio, but more like 40:1 ratio of overhead to good data. Put that on a 2400 baud link and you can probably do just as well with carrier pigeon.
On the other hand, XBees (and other similar wireless solutions; nordic comes to mind) cost a bit extra, but all of that headach is handled transparently, the throughput is orders of magnitude higher, and, best of all, they are transcievers, which means they have two way communication.
Also, if I'm not mistaken, the 433MHz band is for periodic bursts and is not to be used for steady or frequent transmissions. There may be some FCC restrictions there that hobbyists may not be aware of. If you have one of those wireless outdoor thermometer clocks, I guarantee that it will play havoc with your 433MHz module as well.