circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

September 2006, Issue 194

Go Wireless with the Xbee


by Fred Eady

 

XBee ZigBee MODULE       

ZigBee’s mission is to cut the traditional wires between sensors, wired slave devices, and the microcontrollers and microprocessors they serve. Thus, if ZigBee is to emulate a wire, what goes in must come out without any significant change.

MaxStream’s XBee ZigBee modules feature a UART interface, which allows any microcontroller or microprocessor to immediately use the services of the ZigBee protocol. All a ZigBee hardware designer has to do in this case is ensure that the host’s serial port logic levels are compatible with the XBee’s 2.8- to 3.4-V logic levels. The logic level conversion can be performed using either a standard RS-232 IC or logic level translators such as the 74LVTH125 when the host is directly connected to the XBee UART.

Data is presented to the XBee module through its DIN pin, and it must be in the asynchronous serial format, which consists of a start bit, 8 data bits, and a stop bit. Because the input data goes directly into the input of a UART within the XBee module, no bit inversions are necessary within the asynchronous serial datastream. All of the required timing and parity checking is automatically taken care of by the XBee’s UART. As you would expect, the XBee module produces a received data asynchronous serial datastream for the host on its DOUT pin. So, all you need is a simple three-wire (DIN, DOUT, and ground) serial connection to put ZigBee to work with the XBee and XBee-Pro modules.

Just in case you are producing data faster than the XBee can process and transmit it, both XBee modules incorporate a clear-to-send (CTS) function to throttle the data being presented to the XBee module’s DIN pin. You can eliminate the need for the CTS signal by sending small data packets at slower data rates.

Figure 1 is a simplified depiction of the XBee module’s internals. Incoming data flowing through the DIN pin is buffered by the DIN buffer until it can be transmitted. As programmer and commander, you have the option of sending characters as they enter the DIN pin or buffering up a number of characters to send as a packet. When the XBee module isn’t sending characters, it can rest in Idle mode, enter Receive mode, process a command, or just sleep it off. The bulk of the subsystem boxes shown in Figure 1 are contained within two Freescale Semiconductor physical ICs: an MC9S08GT60 microcontroller and an MC13193 802.15.4 RF transceiver IC.

c

(Click here to enlarge)

Figure 1—This is a simplified view of the actual XBee hardware shown in Photos 1 and 2. As long as you don’t overrun the buffers, ZigBee things work as designed.

I popped the bonnet (that’s London-speak for hood) on one of my XBee ZigBee modules to put some meaning behind the boxes in Figure 1. The M9S08GT60 microcontroller and the MC13193 RF transceiver parts are pretty obvious in Photo 1. They sport the B-2-bomber-like Freescale logo. The XBee module’s 16-MHz clock source is nestled in the bottom-right corner.

c

(Click here to enlarge)

Photo 1—This reminds me of what I found when I used a can opener on some 802.11b CompactFlash Wi-Fi cards. RF is black magic. I still contend that if you have to shield something, there’s something amiss or evil going on under the metal.

The MaxStream and Freescale engineers reading this article may get a chuckle because they really know what the rest of the parts are. Because I only have my intuition to guide me, I’ll put forth my best RF guess that the pair of six-pin devices just above the MC13193 are transmit and receive matching transformers. There is only one antenna, so I’d venture to say that the little six-pin device just above the M9S08GT60 microcontroller is an antenna switch because it’s the last active component between the antenna port and the rest of the RF circuitry. I happen to know that the MC13193 is really an MC13192 with an integral ZigBee protocol stack. I also know that the MC13193 contains receive and transmit buffers to allow the use of smaller microcontrollers like the M9S08GT60. However, that doesn’t exclude the possibility that the M9S08GT60 microcontroller is also holding a pair of transmit and receive buffers of its own.

The XBee-Pro is basically the same ZigBee radio with some extras. In the XBee-Pro bonnet raised in Photo 2, you can see the six-pin ADC voltage reference switch IC in the bottom-left corner just under the M9S08GT60 microcontroller. The 50-kW digital potentiometer used to adjust the RF power amp output is the eight-pin package just above the M9S08GT60 microcontroller. Hopefully, the MaxStream and Freescale RF engineers have stopped giggling as I positively identified the ADC switch and digital potentiometer devices using their package markings. At this point, I would bet that the 16-pin IC just above the MC13193 is the RF power amplifier (PA) and the four-lead package to its upper right is the low-noise amplifier (LNA) that aids the MC13193’s receiver subsystem.

c

(Click here enlarge)

Photo 2—The XBee-Pro is a standard XBee module with an additional adjustable RF power amp, a low-noise amplifier (LNA), and an ADC voltage reference switch. The XBee-Pro’s RF power amp boosts the XBee-Pro’s effective output power to 100 mW.

Now that you know that a standard Freescale microcontroller and an off-the-shelf 802.15.4 ZigBee radio are the main ingredients in the XBee module, you realize that you can customize the XBee module’s operation because a microcontroller is involved. MaxStream also came to this realization, and it provides some direction for rolling your own XBee application.

If you’re not set up to develop with the HC08 family of Freescale Semiconductor microcontrollers, prepare to dig into your piggybank. Developing your custom XBee application with the Freescale SMAC can be accomplished with the “free” version of the Metrowerks CodeWarrior Development Studio coupled with the MaxStream Bootloader, which is part of the XBee module’s factory firmware. If you decide to go with the Freescale 802.15.4 PHY and MAC development method or the Figure 8 ZigBee stack, you’ll need to get a serious copy of the CodeWarrior Development Studio. 

Hint: The libraries and auxiliary files needed to adapt the Freescale SMAC, Freescale 802.15.4 PHY and MAC, and Figure 8 ZigBee stack application methods to the MaxStream PHY are available on MaxStream’s web site.

No matter which way you go in the way of XBee development, the MaxStream X-CTU software, which is also a free download from the MaxStream site, allows you to use your PC to program the XBee modules serially using the XBee DIN, DOUT, *RTS, and *DTR pins. If you’re hardcore, the P&E Microsystems USB HCS08/HCS12 Multilink programmer/debugger can also be used to program the XBee modules. The danger of using the P&E programmer is that you’ll overwrite the bootloader code. Losing the bootloader code will also erase the factory calibration information, which allows the XBee-Pro ZigBee modules to attain 18-dBm power output. You’ll be limited to 12-dBm output power without the factory calibration information.