Tips for Designing ZigBee Applications

So you think you want to develop a ZigBeepurchase a competitor's product. Use of another
application, but you have some questions. What'sZigBee approved system during development
important in a ZigBee development? What toolsmay help you discover how your product's
do I need? What steps are involved? How muchperformance can best be optimized. Another
time will it take? What kind of investment isoption to test interoperability is to participate in
required? What are the unforeseen questions?one of the ZigBee Alliance's quarterly
The tips presented here can't answer all of theseinteroperability events called ZigFests. To
questions for everybody, but they will provide aparticipate in a ZigFest your company must be at
tutorial for the development of your ZigBeeleast an Adopter class member of the ZigBee
application.Alliance. There are also certification companies
The first and perhaps most important step inthat can provide a pre-certification testing
developing your application is to determineenvironment.
whether ZigBee is appropriate for your product.Remember that, fortunately, the ZigBee radio is
The ZigBee radio standard boasts manynot a frequency hopper like Bluetooth. Before the
advantages over other wireless options. With anetwork forms, the network coordinator scans
public ZigBee profile and conformant platform,the available channels to find the "clearest" one. A
interoperability with other vendor devices isfunction to perform this automatic frequency
assured. ZigBee was defined to supportselection is usually included with the ZigBee stack
extremely low power and remarkably longyou purchase, but is easy to implement if not.
battery life. But the ZigBee data rates are lowThe network coordinator can then be
relative to other wireless options. And whileprogrammed to periodically test the network to
substantially smaller than Bluetooth or 802.11/WiFi,determine if the selected frequency remains the
the ZigBee stack is not a simple piece ofbest option. If not, the network coordinator can
software.move the network to a different channel without
After deciding that you want to develop a ZigBeeoperator intervention. This insures the network will
application, you must choose a ZigBee providerperform optimally at all times.
partner. A ZigBee partner will supply the ZigBeeIf data security is required for your application,
stack software along with a radio chip andZigBee includes provisions for strong data
baseband microcontroller. Historically, these haveencryption. ZigBee data security is based on the
been two chip solutions. Recently, though, vendors128-bit AES algorithm. If you are using a public
have been introducing single chip ZigBee devicesZigBee profile then the security decisions have
with plenty of additional resources to supportalready been made and are pre-defined in the
your application code. A quality ZigBee partner willprofile.
also supply you with continual updates on theFor a custom application that requires data
most recent features.security, you have options regarding where the
Several ZigBee providers are available, and eachsecurity is applied - in the application code or in
has invested many person-years of developmentthe lower layers of the ZigBee stack. If your
to arrive at their ZigBee solution. In choosing aapplication needs the strongest security possible,
partner, you should consider technical aspects (thesecure it in your application code. The ZigBee
cost vs. capability of their chipset, supportedstack defines optional security in the lower layers
features) and business aspects of the providerof the stack, which can be used to validate each
(company history, licensing costs, technicaldata packet that is exchanged on your ZigBee
support). The ZigBee providers will also want tonetwork.
know about you - information such as yourYour development will most likely include the
previous product development experience and thedevelopment of two ends of a system - the
number of devices that you plan to sell. When thissensors, which may be reduced functionality
exchange of information is complete, you shouldZigBee end devices, and the devices with which
rather quickly be able to find a ZigBee providerthey want to communicate. Each end of the
willing to collaborate on your application.system will present its own design challenges.
After you have chosen a ZigBee provider, youPower optimization is generally the largest design
must then decide how to implement the ZigBeeissue for the sensors, while message
radio - as a module connected to the rest of themanagement is the largest for the ZigBee routers.
system or as a chip integrated into the circuitryMessage management is an important part of the
of your board.application code. Your application code will
Using a ZigBee radio module offers manycommunicate with the ZigBee stack by sending
advantages. A module usually leads to a shortermessages to the stack by calling stack functions
development cycle. The RF design is already doneand receiving messages from the stack through
for you - so you don't need to become an RFcallback functions. The application code will likely
expert. In addition, a module may carry FCCneed to monitor these messages and may need
Modular Approval, which means you won't haveto perform tasks, such as timing messages and
to take your product through the FCC's intentionalpurging "lost" messages, on top of its normal
radiator approval process.network management task.
Disadvantages to using a ZigBee radio moduleAs part of the application development planning
versus an integrated ZigBee chip include a higherprocess, be sure to include time to write test
per-unit product cost. A module design alsocode. During your integration phase, test code will
requires more physical space inside the housinghelp identify and verify boundary conditions of the
and imposes more constraints on the industrialfeature operations. Specialized test code may be
design of the product. What's more, a modulerequired to put the device in perpetual transmit
may have limited antenna options, which may bemode during hardware compliance testing. At the
unsuitable for your product.factory, properly designed test code can quickly
The final architecture task is to completely defineand thoroughly verify operation of each device as
your ZigBee network structure. The ZigBeeit comes down the line.
standard supports multiple topologies for you toOne tool vital to designing a ZigBee application is
choose from. These include mesh, star, andthe ZigBee RF sniffer/protocol analyzer. Even if
cluster tree network configurations, which areyour design uses a ZigBee radio module and a
shown in Figure 1.public ZigBee profile, you will eventually need to
The typical ZigBee network configuration isexamine commands as they are sent over the
comprised of low power reduced function endair. Many protocol sniffers are currently available
point devices, generally called sensors. Thewith a wide range of capabilities and cost.
sensors communicate with full function networkChoosing the sniffer will depend on your
control devices that handle the routing of packetsexperience with protocol analyzers, the depth of
over the network.protocol analyzing required, future expected
ZigBee radios can be implemented in several RFZigBee work, and the cost of each unit. The most
bands. Those operating in the 2.4 - 2.48 GHz bandlogical path is to start with a basic unit and
are the most common since this is the only RFupgrade later if you need additional capabilities.
band that is usable worldwide. In North America,Time-to-Market
915 MHz is available for ZigBee radios and offersIf time-to-market is a major requirement for the
a few advantages over 2.4 GHz, such as slightlysystem, use of a ZigBee radio module is almost a
better range. Fewer chip providers are availablegiven. A module-based design will provide the
who offer the lower frequency range, becausefastest development cycle.
antennas tend to be larger and the over-the-airMany projects require fast time-to-market with a
data rate is lower. The 868 MHz version ofsmall number of devices to introduce a
ZigBee also offers valuable features, though it istechnology or a product line. Often, higher volume
available for use only in Europe.production comes at a later date. If that is the
Now that all the architecture decisions have beencase, it may be possible for a two-phase
made, it is time to open the development systemdevelopment - the "fast" phase using a ZigBee
provided by your ZigBee partner and dig in. Anradio module and a "cost-reduced" integrated
example is shown in Figure 2. The developmentdesign phase to follow. This cost reduction phase
system will have sample application code tooften involves merging functionality from modules
reference. Your final application will likely resembleinto a single circuit board. The timing of a
this sample because you will apply the sametwo-phase approach also makes sense, because
Application Programming Interface (API) that theexpertise is built with the technology before
sample uses. You may also use the samemerging the radio chip on the circuit board. Plan
operating system, system calls, and interrupts.ahead, and the optimal market rollout is
Typical API commands are "FormNetwork()",achievable.
"JoinNetwork()", "SendMessage()", andLike any other electronic device that is brought to
"ZigBeeStackTick()." Learn to love this API - youmarket, your ZigBee application must meet
will live with it for the next couple of months.regulatory standards. Since a ZigBee device is an
During the development phase, you will faceintentional radiator, the device must meet global
many design challenges. Many will involve typicalstandards. As the owner of the design, you will be
embedded development issues, while others willresponsible for submitting the product for
arise because you've added a new design elementcompliance testing, adjusting the design as needed
- the ZigBee stack.to pass, and filing the final design with the
ZigBee advertises ultra low power. This is greatappropriate agency. Plan for several rounds of
for the radio - but you have to expand that totesting as early as possible in the design phase.
include your entire system design. To fullyThis includes a pre-screening test on the radiated
optimize power usage and battery life, theemissions.
firmware, electrical, and RF teams must devote aSince most ZigBee designs transmit at the low RF
good deal of time to optimizing powerpower of about one milliwatt, the fundamental RF
consumption. As part of this effort,emissions are not likely to be problematic.
microcontroller sleep modes must be defined andHowever, requirements on emission levels -
implemented. Be aware that your developmentparticularly the second and third harmonics that fall
system may not work properly while the systeminto FCC "restricted bands" - need to be carefully
is in sleep mode. You may need to use themonitored. You must also screen less technical
old-fashioned "GPIO toggle and scope tracing"compliance areas, such as product labeling
debug techniques.requirements and antenna limitations.
If your system will be battery-powered, keep inTo advertise your product as being ZigBee
mind that ZigBee radios do not violate the laws ofcompliant, your design must go through ZigBee
physics. ZigBee radios use the current required tocertified product testing. To submit the product
transmit at the selected power level - typically infor ZigBee testing, your company must be a
the range of 20-50 mA. Achieving multi-yearmember of the ZigBee Alliance. Joining the ZigBee
battery life is highly dependent on the usageAlliance is an inexpensive proposition and should be
scenario. Pay particular attention to howdone immediately because membership will allow
frequently the radio needs to wake up, how longaccess to many ZigBee-related documents and
it takes to wake up, and how much current itdiscussions. Visit their website at for more
consumes while asleep. You may find that ainformation.
ZigBee provider's data sheets are only helpful to aFor each and every ZigBee product, you will need
limited extent in this area, and you will end upto generate a unique 802.15.4 MAC address. The
making your own measurements on current802.15.4 MAC address is an eight-byte (64 bit)
consumption.value. The first three bytes (the Organizationally
In general, the principal tradeoff you need toUnique Identifier or "OUI") are licensed to your
make is data latency versus battery life. It seemscompany by the IEEE Standards Association for
counterintuitive; however, since ZigBeean annual fee. Your company is then free to
transmissions are at low RF power - in the rangeuniquely assign the remaining five bytes.
of a milliwatt - battery power usage duringFinally, depending on the factory assembly and
transmit and receive modes are similar. Don'ttesting process, it may be desirable to have a
assume that a radio mode will use little power if itsoftware-based manufacturing test provide the
spends most of the time in receive mode.MAC address to program into each device. In this
The ZigBee development system you start withcase, your application code may need to support
will probably not match your final hardware. Thisa non-violate memory write function that may
means you will be designing new interfaces tonot otherwise be necessary.
your devices - buttons, displays, memory, etc.Conclusion
You may also need to add a communicationZigBee is a well-defined and feature-rich radio
channel to another system, such as a systemstandard; however, developing a ZigBee product is
monitor PC program. This is where taking thenot a trivial exercise. Many engineering disciplines
time to thoroughly understand the API and yourmust work together to define, architect, design,
development system's starting point helps,test and ready the final product for sale. Following
because you will need to merge these newthe suggestions set forth in this discussion will
interfaces with the rest of the existing design.enable you to prepare a practical plan towards
In order to verify interoperability of your device,creation of a ZigBee radio application.
you may need to swallow your pride and