IoT Communication Protocol
-
Cloud Protocol
IoT devices that support TCP/IP can connect to the cloud using HTTP, MQTT, CoAP, LwM2M, and XMPP application layer protocols through Wi-Fi, cellular networks, and Ethernet.
-
Gateway Protocol
The gateway protocol is suitable for short-range communications that cannot connect to the cloud directly, such as Bluetooth, ZigBee, and LoRa. These devices need to connect to a gateway for conversion before accessing the cloud via TCP/IP protocol.
History of ZigBee
The name ZigBee comes from the communication method used by bee swarms to survive and thrive: bees perform a Zig-Zag dance to share information about the location, distance, and direction of newly discovered food sources.
ZigBee originated from the “HomeRFLite” technology initiated in 1998 by industry giants like INTEL and IBM.
In the second half of 2002, four major companies—Invensys from the UK, Mitsubishi Electric from Japan, Motorola from the USA, and Philips Semiconductor from the Netherlands—jointly announced their membership in the “Zigbee Alliance” to develop the next-generation wireless communication standard named “Zigbee”.
ZigBee and IEEE 802.15.4
ZigBee is an open wireless personal area network (WPAN) standard based on the IEEE 802.15.4 protocol.
IEEE 802.15.4 defines the physical layer and media access control layer, while ZigBee defines higher layers such as the network layer and application layer.
Characteristics of ZigBee Technology
Low Power Consumption: Due to ZigBee’s low transmission rate, the transmission power is only 1mW, and it uses sleep mode, resulting in low power consumption. It is estimated that ZigBee devices can operate for 6 months to 2 years on just two AA batteries. Low Cost: The complexity of ZigBee modules is low, ZigBee protocol is free of patent fees, and the frequency bands used do not require payment, making it cost-effective. Short Latency: The communication latency and the latency from sleep mode activation are very short, with a typical search device latency of 30ms, and a sleep activation latency of 15ms, while active device channel access latency is 15ms. Large Network Capacity: A star-structured ZigBee network can accommodate up to 254 slave devices and one master device, with a maximum of 100 ZigBee networks existing simultaneously in one area, and the network composition is flexible. A mesh-structured ZigBee network can have over 65,000 nodes. Reliability: It employs collision avoidance strategies, while also reserving dedicated time slots for communication services requiring fixed bandwidth, avoiding competition and conflict in data transmission. The MAC layer uses a complete acknowledgment data transmission mode, where each sent data packet must wait for acknowledgment from the receiver. If there is an issue during transmission, it can be retransmitted. Security: ZigBee provides a data packet integrity check based on cyclic redundancy check (CRC), supports authentication, and uses AES-128 encryption algorithm; various applications can flexibly determine their security attributes.
Three Types of ZigBee Devices
-
ZigBee Coordinator
Contains all network information and is the most complex of the three device types, with large storage capacity and strong computing power. It is mainly used to send network beacons, establish a network, manage network nodes, store node information, find routing information between pairs of nodes, and continuously receive information. It powers on and configures the network; once the network is established, this coordinator acts like a router node, and each ZigBee network must have one.
-
ZigBee Router
Allows other devices to connect, assists child nodes in communication, and serves as terminal node applications.
-
ZigBee End Device
Transfers data to the routing node, has no routing function, low power consumption (end devices are generally battery powered, and ZigBee’s low power consumption is mainly reflected here), can choose to sleep and wake up.
Three ZigBee Network Topologies
-
Star
The ZigBee star network is the simplest of the three network topologies, consisting of a coordinator and several routers and terminals; in this structure, each subordinate node can only communicate with the central node, and communication between two subordinate nodes must go through the central node for data forwarding, which results in lower efficiency and reliability. The network topology structure is shown in the figure below:

-
Tree
The ZigBee tree network consists of a coordinator, several routers, and terminals; it can be viewed as multiple star structures combined, where each sub-device can only communicate with its parent node, with the highest-level parent node being the coordinator. In the tree network, the coordinator is responsible for building the entire network, and routers act as connection points, expanding the network outward in a tree structure. Nodes communicate with each other through intermediate routers to achieve “multi-hop communication.” Compared to the star network, the tree network significantly improves capacity and robustness. The network topology structure is shown in the figure below:

