Jump to content

How to Use Direct Input and Output on an XBee Radio

+ 1
  ProfessorShiny's Photo
Posted Feb 09 2011 09:20 AM

Each XBee ZB (Series 2) ZigBee radio (for example XB24-Z7WIT-004) has the capability to directly gather sensor data and transmit it, without the use of an external microcontroller. This means that you don’t always need something like the Arduino when building simple sensor nodes with XBee radios. In addition, the XBee offers some simple output functions so that basic actuations can also take place without an external microcontroller being present. For example, it’s possible to send digital information directly to a standalone XBee radio to have it turn on a light or start up a motor. For clarity, we’ll refer to these independent input/output functions as XBee direct, to distinguish them from the use of input and output that happens in conjunction with an external microcontroller.

Why XBee Direct?

There are lots of good reasons to use the XBee ZB for direct input or output. By not having an external microcontroller, the overall size of your project is reduced. This is especially important when creating sensors that need to be inconspicuous or fit into tight spaces. By using the XBee alone you’ll also save weight, which can be important if the system is to be lofted skyward in a kite or balloon, or worn on your body, or by your pet. When it comes to wearables, lighter is almost always better. Omitting an external microcontroller also reduces power consumption. This can be a critical advantage for projects that run on batteries, a necessary situation for any project that is truly wireless. Of course, eliminating the external microcontroller means saving money, and for sensor networks with hundreds of nodes, it can mean saving a lot of money. Finally, using the XBee alone is sometimes the least-complicated approach to a project. There’s a lot going for the XBee direct model. However, there are also some important trade-offs to consider.

XBee Direct Limitations

Projects that use the XBee alone for its input/output features may face significant limitations compared to projects that incorporate an external microcontroller such as the Arduino. The XBee has limited input and output pins, with no simple way to extend them. Also, the Series 2 hardware that the ZigBee firmware requires doesn’t currently support analog output at all, which means it can’t be employed to dim a light or control the speed of a motor without additional electronic components. The single biggest limitation is that the basic standalone XBee radio doesn’t allow access to any kind of logic. This means no decisions can be made on the local device and no standalone operations can be performed besides transmitting data or changing the state of digital pins as the result of remote commands.

Note: A new variation of the XBee radio was recently released that incorporates a second microcontroller to allow some forms of local logic. However, this comes at additional cost, will need to be accessed with special programming methods, and requires knowledge of C or Assembly, both lower-level approaches than using Arduino.

XBee I/O Features

The XBee Series 2 hardware offers several flexible features for projects that need simple input and output. There are 10 pins that can be configured either as digital inputs for sensing switches and other things that operate like switches, or as digital outputs for controlling LEDs and small motors directly. Larger loads, including ones that run on alternating current, can be operated using these digital outputs via a relay. The first four of these pins can be configured as analog inputs for sensing a huge array of phenomena that scale over a range, like light, temperature, force, acceleration, humidity, gas levels, and so forth. On the Series 2 radios, there are currently no user-configurable analog or pulse-width modulated (PWM) outputs, so you cannot directly control the speed of a motor or the brightness of an LED light. However, the underlying chipset does support these types of outputs so perhaps they will be available in a future firmware upgrade.

XBees have all these different features available, but this doesn’t mean you can use them all at once! There are only 10 pins total so you if you have all 10 digital inputs configured, you are out of pins and can’t use any digital output or analog input. Happily, the pins can be used in a mix. For example, three analog inputs, four digital inputs, and three digital outputs would be fine. The only other thing to be aware of is that many of the 10 configurable pins are used for other optional duties. These other duties are important in many applications, but they’ve been carefully selected so that they are ones that don’t tend to be needed in remote sensing and actuation projects. For example, some of the duties are serial hardware handshaking (CTS and RTS), an advanced feature that is generally not needed unless there is another microcontroller or logic-based device in the mix. Certain I/O pins do double duty as debugging light outputs for signal strength (RSSI) and association (ASSOC), which are handy for development but generally unimportant on a remote sensor that will not be viewed directly. There are also several pin-controlled sleep features (ON and SLEEP) that are not usually required for standalone sensing or actuation. Of course, on the off chance that one or more of those features is required, it would reduce the number of pins available only by one or two, so you’ll generally have enough left over to cover the vast majority of application projects you can dream up. The table below shows the input/output pin names with physical numbers, corresponding AT commands, and other functions. Note that DIO8 and DIO9 are not supported in the current firmware so they can’t be used for I/O at this time. The image below shows the I/O pins on a breakout board (Sparkfun parts BOB-08669, PRT-08272, and PRT-00116).

Input/output pin names with physical numbers, commands, and other functions

Pin namePhysical pin #AT commandOther functions
DIO0, AD020D0Analog input, Commissioning Button
DIO1, AD119D1Analog input
DIO2, AD218D2Analog input
DIO3, AD317D3Analog input
DIO411D4
DIO515D5Association indicator
DIO616D6RTS
DIO712D7CTS
(DIO8)9NonePin sleep control, DTR
(DIO9)13NoneOn/Sleep indicator
DIO106P0Received Signal Strength Indicator (RSSI)
DIO117P1
DIO124P2


I/O pins as seen from below on a breakout board (Sparkfun parts BOB-08669, PRT-08272, and PRT-00116)

Attached Image


Building Wireless Sensor Networks

Learn more about this topic from Building Wireless Sensor Networks.

Create distributed sensor systems and intelligent interactive devices using the ZigBee wireless networking protocol and Series 2 XBee radios. By the time you're halfway through this fast-paced, hands-on guide, you'll have built a series of useful projects, including a complete ZigBee wireless network that delivers remotely sensed data. This resource- and reference-packed book is ideal for inventors, hackers, crafters, students, hobbyists, and scientists.

See what you'll learn


Tags:
2 Subscribe


3 Replies

0
  dproffer's Photo
Posted Feb 09 2011 09:38 PM

Useful post for low low power applications, thx. In the paragraph below, you talk about some new XBee variations with more intelligence. Can you point to some specific models?

'Note: A new variation of the XBee radio was recently released that incorporates a second microcontroller to allow some forms of local logic. However, this comes at additional cost, will need to be accessed with special programming methods, and requires knowledge of C or Assembly, both lower-level approaches than using Arduino.'
0
  Talumtam Okane's Photo
Posted Jun 23 2013 08:12 AM

Useful for me. I like music a lot. Thank you. :lol:
0
  clubpenza's Photo
Posted Nov 19 2013 07:17 PM

Thank you.
ibcbet สล็อต sbobet แทงบอล คาสิโน genting club