Research and experiment of ZigBee wireless sensor network

introduction

Someone translated Zigbee into "Zibe", one of the standards for Wireless Personal Area Networks (WPAN), was released on June 27, 2005. In addition to the Logical Link Control (LL) layer, the Medium Access Control Layer (MAC), and the physical layer using the IEEE 802.15.4 standard published in October 2003, the Zigbee standard protocol defines the application layer and the network layer. , and MAC, application layer and network layer security encryption service standards.

Wireless applications such as sensors and self-organizing networks do not require high transmission bandwidth, but require lower transmission delays and extremely low power consumption, enabling users to have longer battery life and more devices. Array. There is an urgent need for a dedicated standard that is compliant with sensors and low-end, control-oriented, and simple to apply, and the emergence of Zigbee solves this problem. Zigbee has many advantages such as high communication efficiency, low complexity, low power consumption, low speed, low cost, high security and full digitalization. These advantages make Zigbee and wireless sensor networks a perfect fit. At present, the research and development of wireless sensor networks based on Zigbee technology has received more and more attention.

1Zigbee protocol terminology

Profile: The Zigbee protocol configuration file is a description of the logical components and their associated interfaces. It is a convention and guidelines for an application category. Usually no program code is associated with the configuration file.

Attribute: Each type of data communicated between devices, such as the state of a switch or the value of a thermometer, can be called an attribute. Each attribute gets a unique ID value.

Cluster: A collection of multiple attributes forms a cluster, and each cluster also has a unique ID. Although the information transmitted between individuals is usually attribute information, the interface of the so-called logical component refers to the operation at the cluster level, not the attribute level.

Endpoint: Each code function block that supports one or more clusters is called a terminal. Different devices communicate through their terminals and supported clusters.

The configuration file defines the attribute ID and cluster ID to make it look like a certain feature of the device. Taking the home intelligent control system as an example, the lamp configuration file sets the cluster OnOffDRC of the remote control device to contain an attribute OnOff, and the attribute is an unsigned 8-bit value, the value 0XFF means "on", 0X00 is off, 0XF0 Invalid. Typically, configuration files are also defined for devices, which clusters are mandatory and which are optional. In addition, the configuration file also defines some optional Zigbee protocol hosting services.

Based on the services defined by the cluster and configuration, the user can write the required functions using the properties defined in the configuration file. Rewrite your own program code. Therefore, the configuration file makes Zigbee devices interoperable. Any node that follows a standard profile can interoperate with other nodes that implement the same profile. That is to say, on the basis of the design using the same standard configuration file, even if the manufacturer of the production switch is different from the manufacturer of the production controller, the products they produce can still achieve coordinated operation.

Taking the lighting control in the home intelligent system as an example, the light profile defines six devices, and the protocol stack supports this configuration through a header file with the following information: profile ID, device ID and version, cluster ID, Attribute ID, attribute data type.

The following figure (1) shows the relationship between different terms. For the lighting configuration of the home intelligent control system, two devices are shown in the figure. Each device has a terminal. There is only one input cluster in the terminal of the load switching controller, and the remote switching control terminal has two clusters, and one input and one output respectively. The transmission of data is based on clusters.

figure 1)

2 Zigbee protocol stack structure

As shown in Figure (2), the different layers of the Zigbee stack communicate with the 802.15.4 MAC through the Service Access Point (SAP). SAP is the interface between the services provided by a particular layer and the upper layer. Most layers of the Zigbee stack have two interfaces: the data entity interface and the management entity interface. The goal of the Data Entity Interface is to provide the required regular data services to the upper layers. The goal of the managed entity interface is to provide services to the internal layer that access internal layer parameters, configuration, and management data. In the figure, APSDE-SAP, NLDE-SAP is the data entity interface, and APSME-SAP, NLME-SAP is the management entity interface.

figure 2)

3 Zigbee protocol message format and frame format

3.1 Message format

A Zigbee message consists of 127 bytes, which mainly includes the following parts:

MAC header: This header contains the source and destination addresses of the currently transmitted message. If the message is routed, the address may not be the actual address, and the generation and use of the header is transparent to the application code.

NWK header: This header contains the actual source address of the message and the final destination address. The generation and use of this header is transparent to the application code.

APS header: This header contains the configuration ID, cluster ID and destination terminal of the current message. Similarly, the generation and use of the header is transparent.

Payload: This field contains the Zigbee protocol frame to be processed by the application layer.

3.2 Zigbee protocol frame format

The Zigbee protocol defines two frame formats: KVP key value pairs and MSG message frames.

KVP: is a special data transmission mechanism defined by the Zigbee specification. It standardizes the data transmission format and content through a specification, and is mainly used to transmit a simple variable value format.

