Introduction to ZigBee Wireless Communication
ZigBee wireless communication is an emerging short-range, low-rate wireless network technology. As a wireless network technology with short distance, low power consumption and low data transmission rate, zigbee wireless communication is a technical solution between wireless tag technology and Bluetooth.
1. Introduction to ZigBee wireless communication
The name of ZigBee technology mainly comes from people's observation on the honey collection process of bees. During the honey collection process, the dance trajectory of bees is like dancing in the shape of "Z". Due to the small size of bees themselves, the energy required is small, and it can transmit The collected pollen, therefore, people use ZigBee technology to represent the wireless communication technology with low cost, small size, low energy consumption and low transmission rate, the Chinese translation is usually called "ZigBee" technology.
In December 2000, IEEE established the IEEE 802.15.4 working group, dedicated to defining a low-rate wireless connection technology with extremely low complexity, cost and power consumption suitable for fixed, portable or mobile devices - ZigBee technology. In August 2002, the ZigBee Alliance was established by British Invensys, Japan's Mitsubishi Electric, American Motorola, Netherlands Philips Semiconductors and other companies. At present, the alliance has attracted more than 150 chip companies, wireless equipment companies and products. developer.
ZigBee wireless communication is a technology between wireless identification technology and Bluetooth, which is mainly used for short-range wireless connection. It has its own radio standard that coordinates communication among thousands of tiny sensors. These sensors require very little energy to relay data from one sensor to another via radio waves, so the communication between them is very efficient. Finally, the data can go into a computer for analysis or be collected by another wireless technology such as WiMax. The characteristics of lower data rate and smaller communication range of ZigBee technology determine that ZigBee technology is suitable for carrying services with smaller data volume.
2. The working principle of ZigBee wireless communication
ZigBee wireless communication is a group of communication technologies related to networking, security and application software developed based on the IEEE 802.15.4 wireless standard. IEEE 802.15.4 is a standard defined by IEEE for low-speed wireless personal area networks. This standard defines a physical layer (Physical Layer, PHY) and a media access control layer (Media Access Control Layer, MAC). The ZigBee Alliance standardizes its Network Layer protocol and Application Layer. The development and application of the application layer are developed and utilized according to the user's own application needs, so this technology can provide users with a flexible and flexible networking method.
The ZigBee protocol system includes the physical layer, MAC layer defined by the IEEE 802.15.4 standard and the network layer and application layer defined by the ZigBee Alliance.
2.1 Physical layer
The physical layer defines the interface between the physical wireless channel and the MAC layer, and provides physical layer data services and physical layer management services. The physical layer data service is to send and receive data from the wireless physical channel, and the physical layer management service maintains a database composed of physical layer related data. IEEE 802.15.4 defines two physical layers, 2.4 GHz and 868/915 MHz, which are based on the Direct Sequence Spread Spectmm (DSSS) data packet format. There are some differences.
ZigBee physical layer packet structure: the preamble 4B is mainly used for preamble synchronization; the packet delimiter 1B, which marks the start of the packet; the physical layer header 1B, represents the length of the data unit; the data unit is used to carry the transmission data.
2.1.1 2.4 GHz band
This frequency band is a globally unified IsM frequency band that does not require application, which is helpful for the promotion of ZigBee equipment and the reduction of production costs. The physical layer of this frequency band adopts high-order modulation technology and uses pseudo-random code with a chip length of 8 to directly spread the spectrum, which can achieve higher throughput, smaller communication delay and shorter working cycle, thus saving power.
2.1.2 868/915 MHz band
In order to avoid interference, Europe also uses the 868 MHz frequency band, and the United States uses the 915 MHz frequency band as the working frequency of ZigBee wireless communication. Both frequencies are differentially encoded with binary phase shift keying (BPSK) modulation, and are directly spread with M sequences with a chip length of 15. Since the frequency bands are relatively similar, a slight modification to the program of the signal synthesizer allows the use of similar hardware, thereby reducing production costs.
The wireless signal propagation loss in the above-mentioned frequency band is small, which can reduce the requirements on the sensitivity of the receiver, and obtain a longer communication distance, which can cover a larger area with less equipment.
2.2 MAC layer
The IEEE802 series of standards divides the data link layer into two sublayers: logical link control (L09 iocl Link Control, LLC) and media access control (Media Access Control, MAC). Among them, the LLC sublayer is defined in IEEE 802.6 as shared by the IEEE 802 standard series, while the MAC sublayer protocol depends on the respective physical layers.
The MAC layer of IEEE 802.15.4 supports a variety of LLC standards, and carries IEEE 802.2-type LLC standards through the SSCS (Service-Speci6c Convergence Sub-layer) service-related convergence sub-layer protocol, and allows other LLC standards to directly use the IEEE 802.15.4 MAC layer service.
Considering that the design of Zig Bee MAC layer should reduce cost as much as possible, be easy to implement, reliable in data transmission, short-distance operation and low power consumption, a simple and flexible protocol is adopted, and its frame has 4 types: data frame, flag frame , command frame, and confirmation frame.
ZigBee wireless communication adopts carrier sense multiple access/collision (CSMA/CD) channel access method and complete handshake protocol.
2.3 Network layer
The Network Layer (NWK) is a protocol layer between the MAC and the Application Layer (APL). The task of the network layer is to provide an appropriate service interface to the application layer by properly operating the functions provided by the MAC layer. In order to realize the communication with the application layer, the network layer defines two service entities: the data service entity (NLDE) and the management service entity (NLME). The Data Service Entity (NLDE) provides data transmission services through the Data Service Entity Service Access Point (NLDE-SAP); the Management Service Entity (NLME) provides management services through the Management Service Entity Access Point (NLME-SAP).
In the ZigBee protocol, the network layer is mainly responsible for functions such as creating a new network, joining a network, exiting a network, and routing and transmitting network packets.
According to the communication capability of the device, there are mainly two kinds of wireless devices in ZigBee network, namely Full-Function Device (FFD) and Reduced-Function Device (RFD). Both FFDs and between FFDs and RFDs can communicate with each other; but RFDs can only communicate with FFDs, not with other RFDs. RFD is mainly used for simple control applications, the amount of data transmitted is small, and it does not occupy much transmission resources and communication resources. It can adopt a relatively cheap implementation scheme, and is generally used as a communication terminal in the network structure. FFD requires a relatively powerful MCU, which generally has network control and management functions in the network structure.
In the ZigBee network, there is an FFD device called the PAN network coordinator, which is the central node of the network. In addition to directly participating in the application, the PAN network coordinator is also responsible for functions such as identity management of other network members, management of link state information, and packet forwarding.
From the perspective of network topology, ZigBee devices mainly have three roles: network coordinator, network router and network terminal device. Among them, the network coordinator is mainly responsible for the establishment of the network and related configuration of the network; the router is mainly responsible for finding, establishing and repairing the routing information of network packets, and is responsible for forwarding network packets; the network terminal has the function of joining and exiting the network, and can Receive and send network packets, but terminal devices are not allowed to route and forward packets. Usually coordinator and router nodes are generally composed of FFD functional devices, and terminal devices are composed of RFD devices.
ZigBee wireless communication supports three network topologies of communication devices, namely Star network, Mesh network and Cluster Tree network.
Star network is a kind of network commonly used and suitable for long-term operation; Mesh network is a high-reliability detection network, which can provide multiple data communication channels through wireless network connection, that is, it is a high-level redundancy In the network, once the device data communication fails, there will be another path for data communication; the Cluster Tree network is a hybrid topology structure of Star/Mesh, which combines the advantages of the above two topology structures.
2.4 Application layer
The application layer provides advanced protocol management functions. The application layer protocol is used to manage the protocol stack. It is mainly developed by the user according to the specific application. communication between them.
In wireless communication technology, ZigBee wireless communication adopts the collision-free multi-carrier channel access (CSMA-CA) method, which effectively avoids the conflict between radio carriers. In addition, in order to ensure the reliability of transmission data, a complete response communication protocol is established.
3. Zigbee networking - detailed explanation of three zigbee network architectures
It is widely used in sensor networks and other fields, thanks to its powerful It can form three types of zigbee networks: star, tree and mesh networks. The appropriate zigbee network structure can be selected according to the actual project needs. The three zigbee network structures have their own advantages.
3.1 Star topology
Star topology is the simplest form of topology, which includes a Co-ordinator (coordinator) node and a series of End Device (terminal) nodes. Each End Device node can only communicate with the Co-ordinator node. If it is necessary to communicate between two End Device nodes, the information must be forwarded through the Co-ordinator node.
The disadvantage of this form of topology is that there is only one path for data routing between nodes. Co-ordinator (coordinator) may become the bottleneck of the entire network. It is not necessary to use the network layer protocol of zigbee wireless communication to realize the star network topology, because the protocol layer of IEEE 802.15.4 has already implemented the star topology, but this requires developers to do more work at the application layer, including processing information by themselves 's forwarding.
3.2 Tree topology
The tree topology includes a Co-ordinator (coordinator) and a series of Router (router) and End Device (terminal) nodes. The co-ordinator connects a series of Routers and End Devices, and the routers of its child nodes can also connect a series of Routers and End Devices. This can repeat multiple levels.
have to be aware of is:
Co-ordinator and Router nodes can contain their own child nodes. End Device cannot have its own child nodes.
Nodes with the same parent are called siblings
Nodes with the same grandparent are called cousins
Communication rules in tree topology:
Each node can only communicate with its parent and child nodes. If data needs to be sent from one node to another, the information is passed up the tree path to the nearest ancestor and then down to the target node. The disadvantage of this topology is that there is only one routing channel for information. In addition, the routing of information is handled by the protocol stack layer, and the entire routing process is completely transparent to the application layer.
3.3 Mesh topology
Mesh topology (mesh topology) includes a co-ordinator and a series of routers and end devices. This form of network topology is the same as the tree topology; please refer to the tree network topology mentioned above. However, the mesh network topology has more flexible information routing rules, where possible, direct communication between routing nodes. This routing mechanism makes the communication of information more efficient, and means that once a routing path fails, information can be automatically transmitted along other routing paths.
Usually in the implementation of supporting mesh network, the network layer will provide the corresponding route exploration function, this feature enables the network layer to find the optimal path for information transmission. It should be noted that the above-mentioned features are implemented by the network layer, and the application layer does not need any participation. The network of mesh network topology has powerful functions, and the network can communicate through "multi-level hops"; the topology can also form a very complex network; the network also has self-organization and self-healing functions; star and family The tree network is suitable for applications with many points and relatively close distances.
The above is a detailed explanation of the three zigbee network architectures. Zigbee wireless communication technology has been widely used in the M2M industry in the IoT industry chain, such as smart grid, smart transportation, smart home, finance, mobile POS terminals, supply chain automation, industrial automation, and smart buildings. , fire protection, public safety, environmental protection, meteorology, digital medical care, telemetry, agriculture, forestry, water affairs, coal mines, petrochemicals and other fields.