Design Article
Comment
Tim.Gillman
To find out more about ZigBee and Wireless Sensor Networking, go to Drew's ...
ZigBee applications - Part 3: ZigBee PANs
Drew Gislason
7/23/2010 10:50 AM EDT
4.3 ZigBee PANs
ZigBee nodes can only send data requests to other nodes on the same network. A single ZigBee network is called a Personal Area Network (PAN).
This section describes PAN IDs, extended PAN IDs, and channels, all concepts which define a single ZigBee network. Application examples are given which show how to adjust these settings in a ZigBee environment.
ZigBee PANs are formed by ZigBee Coordinators. Only ZigBee Coordinators (ZCs) may form a PAN. The other ZigBee node types, ZigBee Routers (ZRs) and ZigBee End-Devices (ZEDs) may join a network, but do not form one themselves.
There is no reason that a given application can't choose at run-time whether to be a ZC, ZR, or ZED, but that would be a ZigBee platform choice. At the time of this writing, the Freescale platform requires the developer to choose at compile-time what ZigBee node-type a given device will be.
4.3.1 Channels
For those of you who haven't heard it before, the 2.4 GHz band is a worldwide unlicensed portion of the RF spectrum for use by many radio products. This band is also known as the ISM (Industrial, Scientific, and Medical) band. WiFi™ exists in this band. So does Bluetooth™. So do cordless phones and microwave ovens. And so does ZigBee.
ZigBee uses the same channel set as specified in 802.15.4. In the 2.4 GHz ba nd, t hese channels are numbered 11 through 26. Channel numbers 0 through 10 are defined by the sub-1 GHz 802.15.4 radios, but ZigBee (at least to date), doesn't run on the sub-1 GHz radios.
Note that if you use the Freescale SMAC networking stack (which is not ZigBee, but does use the same Freescale 802.15.4 radios), the channels are numbered 0 through 15. You can translate these numbers into MAC/ZigBee channels 11 through 26.
Channels are really just a portion of the RF spectrum. In the case of 802.15.4, each of these channels is separated by 5 MHz in the 2.4 GHz band, as shown in Figure 4.11.

802.15.4 uses Direct Sequence Spread Spectrum (DSSS) to spread the packets into symbols and reassemble them on the other end, verifying that the data was decoded correctly through use of a 16-bit CRC. In Chapter 7, "The ZigBee Networking Layer," I describe the 802.15.4 PHY in a little more detail, but other books describe this PHY standard better than I do. This book is about the ZigBee protocol. If you'd like to learn more about 802.15.4, try IEEE 802.15.4 Low-Rate Wireless Personal Area Networks: Enabling Wireless Sensor Networks, by Jose A. Gutierrez.
The 802.15.4 radio forms the foundation for ZigBee. Two interesting points about this radio is that it is half-duplex (it can listen or talk, but not both at the same time) and accesses one channel at a time. So, a device listening on channel 15 won't hear anything on channels 11 through 14 or 16 through 26.
ZigBee as a protocol does not typically change channels. Bluetooth, like some other wireless technologies, is a channel-hopping protocol and some believe that channel-hopping is required for reliability. Not so.
Due to the robust nature of O-QPSK and DSSS, 802.15.4 radios are very robust, even in a noisy RF environment. In fact, tests performed at the ZigBee Alliance with WiFi turned up to maximum on all channels, did not cause ZigBee to lose even one packet, over a series of thousands of data requests. Occasionally there were some retries, but not a single packet was dropped.
So how does a ZigBee device decide what channel to use? It is defined by the Application Profile. In Home Automation, for example, any ZigBee device wishing to join a network must scan all channels, and be able to join any network on any channel. If the profile is a private profile, it may choose to limit the device to one or any set of the 16 available channels.
But scanning channels does take time. When forming a network, ZigBee performs two scans:
• An energy detect scan
• An active scan
The energy detect scan is used to determine which channels are the quietest. The active scan sends out a Beacon Request, and is used to determine what other ZigBee or 802.15.4 PAN IDs are currently in use on that channel within hearing range of the radio. By default, ZigBee chooses the channel with the fewest networks, and which is the quietest (in that order).
Only the active scan (detecting other networks) is used when joining a network. If a network is already formed, and the Beacon Response can be heard by the joining node, it is assumed that the channel is quiet enough for communication.
The scan duration is defined by 802.15.4 specification, and is an integer between 0 and 14. See Table 53—MLME-SCAN.request parameters in the 802.15.4 specification for details. Since the value is used in a formula involving superframe duration, I've converted those times to milliseconds for your convenience (see Table 4.2 ).

In the Freescale platform, both channel selection and scan duration are fully under application control. The defaults for these are properties that can be set in BeeKit. The channels are defined by mDefaultValueOfChannel_c in ApplicationConf.h, and the scan duration by gScanDuration_c in BeeStackConfiguration.h. The defaults are channel 25 and scan duration 3. Each platform will have its own way of defining the channel set and scan duration.
Next: ZibBee Channels Example


Tim.Gillman
8/30/2010 1:37 AM EDT
To find out more about ZigBee and Wireless Sensor Networking, go to Drew's website: www.sanjuansw.com
Sign in to Reply