Book Image

Building Wireless Sensor Networks Using Arduino

By : Matthijs Kooijman
Book Image

Building Wireless Sensor Networks Using Arduino

By: Matthijs Kooijman

Overview of this book

Table of Contents (13 chapters)

XBee radio hardware


For connecting multiple Arduino boards wirelessly, there are numerous add-on boards and modules available. Options range from simple low-power 433Mhz transmitters that offer raw radio access, and require everything from addressing and error correction to encryption to be done on the Arduino, to complex modules that take care of all radio processing, encryption, and mesh routing (and even include a programmable microcontroller).

This book will focus on the XBee modules manufactured by Digi International. These modules are easy to use, well supported by Arduino libraries, and not too expensive. Digi offers a number of different XBee product families, each with unique features and transmission range. Since all the XBee modules have a similar serial interface, configuration values, and hardware pinout, they are largely interchangeable. Advice and experience that apply to one often also apply to the others.

XBee product families

Here is an overview of all the XBee product families that Digi currently produces and that use the common XBee through-hole pinout (a few other families use a surface-mount design, but these are not discussed here):

  • XBee and XBee-PRO 802.15.4: These modules let you use the radio protocol defined in the IEEE 802.15.4 standard directly. This is a fairly simple protocol designed for low-power, low-data-rate communication. It operates in the 2.4Ghz spectrum, just like Wi-Fi (defined in the IEEE 802.11bgn standards), but is a lot simpler, has a lower throughput, and has a much lower power usage. These modules support no (mesh) routing: only modules that can directly hear each other can communicate.

  • XBee and XBee-PRO ZB: These modules use the ZigBee Pro radio protocol for communicating. ZigBee is a layer on top of 802.15.4 that adds mesh routing and extended network management capabilities. Mesh routing allows two modules to communicate even when they are not within range of each other, by letting other modules forward data on their behalf.

    On top of basic communication, ZigBee application profiles define standard messages and commands to allow, for example, remote-controllable lamps, switches, or other equipment from different manufacturers to interoperate.

  • XBee and XBee-PRO DigiMesh 2.4: These modules run a proprietary mesh protocol developed by Digi, also in the 2.4Ghz spectrum. This protocol is comparable with ZigBee, but important differences are that all nodes are equal, can do routing, and even routing nodes can sleep to save power. These modules use the same S1 hardware as the XBee 802.15.4 modules, so each can be converted to the other by replacing the firmware version.

  • XBee-PRO 900HP: These modules run in the lower 900Mhz spectrum, giving them an extended range (up to 14km line-of-sight) and making them less sensitive to obstacles than the 2.4Ghz modules. They also use the proprietary DigiMesh protocol. Due to regulatory limitations, these modules are only usable in North America and a few other selected countries.

  • XBee-PRO 868: These modules run in the lower 868Mhz spectrum, allowing up to 40km line-of-sight range. These modules do not use any meshing protocol; instead, they employ a proprietary protocol that only allows direct communication between modules. Due to regulatory limitations, these modules are only usable in Europe.

  • XBee Wi-Fi: These modules use the common Wi-Fi protocol (802.11bgn). By default, these modules join the network of an existing access point, but they can also be configured to run as an access point, run an ad-hoc network, or use Wi-Fi Direct. Due to the nature of Wi-Fi, no mesh routing is supported and power usage is significantly higher than, for example, the XBee 802.15.4 and XBee ZB modules; however, throughput can also be a lot higher.

Sometimes you will also see the terms Series 1, which is the name originally used for the XBee 802.15.4 family, and Series 2, which is a retired family that used the same hardware as XBee ZB but with a different firmware (ZNet 2.5) and radio protocol. This old naming is still reflected in the names used for individual hardware boards, which use names such as S1, S2, S2B, and so on.

Versions and variants

As noted earlier, some modules are available in normal and PRO variants. These PRO modules use the same radio and serial protocol as the regular modules, but feature a more powerful transmitter and more sensitive receiver, allowing for a significantly extended range (and also requiring more power, of course). Since the radio protocol is the same, the normal and PRO modules of the same family can be intermixed.

Most of the XBee modules are available in a few different versions, differing only in the antennae they use. The easiest are the PCB antenna, which uses copper on the circuit board as the antenna, and the wire antenna, where a short piece of wire sticks up from the board. Both have similar performance. There are also modules available with a u.FL or RPSMA antenna connector, allowing them to have an external antenna (useful for projects inside a box, needing maximum reception). When in doubt, get the PCB antenna version, as it is the least fragile and performs well.

For a few more details about the available boards, also see this guide from SparkFun: https://www.sparkfun.com/pages/xbee_guide.

Note

In the XBee ZB context, Pro can have two different and unrelated meanings, which can be confusing.

On the one hand, the XBee-PRO modules are more powerful versions of the regular modules. This is a distinction made by Digi in their hardware model names.

On the other hand, ZigBee Pro is the protocol used by the XBee ZB (and XBee-PRO ZB) modules. The latest version of the ZigBee specification, ZigBee-2007, defines two variants: Normal ZigBee and ZigBee Pro. ZigBee Pro is a bit more complicated, allowing for networks to scale to thousands of devices. Compatibility between these variants is limited; for this reason, most devices implement ZigBee Pro and the "normal" ZigBee protocol is not used very much.

In this book, all examples (and most of the discussion) focus on the XBee ZB modules, but most of the material presented also applies to the other modules. Where significant differences occur, these will be noted and (concise) instructions for other module types will be given. Therefore, if you decide to use the XBee 802.15.4, XBee DigiMesh 2.4, or XBee-PRO 868 modules (or any of the PRO variants), you can still work through this book normally. The XBee-PRO 900HP modules are not discussed in this book, but these are expected to work in a very similar way to the DigiMesh modules.

Instructions for the Wi-Fi modules are not included, since the setup and operation of Wi-Fi are significantly different from the other modules. However, a lot of the more general information (API frame format, XCTU operation, and AT commands) applies equally to these modules.

Official XBee documentation

For each of the XBee module series, Digi publishes a lot of documentation. This documentation can be accessed from the Digi website, through the Support section. The most important document is the Product Manual, which contains info on the hardware, network setup, a full list of commands and API frames supported, and so on.

Even though all the information you need for these examples is included in this book, you are encouraged to get familiar with the product manual for your XBee modules as well. The manual will be a lot more detailed in some areas and is easy to use as reference material for commands, configuration values, frame types, and so on.

Note that, within the ZigBee ZB family, there is a division between older boards (using S2 or S2B hardware) and newer boards (using S2C hardware). These boards are largely compatible, but there are two separate product manuals available with largely identical content (which are both titled Product Manual: XBee / XBee-PRO ZigBee RF Modules). Be sure to get the right one for your boards.