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. Type of devices
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 which is also able to send and receive data. It also allows other nodes to join the network through it. A Zigbee® mesh network can have multiple routers.
- End Device (ZED): This is a node which is only capable of sending and receiving data. It has no routing capability. A Zigbee mesh network can have multiple end devices. End device can also be sleepy end device (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. Type of network
To satisfy a wide range of applications and to ensure the optimal balance of security, Zigbee offers two types of networks: 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 are using a centralized network.
2.4. Network and link keys
Network key:
- Is used at the network layer.
- each node requires the network key
- is a shared network key among all devices in the network
- the TC generates the network key and distributes it to all the nodes on the network.
Link Key:
- Is used at APS layer.
- Is optional.
- The Trust Center (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 at the time of manufacture.
3. Architecture
As described before, Zigbee is built on top of 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 describes the main components of a Zigbee stack and its articulation with IEEE 802.15.4 and general application layer.
Zigbee stack overview |
---|
3.1. MAC Layer
In MAC frame there is 2-byte field for control. Bits 0-2 indicate the frame type, which can be one of the four following types:
- 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, data request
At the end of each MAC frame, there are two bytes CRC 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.
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 end device role.
3.3. Application layer
The APL layer is composed of several sublayers. The components of the APL layer are shown in 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 NWR addresses
- fragmentation and reassembly of packets
- 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 operating mode of the device (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, this concerns previously private profiles that become published ones the owner profile decide 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 Zigbee physical device. A profile consists of one or more endpoints, each with one or more clusters associated.
Endpoint number that can be used for a Zigbee application is comprised between 1 and 240.
- 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 2 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 may create its 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