MSG: is a special data transmission mechanism defined by the Zigbee specification. It is not specified in the data transmission format and content, and is mainly used for a transmission mechanism with a large amount of data such as a dedicated data stream or file data.

KVP frames are dedicated and relatively standardized information formats, in the form of key-value pairs, in a specified format for data transmission. Usually used to transmit a simple attribute variable value; MSG frames do not yet have a specific format specification, usually used for the transmission of multiple information and complex information. KVP and MSG are two data formats in communication. If the frame is compared to a mail, then the envelope, stamp, address person name and other information are the frame header and the end of the frame, and the contents of the letter are the specific data format KVP or MSG. According to the profile of the specific application, KVP is generally used for simple attribute data, and MSG is used for more complicated information with large amount of data.

4 addressing

4.1 Two types of addresses in the Zigbee protocol

Each node of the Zigbee network protocol has two addresses: a 64-bit IEEE MAC address and a 16-bit network address.

Each device that communicates using the Zigbee protocol has a globally unique 64-bit MAC address consisting of a 24-bit OUI and a 40-bit vendor-assigned address. The OUI can be assigned by the IEEE through purchase, since all OUIs are specified by the IEEE. Therefore, the 64-bit IEEE MAC address is globally unique.

When devices perform network join operations, they communicate using their own extended address. After successfully joining the Zigbee network, the network will assign a 16-bit network address to the device. This allows the device to use this address to communicate with other devices on the network.

4.2 Addressing mode

Unicast: When a message is unicast, the MAC header of the packet should contain the address of the destination node. Only when the address of the receiving device is known, the message can be sent in unicast mode.

Broadcast: To send a message by broadcast, the destination address field in the packet MAC header should be set to 0XFF. At this time, all the radio transceivers can receive the information.

This addressing mode can be used to join a network, find routes, and perform other lookup functions of the Zigbee protocol. The Zigbee protocol implements a passive response mode for broadcast packets. That is, when a device generates or forwards a broadcast packet, it will listen to the forwarding of all neighbors. If all neighbors do not replicate the packet within the response time limit, the device will repeatedly forward the packet until it hears that the packet has been forwarded by all neighbors, or the broadcast transmission time is exhausted.

5 data transmission mechanism

For a non-beacon network, when a device wants to send a data frame, it waits for the channel to be idle until the device detects that the channel is empty and the device transmits the frame.

If the destination device is an FFD full-featured device, its receiver should remain on at all times so that other devices can transmit data to it at any time. However, if the device is an RFD reduced function device, the device will turn off the transceiver to save energy when there is no operation. At this point, the RFD device cannot receive any data. Therefore, other devices can only request or send data to the RFD device through the FFD parent of the RFD. Until the RFD powers up the RX transceiver, it will request its own information data from the parents. If there is information sent to the child in the parent buffer, the information will be sent to the child device. This mode of operation reduces the power consumption of the RFD, but the corresponding parent FFD node should have enough RAM space to buffer the information for the child device. If the child's device does not request information within the specified time, the information will be lost.

6 Zigbee wireless network formation

First, a new Zigbee network is built by the Zigbee Coordinator. Initially, the Zigbee Coordinator will search for other Zigbee Coordinators in the allowed channels. And based on the channel energy and network number detected in each allowed channel, select a unique 16-bit PAN ID to establish your own network. Once a new network is established, Zigbee routers and end devices can join the network.

After the network is formed, network overlap and PAN ID conflict may occur. The coordinator can initialize the PAN ID conflict resolution procedure, change the PAN ID and channel of a coordinator, and modify all of its child devices accordingly. Typically, Zigbee devices store other node information in the network in a non-volatile storage-neighbor table. After power-on, if the child's device has joined the network, the device will perform an orphan notification program to lock the previously joined network. The device receiving the orphan notification checks its neighbor list and determines if the device is its child. If so, the device notifies the child of its location on the network, otherwise the child device will join the network as a new device. The child device will then generate a potential parent table and try to join the existing network at the appropriate depth.

In general, the time taken by the device to detect channel energy and the network available for each channel can be determined by ScanDuraTIon scanning continuous parameters. It takes 1 minute for a typical device to perform a scan request. For Zigbee routers and terminal devices, You only need to perform a scan to determine the network you are joining. The coordinator needs to scan twice, once to sample the channel energy, and the other to determine

All In One Solar Street Light

All In One Solar Street Light,High Quality All In One Solar Street Light,All In One Solar Street Light Details, CN

ZHONGSHAN G-LIGHTS LIGHTING CO., LTD. , https://www.glightsled.com