ZigBee Wireless Sensor Networks

Dr. Dobb's Journal November, 2004

A low-cost, low-power wireless Standard

By Drew Gislason and Tim Gillman

Drew and Tim are the founders of San Juan Software (http://wwww.sanjuansw.com/), a ZigBee Alliance member company specializing in software for wireless sensor networks. They can be contacted at drewg@sanjuansw.com and timg@sanjuansw.com, respectively.

It's 6:43am somewhere between Missoula, Montana and Pocatello, Idaho. An independent freight carrier is enroute with fresh-frozen, line-caught Chinook salmon from a Seattle port to its final destination, Denver, Colorado. A ZigBee-enabled wireless sensor attached to one of the pallets warns the driver that the internal temperature of the salmon has risen near the spoilage threshold. The temperature is adjusted and the salmon is saved. So are the wireless sensors on each pallet, which are sent back to the salmon producer to include in next week's shipment.

It's 8:19am somewhere off the coast of San Juan Island in the Pacific Northwest. A 70-foot whale-watch touring boat is headed out to sea with 100 passengers aboard. Suddenly, a flash lights up a panel on the bridge—oil pressure is dangerously low on the left main. A ZigBee wireless sensor has transmitted the details and the onboard engineer/skipper repairs the problem with no down-time for the touring company or passengers.

What if you had the information you needed a little bit earlier? What if wireless sensors were nearly free? ZigBee, an emerging wireless Standard, aims to do just that by targeting wireless sensor networks where low-cost, low-power, high-reliability, and high-security are the core issues of the embedded application.

Not another wireless Standard, you say. What with Wi-Fi, Bluetooth, WiMax, and WiMedia, why ZigBee? While the various Standards do compete in some markets, they are generally complimentary and ZigBee fills an important niche—that of inexpensive wireless sensor networks. Table 1 compares some of the most common Standards on issues such as range, cost, battery life, and technology.

Each of the wireless Standards has its niche:

ZigBee, however, is focused in an area not yet covered by any other standard wireless technology—low-cost, long-battery-life (months to years), and large sensor networks (up to 65,000 nodes). ZigBee also addresses other important considerations, such as high security to prevent wireless tampering and eavesdropping, high reliability to ensure that data packets are received, and a reasonable range for networking sensors and actuators together.

The ZigBee Alliance (http://www .zigbee.org/) serves much the same purpose as the Wi-Fi Alliance does for 802.11—it assures device interoperability and promotes the Standard. Before the Wi-Fi Alliance formed, there was little compatibility and the market for wireless 802.11 devices was practically nonexistent. Today, hot spots such as T-Mobile are commonplace and it's hard to find a laptop that doesn't come with at least an 802.11b connection.

Initially founded by Motorola Semiconductor (now Freescale), Samsung, Honeywell, Philips, Mitsubishi, and Invensys, the ZigBee Alliance encompasses more than 85 member companies across an entire ecosystem, ranging from ZigBee-compliant radio chip vendors (Freescale, Ember, and the like), hardware design houses, software vendors, test houses, and system integrators.

A number of companies are poised to launch new products as soon as the ZigBee specification is ratified (expected before the end of this year). Product concepts range from lighting, HVAC (heating, ventilation, and air conditioning), industrial process control, precision agriculture (providing water as needed as opposed to on a schedule), health equipment, and monitoring cargo to prevent tampering or detect improper handling. The products use a wide array of sensors to accomplish their tasks, including temperature, pressure, moisture, acceleration, acoustic, chemical/gas, flow, and motion, among others.

Many products address issues such as cost savings for the customer. For example, wiring to a switch can cost on the order of $10.00 per foot in the light commercial (hotel) or industrial sectors. ZigBee can do that for a $6.00 increase in the price of the switch, with no wiring. Other products address issues that just weren't possible without ZigBee technology; for example, monitoring a pressure sensor in a rotating tire (try that with wires!) or monitoring cargo at the center of a large shipping freighter.

The Application Framework Group (AFG), a committee within the ZigBee organization, has defined protocols so that products within a given application segment can interoperate seamlessly. For example, lighting products from Philips will be able to wirelessly connect a set of lights to a switch made by Leviton, with an occupancy sensor from a third vendor.

A number of wireless products are currently shipping even though the ZigBee Standard is not yet ratified. These applications generally claim to be "ZigBee Ready," meaning they are close to what the final Standard is expected to be and can possibly even be upgraded in the field. These ZigBee Ready products are possible because the hardware radio Standard defined in the ZigBee specification, IEEE 802.15.4, was released in October 2003. Figure 1 shows how the radio, ZigBee network stack, and applications coexist in a ZigBee device. Various silicon vendors offer 802.15.4 radios in production quantities today, including Freescale, Atmel, ChipCon, ZMD, and Ember. Most vendors also offer a proprietary version for specialized applications. (For information on the 802.15.4 specification, see http://standards.ieee.org/wireless/ and Low-Rate Wireless Personal Area Networks: Enabling Wireless Sensors with IEEE 802.15.4, by Jose Gutierrez, Edgar Callaway, Jr., and Raymond Barrett, Jr., IEEE Press, 2003.)

Again, one of the fundamental elements of ZigBee is low cost. One way that ZigBee reduces the overall bill of materials (BOM) is by requiring no more processing power than a typical 8-bit microcontroller. For a minimal system, all that is required is the sensor, battery, 802.15.4 radio, and 8-bit microcontroller with on-board Flash and RAM. Radio silicon vendors usually specify a range of microcontrollers compatible with their radios and the ZigBee software stack that operates them.

Another method of reducing cost to manufacturers is the use of unlicensed bands—2.4-GHz worldwide, 915 MHz in the Americas, and 868 MHz in Europe. Unlicensed bands require less in the way of certification and reduce the cost of entry for companies producing products. In the end product, cost savings are passed on to the customer in the form of ease of installation (the goal is a five-minute setup time for a consumer-type ZigBee application), and, of course, in the application itself, saving on the cost of goods shipped, on water consumption, or wiring installation costs.

The secret to ZigBee low-power consumption is a low-duty cycle and the rapid ability of 802.15.4 radios to sleep. For example, a ZigBee device that requires 10mW active power and 10uW standby power with a duty cycle of 0.1 percent supplied by a 750mAh AAA battery linearly regulated to 1V would have a battery life of around 37,000 hours or about four years and three months.

ZigBee adopts 128-bit AES security for all wireless communication, resulting in very secure sensor networks. Why is security important in sensor networks? Imagine a denial of lighting attack in a high-rise office building, or pranksters using the same to spell-out their opinion on the side of the building (come to think of it, a ZigBee enabled advertising product using high-rise office building windows might be interesting). Or imagine your competitor stealing sensor data from the factory floor, or worse, injecting false data into the wireless network to bring down a production line. Security is a serious concern for the ZigBee Alliance.

Some radio vendors implement 128-bit AES security directly in silicon. For others, it is implemented in software, requiring resources from the microcontroller. Key exchange usually only happens during the setup of a ZigBee network. For various reasons, security measures such as WEP were deemed not adequate for ZigBee devices. Wi-Fi solved this problem by introducing 802.11i, which also uses 128-bit AES encryption.

Like security, reliability has always been a concern with wireless devices. Ever lost a call or had trouble hearing the person on the other end of your cell phone? Atmospheric conditions, metal barriers, or even microwaves can interfere with a wireless signal. To compensate, the 802.15.4 communications protocol uses Direct Sequence Spread Spectrum (DSSS) to transmit the signal, a wideband technique that greatly improves the signal-to-noise ratio.

One often voiced concern is that a lot of products operate on the 2.4-GHz band—Wi-Fi networks, portable phones, and the like. Surprisingly, interoperability with other commercial devices operating on the same frequency has not been a problem for ZigBee devices. At Sensors Expo (http://www.sensorsexpo.com/), all ZigBee demonstrations were performing flawlessly in the very 2.4-GHz crowded hall. One vendor talked about an intermittent signal that was dropped about once a week at one of its customer sites. It turned out that a delivery truck would park in front of the ZigBee wireless device that needed to transmit data. Adding another ZigBee node to create an alternate path resolved the problem.

Which leads to one of the most interesting technologies within ZigBee—mesh networking. An advanced technique for connecting peer-to-peer devices, mesh networking employs redundant paths between two devices, allowing packets to multihop to their final destination if required. In the aforementioned truck example, the data simply hopped right around the truck. Multihop is also important if the two end radios are simply out of range.

Mesh networking leads to a simple installation process. An ad hoc network can be set up by simply placing nodes where the sensors are needed and adding repeater nodes in between if required. Redundancy allows for node failure so that critical devices always communicate.

ZigBee defines three classes of nodes in a ZigBee network:

The PAN coordinator can be elected when the network is first established or may change over time as the network changes. FFDs can be used to pass a packet along to its final destination. RFDs are designed to be the lowest cost devices, do not propagate packets across the network and, therefore, tend to use less power. Any of these devices may monitor one or more sensors or control actuators.

One routing scheme used with mesh networking is called "Gradient Routing." Analogous to water flowing down hill, Gradient Routing uses tables to tell which direction to flow a data packet that is received. The distance tables are usually just a simple number to help the network choose the optimum path for the data given the current network layout.

Due to the complexity of mesh networking, a ZigBee stack is usually in the 32-KB code range, meaning that the microcontroller must have more memory (typically flash) to allow room for the application. Reduced function devices use less memory and can usually get by with 32-KB microcontrollers. Compare this to the size of a Bluetooth stack (in the neighborhood of 128 KB+), and you see why ZigBee is well suited for low-cost sensor networks.

But mesh networking is just one of the possible ZigBee network topologies. Figure 2 illustrates a simple Star Network or a Cluster Tree Network. Wi-Fi networks (802.11n) are typically star networks. Information from one node (laptop) passes through a router to another node. Star networks might be used where a set of sensors are all networked in close proximity to the PAN coordinator; for example, on a golf-course green. The PAN coordinator can then control an actuator turning on the sprinkler when the green is too dry.

Cluster Tree Networks generally are used when the network is large and topology known; in a hotel, for example, where lighting is fairly fixed in location. Cluster networks scale well because data traffic tends to stay within the cluster.

Mesh networking and security are complex, but that complexity has been reduced to a simple API, included in the ZigBee stack provided by a number of hardware and software vendors. Most radio vendors offer a full ZigBee stack with their radios (or will when the specification is ratified).

ZigBee devices are generally programmed in C, sometimes requiring assembly language for particular time- or space-critical components. Because ZigBee devices use well-established microcontrollers, there are a number of development tools available. Interoperability is controlled by the ZigBee organization through a logo certification program. Various ZigBee Alliance member companies will be offering certification-compliance testing.

ZigBee is not a panacea for all embedded wireless applications. Data rates are low; only 250 kbps in the 2.4-GHz band, dropping to 40 kbps in the 915-MHz band. That rate drops by a factor of 10 in a practical mesh network. You won't be sending multimedia over this connection. Low-power consumption is based as much on a low-duty cycle as it is on the low-power nature of the 802.15.4 radios.

ZigBee wireless range is not huge at 30-70 meters—adequate for some applications, too short for others. ZigBee may still be too high end for some products that require a 4-bit microcontroller or less or only need one-way communication.

ZigBee is a well-thought-out protocol filling a much needed niche—low-cost wireless sensor networks. ZigBee will change the way many devices communicate—adding intelligence and saving money while providing more timely information. The real adventure will be in thinking of new applications for the technology: the mailbox that signals when mail has arrived; optimizing grape harvest in the vineyard through a controlled program of watering, temperature, and fertilizing; and preventing a disaster or mistake through better, more timely information.

DDJ