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

Arduino has been established as the de facto standard microcontroller programming platform, being used for one-off do-it-yourself projects as well as prototypes for actual products. By providing a myriad of libraries, the Arduino community has made it very easy to interact with pretty much any piece of hardware out there. XBee offers a great range of low-power wireless solutions that are easy to work with, by taking all of the complexity of wireless (mesh) networking out of your hands and letting you focus on what to send without worrying about the how. Building wireless sensor networks is cost-effective as well as efficient as it will be done with Arduino support. The book starts with a brief introduction to various wireless protocols, concepts, and the XBee hardware that enables their use. Then the book expands to explain the Arduino boards to you, letting them read and send sensor data, collect that data centrally, and then even control your home from the Internet. Moving further more advanced topics such as interacting through the standard Zigbee Home Automation protocol, or making your application power-efficient are covered. By the end of the book, you will have all the tools needed to build complete, real-world solutions.
Table of Contents (8 chapters)

Other XBee families

The ZigBee network structure used by the XBee ZB modules is the most complex of all the XBee modules discussed in this book. The other modules do not require having a central coordinator or going through a join procedure, but instead rely on manually assigning a 16-bit network identifier (ID) and operating channel (CH) on all nodes (except XBee-PRO 868, which only has one channel available). Security is also simpler: every node has the network key (KY) manually configured. There is no key distribution mechanism.

For the XBee 802.15.4 family, this applies in the default configuration, but there is a second mode where a simple join procedure can allow nodes to automatically detect the right channel and/or network identifier to use (the network key must still be manually configured).

DigiMesh and XBee 868 networks use only a 64-bit address for each node and all transmissions. All nodes in an 802.15.4 network have a 64-bit address and can optionally have a manually assigned 16-bit address too (MY). Sending a packet in a 802.15.4 network uses either a 64-bit or 16-bit destination address (but, if you use a 64-bit address, the full address is transmitted over the air; there is no mechanism to look up the 16-bit address and use that in packets as with ZigBee).

XBee 802.15.4 and XBee-PRO 868 networks do not have any mesh capabilities, so you can only send messages between nodes that can directly hear each other. DigiMesh networks do support meshing similar to ZigBee.

Some other families also have device roles such as coordinator or end device, though the difference between them is less than in ZigBee networks. See the relevant product manual for details.

Configuration values

If you followed the preceding examples, you should have configured the following values on all your XBee modules:

  • AP=2 to enable API mode with escaping
  • ID=<your PAN ID> to prevent joining other networks
  • EE=1 to enable security
  • KY=<random 32-digit key> to prevent others without this key from joining the network
  • NJ=0 to prevent new nodes from joining

The changes to DH and DL were only needed for the AT mode examples and are no longer relevant in API mode.