This zigbee tutorial describes everything you would like to know about Zigbee protocol stack. Now-a-days zigbee is becoming very popular for low data rate wireless applications. Zigbee devices are used in smart energy, medical and in home automation. In smart energy applications zigbee products are used to monitor and control use of energy and water, which helps consumers save energy and water and save money too. In medical field it is used to connect unlimited number of health monitoring devices and many more. In home automation it controls domestic lighting, such as switches, dimmers, occupancy sensors and load controllers. It has two bands of operation 868/915MHz and 2450MHz. 868/915 band provides about 20-40Kb/s and 2450MHz band provides about 250 kb/s data rates. In addition to this uses zigbee end devices can go to sleep mode which saves battery consumption and it also takes care of security of the information owing to security layer.
Zigbee Network Overview:
As mentioned in the network diagram, zigbee network is comprised of coordinator(C), router(R) and end devices (E). Zigbee supports mesh-routing. For detailed information on routing protocol employed in zigbee, one may refer Ad-hoc on-demand Distance Vector Routing protocol (AODV protocol), RFC 3561
Coordinator - Always first coordinator need to be installed for establishing zigbee network service, it starts a new PAN (Personal Area Network), once started other zigbee components viz. router(R) and End devices(E) can join the network(PAN). - It is responsible for selecting the channel and PAN ID. - It can assist in routing the data through the mesh network and allows join request from R and E. - It is mains powered (AC) and support child devices. - It will not go to sleep mode.
Router - First router needs to join the network then it can allow other R & E to join the PAN. - It is mains powered (AC) and support child devices. - It will not go to sleep mode.
End Devices - It cannot allow other devices to join the PAN nor can it assist in routing the data through the network. - It is battery powered and do not support any child devices. - This may sleep hence battery consumption can be minimized to great extent. There are two topologies, star and mesh, as mentioned Zigbee supports mesh routing. PAN ID is used to communicate between zigbee devices, it is 16 bit number. Coordinator will have PAN ID set to zero always and all other devices will receive a 16 bit address when they join PAN. There are two main steps in completing Zigbee Network Installation. Forming the network by Coordinator and joining the network by Routers and End devices.
Forming the Zigbee Network
- Coordinator searches for suitable RF channel which is usable and not interfering with Wireless LAN frequencies in use. This is because WLAN also operates in the same 2.4GHz bands. - Coordinator starts the network by assigning a PAN ID to the network. Assignment is done in two ways. Manual (pre configured) and dynamic (obtained by checking other PAN IDs of networks already in the operation nearby so that PAN ID does not conflict with other networks). Here Coordinator also assigns network address to itself i.e. 0x0000. - Now coordinator completes its configuration and is ready to accept network joining request queries from routers and end devices who wish to join the PAN.
Joining the Zigbee Network
There are two ways to join a zigbee network.MAC association and network re-join. First one is implemented by device underlying MAC layer and second one is implemented by network layer, despite the name may also be used to join a network for the first time. MAC association can be performed between C and R/E or R and E or R and other R. - Let us assume that Coordinator(C) has already established the PAN network. Hence next step for R or E is to find out whether C is allowing joining or not. So they do PAN scan or send beacon request frame. - After they come to know that they can join the network, they will send association request frame and will join the network as soon as they receive the association response. As mentioned above whether or not C or R allow a new device to join depends on two main factors -Permit joining attribute -Number of end device children it already has. One of the applications of zigbee in home is that switch, speakers and lamp is controlled using zigbee technology.
Zigbee Protocol stack:The following figure depicts zigbee stack,which consists of four layers viz. PHY,MAC,network & security and application layer. The first two are covered in IEEE 802.15.4 WPAN standard and the later two are covered in documents published by zigbee alliance.
Pl. refer our article on Basics of OSI and TCPIP to understand application layer in general. There are two profiles at this layer. 1. Manufacturer specific application profile- Operate as closed systems and also ensured that they can coexist with other zigbee systems. 2. Public application profile- for this to work interoperability between various zigbee devices is a must. A single zigbee node supports up to 240 application objects called end points. An end point specifies specific application, for example, 0 dedicated to ZDO (Zigbee device object), provides control and management commands. 6 used for control of light. 8 used for manage heating and air conditioning.
Ad-hoc on-demand Distance Vector Routing protocol (AODV) is used at network layer.
If security is enabled C will start up using a 128 bit AES encryption key. Devices having same security key can communicate on PAN. How to obtain this key? 1. Pre-installation 2. Key is received over the air during joining.
Each MAC frame consists of three fields MAC header, MAC payload and MFR (FCS).
Each MAC frame will contain Frame control field (16 bit), which carry frame type, addressing fields and other control flags.
This MAC control field contain frame type field, which is the main differentiating factor in identifying one MAC frame with the other. It is 3 bit in length.
The MAC frames are divided into following four major categories, which is used by zigbee devices to establish connection to the PAN by exchanging system information. 1. Beacon 2. Data 3. Acknowledgement 4. MAC command
There are two PHY layer formats one each for 868/915MHz and 2450MHz bands. 868-868.6 MHz zigbee band delivers about 20Ksymbol/s with BPSK modulation employed. 902-928 MHz band delivers about 40 Ksymbol/s with BPSK modulation. 2400-2483.5 MHz delivers about 62.5 Ksymbol/s with O-QPSK modulation.
868/915 PHY layer:
PHY layer mentioned in the figure is self explanatory. The first block is differential encoder.
En = EX-OR of Rn and En-1.
Rn is the raw data bit being encoded,
En is the corresponding differentially encoded bit,
En-1 is the previous differentially encoded bit.
Bit to chips will convert each bit to 15 chip values, as mentioned in IEEE 802.15.4-2003 standard in section 184.108.40.206. Next is BPSK and Raised cosine filters in the chain. This filtered signal is modulated using RF carrier and transmitted.
2450 PHY layer:
Each octet is divided into two nibbles of 4bits each. This nibbles are converted to decimal value 0-15. This is fed as input to symbol to chip and based on Symbol-to-chip mapping table these decimal values are converted into chips. Later chips are passed through OQPSK and half sine wave pulse shaping filter before being converted to RF modulated waveform.
PPDU packet format which is transmitted is mentioned below.Zigbee PPDU Frame consists of SHR(Preamble 4bytes, SFD 1 byte) + PHR(Frame length 1 bit, Reserved 1 bit) + PHY Payload(PSDU variable length)
Preamble is composed of 32 zeros and is used for chip and symbol synchronization at receiver part of transceiver. SFD is 8 bit field segregate between preamble and actual physical layer data. Frame length is 7 bits long and indicates total number of octets contained in the PSDU (i.e. PHY payload) PSDU field carries PHY packet and is variable in length. All the packet types of length 5 octets or greater than 7 octets, PSDU contains MAC sub-layer frame (i.e. MPDU).
Apart from this zigbee tutorial's contents if reader wants to gain more knowledge they can refer IEEE standard mentioned below.
1. IEEE 802.15.4-2003 standard
Pl. note that all the figures and tables mentioned on this page have been taken from IEEE standard to demonstrate zigbee concept.
Zigbee Useful Links
Refer page on zigbee products which covers zigbee equipment,semiconductor,test and measurement,gadgets,stack
Refer page on zigbee gadgets which covers zigbee home automation,healthcare,smart energy,lighting,telecom,security,appliances related gadgets.
Refer page on bluetooth versus zigbee which describes comparison between Bluetooth and Zigbee technologies.
Refer our page which describes about what zigbee does including its applications and provides useful references.