Sunday, 28 September 2014

ZigBee/XBee Technology

             The explosion in wireless technology has seen the emergence of many standards, especially in the industrial, scientific and medical (ISM) radio band. There have been a multitude of proprietary protocols for control applications, which bottlenecked interfacing. Need for a widely accepted standard for communication between sensors in low data rate wireless networks was felt. As an answer to this dilemma, many companies forged an alliance to create a standard which would be accepted worldwide. It was this Zigbee Alliance that created Zigbee
Bluetooth and Wi-Fi should not be confused with Zibgee. Both Bluetooth and Wi-Fi have been developed for communication of large amount of data with complex structure like the media files, software etc.  Zigbee on the other hand has been developed looking into the needs of communication of data with simple structure like the data from the sensors.


What is Zigbee and who all are involved?

Zigbee is a low power spin off of WiFi. It is a specification for small, low power radios based on IEEE 802.15.4 – 2003 Wireless Personal Area Networks standard. The specification was accepted and ratified by the Zigbee alliance in December 2004. Zigbee Alliance is a group of more than 300 companies including industry majors like Philips, Mitsubishi Electric, Epson, Atmel, Texas Instruments etc. which are committed towards developing and promoting this standard. The alliance is responsible for publishing and maintaining the ZIgbee specification and has updated it time and again after making it public for the first time in 2005. Most of the recent devices conform to the Zigbee 2007 specifications has two feature sets– Zigbee and Zigbee Pro. The manufacturers which are members of the Alliance provide software, hardware and reference designs to anyone who wants to build applications using Zigbee.
Many years ago, when Bluetooth technology was introduced, it was thought that Bluetooth would make WiFi redundant. But the two coexist quite well today, so do many other Wireless standards like WirelessHART and ISA100.11a. Then why would we need another WPAN standard like Zigbee? The answer is, the application focus of Zigbee Alliance - low cost and low power for energy efficient and cost effective intelligent devices. Moreover, Zigbee and Bluetooth have different application focus. Despite of all their similarities, and despite the fact that both are based on the IEEE 802.15 standards, the two are different in technology as well as scope. Bluetooth is made with mobile phones as its centre of universe enabling media transfer at rates in excess of 1 Mbps while Zigbee is built with emphasis on low data rate control system sensors featuring slower data of just 250 kbps.

Zigbee Networks:

Zigbee devices can form networks with Mesh, Star and Generic Mesh topologies among themselves. The network can be expanded as a cluster of smaller networks. A ZigBee network can have three types of nodes: Zigbee Coordinator (ZBC), Zigbee router (ZBR) and Zigbee End Device (ZBE) each having some unique property.
Let us understand Zigbee through a typical usage scenario in a home automation system. There can be only one ZBC in a network, the one that initiates the network in the first place and stores the information about the network. This would be the main control panel or remote control in the living room of each storey.  All the devices in the network communicate with this ZBC. It has routing capabilities and acts as a bridge to other networks on other floors. A ZBR is an optional component used to extend the coverage, say, providing access to the Zigbee receivers controlling the garage lighting and shutter which is in the nearby shed. The router itself may host an application like a CC Camera which is continuously in active monitoring state. It can also handle local address allocation or de-allocation . A ZBE is optimized for low power consumption and is the cheapest among the three node types. It communicates only with the coordinator and is the point where sensors are deployed. Any end device like lighting units, air conditioning elements etc. can be Zigbee End Devices. Unicast Device Discovery is done if Network ID is available; else Broadcast Device Discovery is done. A ZBR or ZBC’s response to Device Discovery query is a payload containing IEEE address, the Network Address and all known network addresses. Device bindings which are logical links between end devices can be created like binding of a Lamp Application Object with a Switch Application Object. The Radio unit and the Processing unit are often built into a single chip to reduce costs. When a car enters the premises, the radio transmitter inside the car broadcasts its presence to the Zigbee Coordinator through routers. The coordinator then binds the garage shutter’s receiver with the Car’s transmitter and all packets from the Car transmitter are routed to the Shutter, which can then open and close without stepping out of the car. The whole transaction can be automated such that by the time the car reaches the garage door, it automatically opens.
In a network, data traffic can be periodic, intermittent or repetitive. When data is periodic, the application determines the rate of transfer. Intermittent data needs optimum power savings and hence the data rate is stimulus dependent. For repetitive type of data, guaranteed time slots are used, for example the air conditioning unit.

Architectural Overview:

