- Home >> Technical Service >> Bluetooth
ZigBee wireless technology
1. Brief introduction of ZigBee technology
Many scenarios in the home and industry require extensive use of wireless control and monitoring, and these requirements often require low data transfer rates, long battery life, and low complexity of use. In order to meet these requirements, IEEE proposed a wireless standard IEEE802.15.4, which is also called ZigBee. ZigBee is a wireless communication protocol for short distances and low data rates. It has three operating frequency bands, and the 2.4GHz frequency band is mainly used in China. ZigBee has the following characteristics: (1) low power consumption; (2) providing a complete wireless mesh network; (3) a single network can connect up to more than 65,000 devices; (4) easy to deploy; (5) economical, price Inexpensive; (6) Uses smaller data packets than other wireless technologies.
2.ZigBee network topology
The ZigBee standard specifies two types of devices: thin and full-featured. The former has limited functions, while the latter has all functions, and the latter can also be configured as an arbitrary function device. A reduced-function device can only communicate with a full-function device on the network, while a full-function device can communicate with any device. Reduced-function devices are used to perform relatively simple tasks, such as switches that turn functions on or off. Reduced-function devices generally have less memory size and processing power than full-featured devices.
The ZigBee standard stipulates that there are three functional devices in the ZigBee network: a router, a coordinator and a terminal device. As the core device in the network, the coordinator is a full-featured device that forms the root of the network through which it can connect to other networks. There is only one coordinator in each ZigBee network. ZigBee networks are initially created by the coordinator, which stores information about the network and acts as a repository for security keys. Routers route data from other devices in a ZigBee network. Routing is the processing of the path along which data is forwarded to a destination device. ZigBee end-devices can connect with a coordinator or router to join the network, but cannot relay data. This feature allows end-device nodes to be inactive most of the time, thereby extending battery life.
A ZigBee network composed of devices with different functions can have three topologies: star, tree and mesh, among which tree and mesh networks belong to peer-to-peer networks.
In a tree network, the coordinator acts as the root of the tree, routers or end devices can connect to the coordinator, and it can be expanded like a tree. End devices cannot have child nodes because they cannot relay information. This topology allows multiple levels of nodes in the network, and terminal devices can directly join the network through routers without relying on the coordinator, and all messages can be sent to any other device through routing. This type of topology is the most reliable one for ZigBee devices to communicate with other devices on the network.
The star network takes the coordinator as the center, and multiple terminal devices are directly connected to the coordinator, which is the simplest network. When using this structure, the terminal device can only communicate directly with the coordinator, and the communication between two terminal devices requires the coordinator to forward messages, and the coordinator acts as a router. Therefore, the data flow through the coordinator in the star network is relatively large, and the more network nodes, the lower the communication efficiency of the entire network.
Figure 3-1 Three topological structures of ZigBee network
Mesh topology is the most flexible and widely applicable topology. In a mesh network, it allows the network to search for alternate paths for messages, where there are multiple paths a message can take from its origin to its destination. Therefore, message delivery is very reliable and has low latency in a mesh network.
No matter which structure is used, the ZigBee network is created by the only PAN (PersonalAreaNetwork, personal area network) coordinator. The coordinator manages the entire network and is responsible for the following tasks: (1) start, terminate, or route messages across the network; (2) assign 16-bit or 64-bit network addresses to devices that later join the network; (3) generate the network Corresponding PAN identifier (PANID), each PANID corresponds to a different ZigBee network, PANID allows devices in the network to use 16-bit short addresses to communicate with other devices in the entire network. The PAN coordinator generally has a long active period, so it is usually powered by a mains power supply, and other devices are usually powered by batteries. The smallest ZigBee network contains only one end device and one PAN coordinator.
3. ZigBee protocol stack
As can be seen from Figure 3-2, the structure of the ZigBee protocol stack has four layers, of which the physical layer and media access control layer are defined by the IEEE802.15.4 standard, and the network layer and application layer are defined by the ZigBee Alliance.
3.1 Application layer
The APL layer of ZigBee consists of three parts: Application Support Sublayer (APS), Application Framework (AF) and ZigBee Device Object (ZDO). APS provides the interface between the network layer and the application layer, and its main functions are: (1) maintaining the binding table; (2) transmitting messages between the binding devices; (3) managing group addresses. AF is an environment that hosts application objects to control and manage the application layer. The application object is developed by the manufacturer, which can customize the application for the device, and has a uniquely identified endpoint number (endpoint 1 to endpoint 240). A single device can have up to 240 application objects. The ZigBee device object is the interface between APS and AF. ZDO is responsible for initializing APS, network layer and security service specifications. Its main functions are: (1) Define the role of the device in the network: coordinator, router or terminal device; (2) Discover devices and applications on the network, start or bind them accordingly (3) Perform relevant security tasks.
3.2 Network layer
The network layer is responsible for managing the formation, joining, leaving and routing maintenance of the network. The network layer also supports management services and data services. The data is transmitted by the corresponding data entity and can be accessed through the network layer data entity service access point. The management service is in charge of the corresponding management entity, which can provide network layer management service for the application layer through the management entity service access point of this layer.
The network layer of the coordinator creates a ZigBee network and assigns network addresses to devices that join the network afterwards. The distance (hops) of each frame of data transmitted in the network is specified by the network layer. The coordinator can enable security functions at the network layer - using a 128-bit AES encryption key to encrypt network data, new devices that join the network created by the coordinator can communicate with other devices on the network only after the key is distributed communication.
In general, the network layer is responsible for the following functions: (1) joining or leaving the network; (2) providing AES encryption; (3) discovering and maintaining routes between devices; (4) routing functions, except for terminal devices; (5) ) Configure the device as a device with different functions: coordinator, router or terminal device; (6) discover neighbors who can communicate without routing and maintain the neighbor table; (7) assign addresses to new devices that join the network, only applicable to Coordinator and router.
3.3 MAC layer
In the MAC layer, the MAC management object is responsible for the MAC layer management service, and the MAC layer provides a service interface to the network layer through the MAC management object access point. The MAC layer specifies four types of frames: MAC command frames, response frames, data frames, and beacon frames. Wherein, the beacon frame is a beacon sent by the coordinator, and is used to synchronize all devices in the same network to the beacon. The data frame is used to send valid data, the response frame is used to confirm the receipt of the data frame, and the MAC command frame is dedicated to sending MAC commands.
The MAC layer uses a special channel access mechanism to support multiple devices using the same channel to communicate with each other, that is, carrier sense multiple access with collision avoidance (CSMA-CA). In CSMA-CA, a device listens on a channel to ensure that the channel is free before sending a message. If the channel is occupied, it cancels the transmission and retries after a random amount of time until the maximum number of retries is reached or the channel becomes idle.
The main functions of the MAC layer are: (1) Provide security functions of this layer; (2) Manage channel access; (3) Use CSMA-CA channel access; (4) Synchronize the device with the beacon (in the network using the beacon); ( 5) Generate beacons (coordinator only); (6) Provide disassociation and association functions in the network; (7) Establish reliable links between peer devices.
3.4 Physical layer
The physical layer is the lowest layer of the protocol stack, which is closest to the hardware. The main functions of the physical layer include: directly transmitting data; selecting a communication channel; listening to the channel to determine whether it is idle; detecting signal energy; controlling the switch of the wireless transceiver; detecting link quality; data modulation and resolution Tune. The physical layer also provides management services and data services. The management service is to manage the relevant data of this layer through the database; the data service is to encapsulate and send data packets or receive and analyze data packets when communicating with other ZigBee devices.
4. ZigBee data transmission method
ZigBee equipment can use the channel in two ways: contention or no contention. In the competition mode, all devices in the network use the CSMA-CA mechanism to send messages, and the first to find an idle channel transmits data first. In the non-contention mode, the PAN coordinator allocates time for other devices to send messages, that is, guaranteed time slots. The device does not need to listen to the idle state of the channel to send data during the guaranteed time slot. The coordinator keeps devices in the network synchronized through beacons, providing guaranteed time slots. There are three ways of data transmission in IEEE802.15.4: (1) from peer device to peer device; (2) from device to coordinator; (3) from coordinator to device.
4.1 Data transfer between peer devices
In a peer-to-peer network all devices are usually synchronized and any device can communicate with each other. In a mesh network, there are multiple optional routes for data from the sender to the receiver. If the original route cannot be used due to environmental changes, the devices in the network cooperate to find an alternative route. This ability to dynamically create and modify routes increases the reliability of data transfers.
4.2 Data is sent to the coordinator
In a beacon-enabled network, devices periodically synchronize their clocks via beacons. If it is not in the guaranteed time slot, the device uses the CSMA-CA method to send data to the coordinator. The timing diagram is shown in Figure 3-3(a). Figure 3-3(b) shows the process of data being sent to the coordinator in a network without beacons enabled, and the device will send data as soon as it detects that the channel is free. Only when the device needs it, the coordinator will reply with an acknowledgment message to indicate receipt of the data.
4.3 Send data from the coordinator
Figure 3-4(a) illustrates the process of sending data from a coordinator to a receiving device in a beacon-enabled network. First, the coordinator will remind the receiving device that there is data to be transmitted in the beacon. After receiving the beacon, the receiving device sends a data request to the coordinator, indicating that it is ready to receive data. After receiving the data request message, the coordinator replies with an acknowledgment and sends the data to the target device. When the receiving device receives the data, it replies with an acknowledgment as needed.
In a network that does not support beacons, the coordinator will cache data and wait for the receiving device to actively request data. If the coordinator has no data cache, it sends a data message with a specially formatted acknowledgment reply or a zero-length payload, indicating that there is no data to send.
The above are the details of ZigBee wireless communication technology introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. for you. If you have Bluetooth product design and development needs, you can trust us. We have rich experience in custom development of smart electronic products. We can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are a number of chip agents at home and abroad: Songhan, Yingguang, Jieli, Ankai, Quanzhi, realtek, with MCU, voice IC, BLE Bluetooth IC, dual-mode Bluetooth module, wifi module. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the research and development of electronic education products.
- TOP