Wednesday, September 26, 2012

XBee introduction for Dummies (in a nutshell - XBee's cool!)

XBees with different antennas (Image source: )

I've recently started playing with XBee from Digi. As usual with me I started with ruining one of the lent XBee's firmware and spent a week trying to get one back. That was a lot of fun and desperation - but I also learned a lot, found a lot of great materials (most of them on Digi's website, something like this: Designing a Sleeping XBee Sensor) and had a chance to talk to Digi support. All in all, I like this company, what they do and how they do it.

Just a few words about what is an XBee. I used to have an idea that it's just a wireless UART extension and was wondering why it costs so much (I paid for mine $17 a piece at It turned out the thing is way better. Of course it is a wireles solution and it is able to:

1. Serve as transparent UART bridge (no surprise here)
2. Form different networks with point-to-point, star or mesh topology (this is why I bought them in the first place, but later about this)
This example setup is a combination of Start and Mesh topologies (Image source: )

3. Communicate to othe XBees on such a network through API commands (that is superior to transparent bridge in a way that it has rich addressing capabilities, allows to execute a remote AT commands, control remote units, ensure data integrity and even flash new firmware remotely)
4. Easily extensible with a led, a resistor and two buttons: led would show a module state, and buttons control network behaviour (wake up, ping remote, leave network) and mudule reset.
5. Has digital IOs - you can control them or sample them remotely (just add power, a transistor, a relay and you've got a wireless switch)
6. Has analog sampling channels - wire a temperature sensor to it and it will send values over network without an external MCU
7. Has got impressive performance. With my flat build out of metal/concrete with walls of 45 cm, it reaches every single corner of my flat. That wifi fails to achieve (although I tend to think this has got something to do with data throughput) and Bluetooth not even trying. I thought I would need to put a few router in between coordinator and end devices to relay the link, but it was not needed. The signal and data perfectly goes through!

So it really looks like a perfect solution for tasks such as home automation. With XBee the design pretty much becomes an integration question. Decide what you need, grab an XBee, add some spice and you're done. I built a wireless sensor that reads my water consumption just in a few evenings.

There's really a lot of information on the net already, but also as I said very useful forums and support community from Digi. If you were thinking about how to pass information from eg sensor to a control hub, go grab a few XBees and start experimenting. I also suggest that you read this unofficial FAQ to dive fast into the topic as well as check out this buying guide from Sparkfun. Also if you are going to buy XBees you will really need something to connect it to a PC with. A very basic thing is an USB-UART converter with just TX/RX signals. You can really get away with this, but it's going to be somewhat painful. You should look (or upgrade the basic variant) for something that provides:

1. Regulated power (3,3V !!!)
2. RX/TX signals (3,3V !!!)
3. Reset signal (for module to automatically reset when uploading firmware) (3,3V !!!)
4. Reset button (so you can manually reset the module)
5. DTR signal (to be able to jump to boot loader) (3,3V !!!)
6. Association LED (so you can say at a glance if XBee is powered, connected or what the error is)
7. Commissioning button (so you can test the link and control XBee a bit)
Such an adapter can be DIY from e.g. USB-UART converter, schematic is super-simple, the trickiest part is the XBee connector that is not regular 2,5 mm connector (0.1"), but 2,0 mm (0,78").

Next time I'll probably tell you how to easily turn a router into an XBee gateway ($110 worth!) :-)

Happy getting rid of wires!

Post a Comment