1. Introduction
Zigbee® is an IEEE 802.15.4-based communication protocol used to create wireless personal area networks (WPAN). The aim is to provide a simple networking layer and standard application profiles that can be used to create interoperable solutions, with low-power and low-bandwidth constraints.
Zigbee® is used in many application areas:
- Home automation
- Industrial control systems
- Building automation
- Medical data collection and monitoring
- HVAC control
- Wireless sensor networks
The data throughput is 250 kbps in 2.4 GHz band and the typical range is 10-20 meters. 250 kbps is the raw data rate at PHY level. At application level, the data rate is lower due to protocol stack overhead.
2. Zigbee® network
2.1. Topology
Zigbee® supports three types of network topologies, as shown in the figure below.
Zigbee® network topologies |
---|
2.2. Device types
In Zigbee®, there are three logical device types:
- Coordinator (ZC): This is the first node to be started. The coordinator is responsible for forming the network by allowing other nodes to join the network through it. The coordinator is responsible for starting the network and for choosing certain key network parameters. Once the network is established, the coordinator has a routing role. In a centralized network, every Zigbee® mesh network must have one and only one coordinator.
- Router (ZR): This is a node with a routing capability that is also able to send and receive data. It also allows other nodes to join the network. A Zigbee® mesh network can have multiple routers.
- End device (ZED): This is a node that is only capable of sending and receiving data; it has no routing capability. A Zigbee® mesh network can have multiple end devices. End devices can also be sleepy end devices (SED), allowing very-low-power consumption.
The figure below gives an overview of a Zigbee® mesh network with the different device types.
Zigbee® mesh network example with device roles |
---|
2.3. Network types
To satisfy a wide range of applications and ensure an optimal security balance, Zigbee® offers two network types: distributed and centralized.
- In a distributed network, there is no coordinator. In this configuration, any router can issue network security keys. As more routers and end devices join the network, a router that is already on the network securely sends the network key. All devices on the network use the same network key to encrypt messages.
- In a centralized network, there is an entity named Trust Center (TC), which is typically the coordinator. The TC forms a centralized network and allows routers and end devices to join the network if they have proper credentials. In a centralized network, only the TC can issue encryption keys. The TC also establishes a unique TC link key for each device on the network as they join and link keys for each pair of devices as requested.
For obvious reasons, the centralized network is much more secure than the distributed one. Most of the Zigbee® examples provided inside the STM32WB firmware package use a centralized network.
2.4. Network and link keys
Network key:
- Used at the network layer
- Each node requires the network key
- Shared network key among all devices in the network
- The TC generates the network key and distributes it to all nodes on the network.
Link Key:
- Used at APS layer
- Optional
- The TC link key is established between the TC and another node in the network.
2.5. Zigbee® addresses
Each node in a Zigbee® network has both a 16-bit network address and a 64-bit IEEE address.
- 16-bit network address: known as the "short address". This address is used to identify the device and communicate with it on the network. The network address can be changed only in case of an address conflict or when a device leaves and rejoins the network.
- 64-bit IEEE address: known as the "extended address" or the "MAC address". It is a unique 64-bit identifier assigned to the device during its production.
3. Architecture
As described before, Zigbee® is built on the IEEE 802.15.4 standard. Zigbee® provides routing and multi-hop functions to the packet-based radio protocol. It is built on top of two layers specified by 802.15.4: the physical (PHY) and MAC layers. The figure below describes the main components of a Zigbee® stack and its articulation with IEEE 802.15.4 and a general application layer.
Zigbee® stack overview |
---|
3.1. MAC layer
A MAC frame has a 2-byte field for control. Bits 0-2 indicate the frame type, which can be one of the following:
- Beacon frame (000), used to scan networks
- Data frame (001), used to transmit data from higher layers
- Acknowledgment frame (010)
- MAC command (011), such as association request or data request
At the end of each MAC frame, there are two CRC bytes, used to verify the integrity of the packet.
3.2. Network layer
The network layer takes care of the topology construction, maintenance, naming, routing, and security.
The Zigbee® specification defines two device types:
- FFD (full feature device) can accept any role in the network (router, coordinator, or end device).
- RFD (reduced feature device) can support only the end-device role.
3.3. Application layer
The APL layer is composed of several sublayers. The components of the APL layer are shown in the following illustration:
Zigbee® protocol stack |
---|
3.3.1. Application support sublayer (APS)
APS provides an interface between the network layer (NWK) and the application layer through a general set of services that are used by both the ZDO and the manufacturer-defined application objects. The APS is responsible for:
- Binding management
- Message forwarding
- Group address definition and management
- Address mapping from 64-bit extended addresses to 16-bit NWK addresses
- Packet fragmentation and reassembly
- Reliable data transport
3.3.2. Zigbee® device object (ZDO)
The ZDO component handles the device management and communication functions. It includes:
- Initializing the APS sublayer and the NWK layer
- Device discovery
- Service discovery
- Network management, including defining the device operating mode (ZC, ZR, or ZED).
- Security management
- Initiating and/or responding to binding requests
4. Zigbee® profiles
4.1. Zigbee® application profiles
A profile is a message-handling agreement between applications on different devices. It describes the logical components and their interfaces. The aim of profiles is to provide interoperability between different manufactures. There are three types of profiles:
- Public (standard), managed by the CSA
- Private, defined by Zigbee® vendors for restricted use
- Published, which concerns previously private profiles that become published ones the owner profile decides to publish it
The application profile is a collection of devices employed for a specific application. The profile defines the data exchange form for the application functions of a physical Zigbee® device. A profile consists of one or more endpoints, each with one or more associated clusters.
The endpoint numbers that can be used for a Zigbee® application range from 1 to 240.
- The Zigbee® device object (ZDO) is attached to endpoint 0
- Endpoint 255 is used to broadcast to all endpoints
- Endpoints 241-254 are reserved for special functions
Clusters are a group of commands and attributes that define what a device can do. Clusters are managed by the ZCL (ZigBee Cluster Library). Each cluster has two ends: client and server.
Zigbee® application profile organization |
---|
47 supported clusters on the STM32WB are listed in the Getting started with Zigbee® on STM32WB series application note[1].
For specific needs, a customer can create their own proprietary cluster.
4.2. Zigbee® device profiles
The Zigbee® device profile is a collection of device descriptions and clusters run directly by the ZDO. It applies to all Zigbee® devices.
The Zigbee® device profile is a template that shows how to write an application profile. It is defined in the Zigbee® application level specification.
5. Acronyms and definitions
Term | Definition |
---|---|
APS | Application support sublayer |
MAC | Media access control |
PAN | Personal area network |
SED | Sleepy end device |
ZDO | Zigbee® device object |
6. References