-
Mesh
The ZigBee mesh network is built upon the ZigBee tree network structure, and in the ZigBee mesh network, in addition to meeting all the functions of the ZigBee tree network, adjacent routers can communicate directly with each other without needing to go through other nodes for data forwarding, making the network’s dynamic distribution more flexible and the routing capability more stable and reliable. This fully leverages the self-organizing advantages of ZigBee networks. The network topology structure is shown in the figure below:

ZigBee Operating Frequency Bands
Since ZigBee is based on the IEEE 802.15.4 standard, its operating frequency bands are the same as those defined by the 802.15.4 standard, including 868MHz (Europe), 915MHz (popular in the USA), and 2.4GHz (popular globally):

ZigBee Protocol Architecture
The architecture of the ZigBee protocol can be divided into four layers:
-
Physical Layer (PHY)
-
Media Access Control Layer (MAC)
-
Network Layer (NWK)
-
Application Layer (APS)
One part is defined by IEEE802.15.4 for the physical layer and MAC layer technical specifications;
the other part consists of the technical specifications defined by the ZigBee Alliance for its network layer protocol and application layer based on IEEE802.15.4;

PHY Layer
-
Activation of ZigBee devices;
-
Energy detection of the current channel;
-
Receiving link quality information;
-
ZigBee channel access methods;
-
Channel frequency selection;
-
Data transmission and reception.
The physical layer defines the interface between the physical wireless channel and the MAC sublayer, providing physical layer data services and physical layer management services. Physical layer data services transmit and receive data from the wireless physical channel. Physical management services maintain a database composed of physical layer-related data.
MAC Layer
-
Network coordinator generates beacons;
-
Synchronizes with the beacons;
-
Supports the establishment and disconnection of PAN (Personal Area Network) links;
-
Provides support for device security;
-
Channel access method uses collision-free carrier sense multiple access (CSMA-CA) mechanism;
-
Handles and maintains the Guaranteed Time Slot (GTS) mechanism;
-
Provides a reliable communication link between two peer MAC entities.
NWK Layer
-
Generates network layer data packets
When the network layer receives a data packet from the application sublayer, it parses the packet, adds the appropriate network layer header, and transmits it to the MAC layer.
-
Routing function of the network topology
The network layer provides the function of routing data packets; if the destination node of the packet is the current node, it sends the packet to the application sublayer. If not, it forwards the packet to the next node in the routing table.
-
Configuring new device parameters
The network layer can configure appropriate protocols, such as establishing a new coordinator and initiating network creation or joining an existing network.
APS Layer
The ZigBee application layer includes the Application Support Sublayer (APS), Application Framework (AF), and ZigBee Device Object (ZDO), which together provide a unified interface for application developers.
-
Application Support Sublayer (APS)
Responsible for providing a data service to applications and ZigBee device specifications. It also provides a management service to maintain binding links and storage of its binding tables. The Application Framework (AF) provides a specification on how to describe a standard on the ZigBee protocol stack and cases. It specifies a series of standard data types, descriptors for service discovery, data frame formats for transmission, etc.
-
ZigBee Device Object (ZDO)
The ZigBee Device Object (ZDO) defines the role of a device in the network (coordinator, router, or end device), initiates or responds to binding and discovery requests, and establishes a security relationship between network devices. It also provides a rich set of management commands defined in the ZigBee device specifications.
ZigBee Protocol Data Frame Structure
As mentioned above, the ZigBee protocol is built on the IEEE 802.15.4 standard, so before understanding the data frame format of the ZigBee protocol, let’s first look at the data frame structure defined by the IEEE 802.15.4 protocol. The following figure shows its data frame structure.

From the IEEE 802.15.4 data frame structure diagram, we can see the composition of various frame structures; the data frame defined by IEEE802.15.4 has two layers, with the MAC layer data frame nested within the PHY layer data field:
SHR (Synchronization Frame Header):
Preamble Sequence (Synchronization Sequence Code)
Start of Frame Delimiter (Frame Delimiter)
PHR (Physical Layer Data Frame Header):
Frame Length
PSDU (Physical Layer Data Field):
MPDU (MAC Layer Data Frame)
MHR:
Frame Control
Data Sequence Number
Address Information
MSDU (Payload):
Data Payload
MFR (Frame Check):
FCS (Frame Tail)
The above is the data frame format defined by IEEE802.15.4 protocol, while the data frame format of ZigBee protocol actually adds NWK and APS data frames on top of the MAC layer data field, and its data frame format structure diagram is as follows:


