ZigBee Standard Overview
ZigBee technology, driven by IEEE 802.15.4, has not only achieved successful applications in traditional fields such as industry, agriculture, military, environment, and medical care, but its future applications may involve all areas of human daily life and social production activities, truly realizing ubiquitous networking. ZigBee technology is a set of technical standards related to networking, security, and application software developed based on the IEEE 802.15.4 wireless standard. The wireless personal area network working group IEEE802.15.4 technical standard is the foundation of ZigBee technology. ZigBee technology is built on the IEEE 802.15.4 standard, which only handles the low-level MAC layer and physical layer protocols, while the ZigBee Alliance has standardized its network layer protocols and APIs.
ZigBee technology is a bidirectional wireless communication technology characterized by short range, low complexity, low power consumption, low data rate, and low cost, primarily used for data transmission between various electronic devices with short distances, low power consumption, and not high transmission rates. Typical data transmission types include periodic data (such as sensors), intermittent data (such as lighting control), and low response time data (such as mice). Its target function is automation control. It employs frequency hopping technology, using frequency bands of 2.4GHz (ISM), 868MHz (Europe), and 915MHz (USA), all of which are unlicensed bands, with effective coverage ranging from 10 to 275m. When the network rate drops to 28kb/s, the transmission range can be extended to 334m, providing higher reliability.
The ZigBee standard is an emerging short-range wireless network communication technology based on the IEEE 802.15.4 protocol stack, primarily designed for low-rate communication networks. It has low power consumption and is the most likely wireless method to be applied in industrial control scenarios. The data transmission rate in the 2.4GHz band is 250kb/s, 40kb/s in the 915MHz band, and 20kb/s in the 868MHz band. Additionally, it can connect with up to 254 nodes, including instruments and home automation application devices. Its inherent characteristics provide significant development space in fields such as industrial monitoring, sensor networks, home monitoring, and security systems. The ZigBee architecture is shown in the figure.
ZigBee Technology Features
ZigBee is a wireless connection that can operate in three frequency bands: 2.4GHz (globally popular), 868MHz (popular in Europe), and 915MHz (popular in the USA), with maximum transmission rates of 250kb/s, 20kb/s, and 40kb/s respectively. Its transmission distance ranges from 10 to 75m but can be further increased. As a wireless communication technology, ZigBee’s technical advantages are mainly reflected in the following aspects.
1. Low Power Consumption
ZigBee network node devices have short working cycles and low power consumption for transmitting and receiving data, and they use a sleep mode (when not receiving data, they are in sleep mode, and when data needs to be received, they are awakened by the “coordinator”). Therefore, ZigBee technology is particularly energy-efficient. It is estimated that ZigBee devices can operate for up to 6 months to 2 years on just two AA batteries, which is unmatched by other wireless devices, avoiding frequent battery replacements or charging, thereby reducing the burden of network maintenance.
2. Low Cost
Due to the very simple design of the ZigBee protocol stack, its research and production costs are low. Ordinary network node hardware only requires an 8-bit microprocessor and 4-32KB of ROM, and the software implementation is also very straightforward. With the industrialization of products, the price of ZigBee communication modules is expected to drop to 10 Yuan RMB, and the ZigBee protocol is royalty-free. Low cost is also a key factor for ZigBee.
3. High Reliability
By adopting a collision avoidance mechanism and reserving dedicated time slots for communication services that require fixed bandwidth, it avoids competition and conflicts during data transmission and reception. The MAC layer uses a complete acknowledgment data transmission mechanism, where each sent data packet must wait for acknowledgment from the receiver, fundamentally ensuring the reliability of data transmission. If problems occur during transmission, retransmission can be performed.
4. Large Capacity
A ZigBee network can accommodate up to 254 slave devices and 1 master device. Up to 100 ZigBee networks can exist simultaneously in one area, and the network composition is flexible.
5. Low Latency
Compared to Bluetooth technology, ZigBee technology has very low latency across various metrics. The communication latency and the latency from sleep mode activation are very short, with a typical device search latency of 30ms, while Bluetooth is 3-10s. The sleep activation latency is 15ms, and the active device channel access latency is 15ms. Therefore, ZigBee technology is suitable for wireless control applications that have strict latency requirements (such as industrial control scenarios).
6. Good Security
ZigBee technology improves data integrity checks and authentication functions, using AES-128 encryption algorithms, and each application can flexibly determine security attributes, effectively ensuring network security.
7. Limited Effective Range
The effective coverage range is between 10 to 75m, depending on the actual transmission power and various application modes, basically covering typical home or office environments.
8. Compatibility
ZigBee technology seamlessly integrates with existing control network standards. Networks are automatically established through network coordinators, using Carrier Sense Multiple Access with Collision Avoidance (CSMACA) for channel access. A full handshake protocol is also provided for reliable transmission.
ZigBee has a broad application prospect. The ZigBee Alliance predicts that in the next 4 to 5 years, each household will have 50 ZigBee devices, ultimately reaching 150 devices per household. It is estimated that the ZigBee market value will exceed hundreds of millions of dollars per year. Its application fields are shown in the figure.
(1) Home and Building Networks. Through ZigBee networks, home appliances, doors, and windows can be controlled remotely; remote automatic meter reading for water, electricity, and gas can be easily achieved; a single ZigBee remote control can control all home appliance nodes. In the future, households will have 50 to 100 ZigBee chips installed in light switches, smoke detectors, meter reading systems, wireless alarms, security systems, HVAC systems, and kitchen appliances to provide remote control services.
(2) Industrial Control. In the field of industrial automation, using sensors and ZigBee networks makes data automatic collection, analysis, and processing easier, serving as an important component of decision support systems. For example, detection of hazardous chemical components, early detection and forecasting of fires, and monitoring and maintenance of high-speed rotating machinery.
(3) Public Places. For example, smoke detectors, etc.
(4) Agricultural Control. Traditional agriculture primarily uses isolated, non-communicative mechanical devices, mainly relying on manual monitoring of crop growth conditions. By adopting sensors and ZigBee networks, agriculture can gradually transition to an information and software-centric production model, using more automated, networked, intelligent, and remote-controlled devices for farming. Sensors can collect information including soil moisture, nitrogen concentration, pH value, precipitation, temperature and humidity, and atmospheric pressure. This information, along with the geographical location of the collected data, is transmitted via ZigBee networks to central control devices for farmers’ decision-making and reference, allowing for early and accurate problem detection, thus helping to maintain and improve crop yields.
(5) Medical. With the help of various sensors and ZigBee networks, accurate and real-time monitoring of patients’ blood pressure, body temperature, and heart rate can be conducted, reducing the workload of doctors during rounds, aiding in quick responses, especially for critically ill patients. Emergency call devices and medical sensors for the elderly and those with mobility issues.
(6) Commercial. For example, smart labels, etc.
ZigBee Protocol Framework
The ZigBee stack is built on the IEEE 802.15.4 standard, defining the MAC and PHY layers of the protocol. ZigBee devices should include the PHY and MAC layers defined by IEEE 802.15.4 (which specifies RF communication and communication with adjacent devices), as well as the ZigBee stack layers: network layer (NWK), application layer, and security service provision layer.
The complete ZigBee protocol stack consists of the physical layer, medium access control layer, network layer, security layer, and high-level application specifications, as shown in the figure.
The network layer, security layer, and application programming interfaces of the ZigBee protocol stack are formulated by the ZigBee Alliance. The physical layer and MAC layer are defined by the IEEE 802.15.4 standard. The MAC sub-layer provides an interface to the upper layers, which can connect directly to the network layer or through intermediate sub-layers SSCS and LLC. The ZigBee Alliance has defined the network layer and application layer based on 802.15.4. Among them, the security layer mainly implements functions such as key management and access control. The application programming interface is responsible for providing users with simple application software interfaces (APIs), including Application Sub-layer Support (APS), ZigBee Device Object (ZDO), etc., to manage devices at the application layer.
ZigBee Network Layer Specifications
1. Network Layer Reference Model and Implementation
The network layer mainly implements functions such as node joining, leaving, routing lookup, and data transmission. Currently, the ZigBee network layer mainly supports two routing algorithms: tree routing (Cluster-Tree) and mesh routing. It supports various topologies such as star (Star), tree (Cluster-Tree), and mesh (Mesh), as shown in the figure.
These topologies generally include three types of devices: coordinators, routers, and end nodes.
The coordinator, also known as a full-function device (FFD), is unique and acts as the queen in a bee colony, being the only device that initiates or establishes the ZigBee network. Once the network is established, this coordinator acts like a router, providing data exchange, establishing security mechanisms, and routing functions such as binding within the network. Other operations in the network do not rely on this coordinator because the ZigBee network is distributed. Routers act like drones, are fewer in number, and need to be powered by a mainline. However, in tree topology network models, routers are allowed to operate periodically, so they can be powered by batteries. The functions of routers mainly include joining the network as ordinary devices, implementing multi-hop routing, and assisting other sub-nodes in communication. End nodes, which are the most numerous, are also known as reduced-function devices (RFD) and can only send data to FFD or receive data from FFD. These devices require less memory (especially internal RAM). To maintain the basic operation of the network, end nodes have no designated responsibilities and can sleep or wake up according to their functional needs, generally powered by batteries. Tree routing views the entire network as a tree with the coordinator as the root. Tree routing does not require a routing table, saving storage resources, but has the drawback of being inflexible and wasting a large address space, resulting in low routing efficiency. The routing algorithm for mesh networks is a simplified version of the Ad Hoc On-Demand Distance Vector Routing (AODV) algorithm. In AODV, when a network node wants to establish a connection, it broadcasts a connection establishment request, and other AODV nodes forward this request message and record temporary routes back to the source node. When the node receiving the connection request knows the route to the destination node, it sends this routing information back to the source node along the previously recorded temporary route. The source node and destination node use this route, which has the shortest hops via other nodes, to transmit data. When a link is broken, the routing error is returned to the source node, which then initiates the routing lookup process again. This can be used for larger networks, requiring nodes to maintain a routing table, consuming some storage resources, but often achieving optimal routing efficiency with flexible usage.
In addition to these routing methods, ZigBee can also perform neighbor table routing, which can be seen as a special routing table that only requires one hop to send to the destination node.
2. Overview of Network Layer Specifications
The core part of the ZigBee protocol stack is in the network layer. The network layer is responsible for establishing and maintaining the topology, naming, and binding services, collaboratively completing indispensable tasks such as addressing, routing, data transmission, and security. It supports various topologies such as star (Star), tree (Cluster-Tree), and mesh (Mesh). To meet the requirements of the application layer, the network layer of the ZigBee protocol is divided into network layer data entities (NLDE) and network layer management entities (NLME). NLDE provides data transmission services related to SAP, while NLME provides management services via relevant SAP.
The network layer must functionally support the MAC sub-layer and provide appropriate service interfaces for the application layer. To establish interfaces with the application layer, the network layer is logically divided into two service entities with different functions: the data entity (NLDE) and the management entity (NLME). The data entity provides data management services through the NLDE-SAP service access point connected to it, while the network layer management entity (NLME) provides management services through the NLME-SAP service access point connected to it. NLME uses NLDE to complete some management tasks and maintains a database object known as the Network Information Base (NIB).
NLDE provides the following services:
(1) Generate network layer protocol data units (NPDU).
(2) Provide routing strategies based on topology.
NLME provides the following services:
(1) Configure new devices.
(2) Establish networks.
(3) Join and leave networks.
(4) Addressing.
(5) Neighbor discovery.
(6) Route discovery.
(7) Receive control.
3. Network Layer Service Specifications
The network layer provides two services, which can be accessed through two service access points (SAP). These two services are network layer data services and network layer management services. The former can be accessed through the network layer data entity service access point (NLDE-SAP), while the latter can be accessed through the network layer management service entity service access point (NLME-SAP). Together with MCPS-SAP and MLME-SAP, these two services form the interface between the application layer and MAC sub-layer. In addition to these external interfaces, there is also an interface between NLME and NLDE within the network layer, allowing NLME to access the data services of the network layer.
4. Network Layer Frame Structure
The frame of the network layer consists of the network layer frame header and the network payload. The order of the fields in the frame header is fixed, but other fields may not necessarily be included depending on the specific situation, as shown in the figure.
5. Network Layer Functions
The network layer is responsible for establishing and maintaining network connections, mainly including mechanisms used when devices connect to and disconnect from the network, as well as security mechanisms employed during frame information transmission. Additionally, it includes routing discovery and maintenance and handoff for one-hop neighbor devices. A ZigBee coordinator creates a new network, allocating short addresses for newly joined devices. The network layer also provides some necessary functions to ensure the normal operation of the ZigBee MAC layer and provides appropriate service interfaces for the application layer.
The main functions of the network layer include the following eight aspects:
(1) Generate NPDU from the application layer by adding appropriate protocol headers.
(2) Determine the network topology.
(3) Configure a new device, which can be a network coordinator or a device joining an existing network.
(4) Establish and start a wireless network.
(5) Join or leave the network.
(6) The ZigBee coordinator and router can allocate addresses to devices joining the network.
(7) Discover and record neighbor tables and routing tables.
(8) Control information reception, synchronizing with the MAC sub-layer or directly receiving information.
ZigBee Application Layer Specifications
The ZigBee protocol stack layer structure includes the IEEE 802.15.4 media access control layer (MAC) and physical layer (PHY), as well as the ZigBee network layer. Each layer completes its respective functions by providing specific services. Among them, the ZigBee application layer includes the APS sub-layer, ZDO (including the ZDO management layer), and user-defined application objects. The APS sub-layer’s tasks include maintaining binding tables and message transmission between binding devices. The so-called binding refers to associating two devices based on the services provided by both devices and their needs. The ZDO’s tasks include defining the role of devices in the network, discovering devices in the network, checking which application services they can provide, generating or responding to binding requests, and establishing secure communication among network devices.
The ZigBee application layer consists of three components: Application Support Sub-Layer (APS), Application Framework (AF), and ZigBee Device Object (ZDO). Together, they provide a unified interface for application developers, specifying functions related to applications such as endpoint regulations, binding, service discovery, and device discovery.
1. Application Support Sub-Layer
APS’s main functions include processing protocol data units (APDU), providing data transmission mechanisms between application entities within the same network, offering various services to application objects, and maintaining a database of management objects. APS serves as the interface between the network layer (NWK) and application layer (APL). This interface includes a series of services that can be called by ZDO and user-defined application objects. These services are provided by two entities: the APS data entity (APSDE) accessed through the APSDE service access point (APSDE-SAP), and the APS management entity (APSME) accessed through the APSME service access point (APSME-SAP). APSDE provides data transmission services for transmitting application PDUs between two or more devices in the same network. APSME provides device discovery and device binding services while maintaining a database of management objects, known as the APS Information Base (AIB).
2. Application Framework
In ZigBee applications, the application framework provides two standard service types. One is the Key Value Pair (KVP) service type, and the other is the message (MSG) service type. The KVP service is used to transmit special data defined by specifications. It defines attributes, attribute values, and commands for KVP operations: Set, Get, and Event. Set is used to set an attribute value; Get is used to retrieve an attribute value; Event is used to notify that an attribute has changed. KVP messages are mainly used to transmit simpler variable formats. Since many messages in ZigBee’s application fields are complex and not suitable for KVP format, the ZigBee protocol specification defines the MSG service type. The MSG service does not impose requirements on data formats, making it suitable for any data transmission format. Therefore, it can be used to transmit large message volumes.
The application framework (AF) provides each application object with KVP services and MSG services. The KVP command frame format is shown in the figure. The MSG command frame format is shown in the figure.
3. ZigBee Device Object
ZDO is actually an endpoint that exists between the application layer endpoint and the application support sub-layer, with its main functions concentrated on network management and maintenance. Application layer endpoints can obtain information about the network or other nodes through functions provided by ZDO, including the network topology, network addresses and statuses of other nodes, as well as the types of other nodes and the services they provide. Endpoints are where application objects exist, and ZigBee allows multiple applications to coexist on a single node. ZigBee defines several descriptors to describe devices and the services provided, which can be used to find suitable services or devices.
Additionally, the ZigBee protocol stack also provides security components, such as using AES128 algorithms to encrypt and protect data at the network layer and application layer; establishing the role of a trust center for managing keys and devices, and executing established security policies.
From the above analysis, it can be seen that the ZigBee protocol suite is simple and compact, thus the hardware requirements compatible with it are also relatively simple. An 8-bit microprocessor 80C51 can meet the requirements, and full-function protocol software requires 32KB of ROM, while minimal function protocol software needs about 4KB of ROM. Currently, international giants such as Freescale and Texas Instruments (TI) have launched relatively mature ZigBee development platforms, such as TI’s platform based on the CC2420 transceiver and TI MSP430 ultra-low power microcontroller, and the SOC platform CC2430 of C51RF-3-PK.
The ZigBee device configuration layer provides standard ZigBee configuration services, defining and processing descriptor requests. In the ZigBee device configuration layer, a special software object called the ZigBee Device Object is defined, which provides binding services in other services. Remote devices can request any standard descriptor information through the ZDO interface. When these requests are received, the ZDO will call the configuration object to obtain the corresponding descriptor values. In the current version of the ZigBee protocol, the device configuration layer has not been fully implemented. ZDO is a special application object that is implemented at endpoint (end-point) 0.
ZigBee Security Service Specifications
Communication between ZigBee devices uses the IEEE 802.15.4 wireless standard, which specifies the physical layer (PHY) and medium access control layer (MAC) standards. ZigBee specifies the network layer (NWK) and application layer (APL) standards, with the functions of each layer specified as follows.
PHY: Provides basic physical wireless communication capabilities.
MAC: Provides reliability authorization and one-hop communication connection services between devices.
NWK: Provides routing and multi-hop functions for constructing different network topologies.
APL: Includes an application support sub-layer, ZigBee device object, and applications.
In terms of security service specifications, the protocol stack has security mechanisms at the MAC, NWK, and APS three layers to ensure the secure transmission of data frames at each layer. Meanwhile, APS provides services to establish and maintain secure relationships. ZDO manages security policies and the security structure of devices.
-END-
Authors: Jiang Zhong, Liu Dan
Price: 49.50 Yuan
ISBN: 9787302496465
The main purpose of writing this book is to use the CC2530 chip and Z-Stack protocol stack to implement wireless sensor networks from a practical training perspective, analyzing key points in developing wireless sensor networks using ZigBee technology, explaining how to develop specific wireless sensor network systems from simple to complex.
This book introduces three projects developed with the TI-Stack protocol stack, namely smart home systems; smart greenhouse systems; and student attendance management systems.