Zigbee bases itself on the IEEE 802.15.4-2003 specifications which lay down standards for the Physical and MAC layers. The protocol stack is completed by adding Zigbee’s own Network and Application Layers. Drawing analogies from the OSI protocol stack simplifies the study of Zigbee protocol. In the figure below, the two protocols are stacked up side by side to see the similarity of roles of various layers.
A brief overview of each layer is now presented below:
Physical Layer
Zigbee uses three frequency bands for transmission- 868 MHz band with a single channel has a raw data rate of 20 kb/s. The 915MHz band with 10 channels has each channel’s central frequency separated from the adjacent band by 2 MHz and data rate of 40 kb/s. BPSK modulated symbols are transmitted at 1 bit per symbol using Direct Sequence Spread Spectrum (DSSS) technique with 15 bit chips. The 2.4 GHz ISM band with 16 channels, 5 MHz wide offers 250 kb/s data rate. It employs O-QPSK modulation with 4 bits/symbol transmitted using DSSS with 32 Bit chips. To reduce the transmitted power, the Zigbee transmitters use Energy Detection (ED) and Link Quality Indication (LQI). It is the responsibility of the physical layer to perform channel assessment.
MAC Layer
Channel access is primarily through Carrier Sense Multiple Access- Collision Avoidance (CSMA-CA). On a node hop to hop basis, the MAC layer can take care of transmitting data. Depending on the mode of transmission, i.e. Beacon or Non-Beacon mode, the MAC layer decides whether to use slotted or unslotted CSMA-CA. The MAC layer takes care of scanning the channel, starting PANs, detecting and resolving PAN ID conflicts, sending beacons, performing device discovery, association and disassociation, synchronizing network device and realigning orphaned devices on the network. Along with this, the MAC layer also provides some standard security features like access control, encryption of data, duplicate rejection and frame integrity. Like in the case of the standard OSI MAC Layer, MAC layer in Zigbee also cannot take care of the situation when the nodes have intermediate nodes between them. This functionality of routing the packets to their destinations is provided in the network layer.
Network and Security Layer
The network layer takes care of network startup, device configuration, topology specific routing, and providing security. On each node, the network layer is the part of the stack that does the route calculations, neighbor discovery and reception control. All the nodes are optimized using unique 64 bit addresses as per the IEEE 802.15.4 standard, supporting a maximum of 65536, 16 bit network address devices which can have 256 sub addresses. The network routing table is populated when the devices come alive in the network for the first time by generating Broadcast Routing Request Packets (RREQ). Endpoint routers respond to these packets as Routing Response Packets (RREP).
Application Support Sub-Layer
It interfaces the network layer and application layer providing a general set of services through two entities, the APS Data Entity (APSDE) and APS Management Entity (APSME) accessed through their respective Service Access Points (SAP). These provide services like binding management, making application level PDU, group filtering, and managing Object database called APS Information Base, providing reliability of transaction etc. which are the necessary functions for an application to work properly.

Application Framework
It is the environment to host application objects on a Zigbee device.Up to 240 distinct application objects can be defined uniquely. It consists of the application profiles as the top layer over ZDO which provides the base functionality.
·         Application Profiles define an accepted language for exchanging data and provide interoperable services across different manufacturers. Zigbee Alliance has released several Standard Profiles which contain different device descriptors which have unique identifiers.
·         ZigBee Device Objects (ZDO) provides an interface between the application objects, the device profiles, and the APS layer in Zigbee devices. It is located between the Application Profiles and the application support sub-layer. The ZDO are responsible for initializing the APS, the network layer, and the Security Service Provider, and also forming the configuration information from applications to implement discovery, security, network and binding management.


Data Transfer Modes
This data can be transferred in two modes: Beacon Mode and Non-beacon mode. In beacon mode, the data is sent periodically over the network. In between the time period when the devices are not sending data, they may enter a low power sleep state to minimize power consumption. However, such close timing and network synchronization has precise timing needs as the beacon period is of the order of milliseconds. This can pose design constraints while reducing costs and eventually is a tradeoff between the design constraints and costs involved. In a non-beacon mode, the coordinators and the routers active in the network have to stay awake for most of the time to listen incoming data and hence need robust power supplies. Hence, the end devices can sleep most of the time and wake up solely for sending data, or on receiving a trigger, while the core devices need to be active, creating an asymmetric power distribution in the network. This creates a heterogeneous network.
Having gone through the protocol stack of the Zigbee protocol, let us have a look at its pros and cons. Zigbee has proven to be a good extension of existing standards, which is now backed by many companies worldwide. This is a big leap towards achieving a widely accepted industry standard. On the flipside, ZIgbee networks have a single point of failure especially in the star networks.   
Zigbee devices find use in a multitude of areas like Industrial, commercial, toys, Computer Peripherals, Personal Health Care, Building Automation etc., virtually everything imaginable in the role of Wireless Sensor Nodes or short range communications. . The first thrust of the Alliance seemed to be Smart Energy and Home Automation. There are 5 application profiles that have been released so far involving Home Automation and Smart Energy, and others involving Building Automation and Retail Services are in the pipeline. This has met with phenomenal success and now, Zigbee has started to form strong foothold in Advanced Metering Infrastructures (AMI). Zigbee and RF4CE have made combined efforts to develop the Zigbee RF4CE specifications for consumer devices that could replace multiple remote controls with a single one.
And why is Zigbee considered a possible competitor to Bluetooth technology? The answer would be evident from a comparison between the two. This however should not be the basis of deciding which technology is the best, but to decide, what technology is best suited for the specific task. Eventually, it might coexist with Bluetooth just as Bluetooth has come to live with WiFi.