ZigBee Wireless Sensor Network Solution Based on EM250
This article introduces the ZigBee” title=”ZigBee”>ZigBee protocol framework, the functions of each layer and the composition of the ZigBee wireless network, and describes the wireless sensor network based on Ember’s EM250″ title=”EM250″>EM250 SoC” title= “Wireless Sensor Network” > Wireless Sensor Network Solution, the hardware and software composition and design of the system are carefully explained.
ZigBee Protocol Framework
ZigBee protocol is a low-cost, low-power, low-speed networking solution for embedded devices to communicate with each other and with external networks. It is the ZigBee Alliance based on the IEEE 802.15. A technical standard for wireless local area network networking, security and application software developed by standardizing network layer protocols and APIs.
The ZigBee protocol stack structure is shown in Figure 1.
The ZigBee protocol physical layer and media access control layer adopts the IEEE 802.15.4 2003 protocol specification. The physical layer wireless frequency band is universal in the world. 2.4GHZ, 868MHz for Europe, 915MHz for the United States, using direct sequence spread spectrum technology, providing 27 channels, 20Kb/s, 40Kb/s, 250Kb/s three data rates for data transmission and reception The physical layer function includes activation and sleep radio frequency transceiver, channel energy detection, link quality indication of channel received data packets, idle channel estimation, sending and receiving data, etc.
The MAC layer of ZigBee is responsible for the establishment, maintenance and termination of wireless data links between devices, data transmission and reception in acknowledgement mode, and carrier sense multiple access/collision avoidance access mode. The maximum length of the data packet is 127 bytes. Each data packet consists of a header byte and a 16-bit CRC check value.
The network layer is the core part of the ZigBee protocol stack, which implements functions such as node access or departure from the network, route search and data transmission, etc. It supports three topology structures of star, tree and network. The network topology structure selects nodes according to specific ZigBee applications. According to the function, it is divided into full function device (FFD), reduced function device (RFD), coordinator (ZCRD) and router. Coordinator and router are usually full function devices.
The application layer of ZigBee includes the Application Support Sublayer (APS), ZigBee Device Object (ZDO) and the application object formulated by the manufacturer. The Application Support Sublayer is responsible for maintaining the binding table and passing information between the two binding entities according to services and requirements. ZDO is responsible for defining the role of device nodes in the network, discovering network devices, deciding what application services to provide, initializing or responding to binding requests, and establishing security relationships between network devices.
The ZigBee network adopts multi-point access, and there are two types of beacon-enabled networks, beacon-enabled network or non-beacon-enabled network, the coordinator periodically sends beacon frames in predefined time slots for node association, Join the network and transmit data synchronously In a network without beacons, the coordinator also periodically sends signals, but this is only used for terminal devices and to detect the presence of the coordinator. The device must be ready for point-to-point communication at any time, by sending data requests communicate with the response.
ZigBee supports two types of data formats: KVP key value pairs and MSG message frames. Generally, the KVP frame adopts the command response mechanism to transmit a simple attribute variable value; while the MSG frame does not have a specific format specification, it is usually used for the transmission of multiple information and complex information, it supports binary data transmission, and the data size is limited by Supported frame size limit.
ZigBee single chip solution – EM250
EM250 is a ZigBee system-on-a-chip launched by Ember. It integrates a 2.4GHz RF transceiver that conforms to the IEEE 802.15.4 standard and a powerful high-speed 16-bit microprocessor. It supports network-level debugging, and the software development of the system is easy. . The main frequency of the microprocessor is 12MHz, which meets the requirements of coordinator, full-function equipment or simplified function equipment.
EM250 integrates MCU, radio frequency transceiver, memory and communication ports, and only requires few peripheral components to form ZigBee network node hardware, as a full-function device, simplified function device and coordinator. The reference design function module is shown in Figure 2.

A ZigBee can only have a single coordinator. Its main function is to initialize and maintain the entire ZigBee network. It maintains a list of all directly connected nodes and nodes that are not directly connected but allowed to join the network. Devices that join this ZigBee network must Approved by the coordinator. The coordinator needs to continuously monitor the requests and messages of other nodes joining or exiting the network, and needs to enter the receiving state when no messages are sent, so the coordinator cannot enter the “sleep” mode. The typical coordinator software function module design is shown in Figure 3.


When a simplified function device enters sleep mode, the neighboring coordinator or router caches the data that sent it. When coming out of sleep mode, it asks the neighboring coordinator or router if it has data sent to it, and the neighboring coordinator or router returns a response if it has its packets. A reduced-function device can re-enter sleep mode after processing the data sent to it. The software function module design of the simplified function device is shown in Figure 5.

ZigBee wireless sensor network has a wide range of application prospects, and has been paid more and more attention by the industry and has gradually begun to be widely used. The ZigBee wireless sensor network based on EM250 is easy and convenient to implement. At the same time, using Ember’s InSight integrated development environment, the system can be developed, debugged, and compiled quickly, which has strong practical application value.
The Links: SKIM304GD12T4D PM450CS1H060