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.

In terms of security, ZigBee adopts the security model of the IEEE 802.15.4 media access control sub-layer, which regulates four aspects of security services, namely access control, data encryption, frame integrity check and the use of sequential update values ​​to prevent frame replay.
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.
The EM250 can enter three different states: working state, standby state and deep sleep state. Program code can be executed in the working state, and the typical current is 8.5mA. In the standby state, the processor is no longer working, but the interrupt is allowed to wake up, and the peripheral devices and RF transceivers work normally. In the deep sleep state, both the processor and the RF transceiver stop working until an external interrupt or timed interrupt wakes up, and the typical current is only 1.5μA. Deep-sleep states are not suitable for fully functional devices, but are essential for reducing power consumption in simplified functional devices.
EM250 has 4 channels of analog signal conversion, and two channels can be used as analog signal capture for data conversion unit. The digital interrupt can receive one-bit digital data in sleep or standby state. Its Universal Synchronous and Asynchronous Serial Receiver and Transponder modules can be configured as Universal Asynchronous Receiver/Transmitter or Serial Peripheral Interface SPI and I2C bus interfaces.
The integrated RF transceiver of the EM250 supports four power working modes, namely burst mode, high power mode, normal mode and minimum power mode. According to the device type and the distance between adjacent nodes, power management can be used to reasonably set the working mode.
Hardware composition and design

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.
ZigBee Wireless Sensor Network Solution Based on EM250
Peripheral components include: RF unbalanced to balanced converter (RF BALUN 50/200Ω), harmonic filter, oscillator composed of crystal oscillator and load capacitor, power supply decoupling capacitor circuit, power board RC filter, pull-up and pull-down resistors , RC filtering of asynchronous reset signal, external 50Ω unbalanced antenna at the output end of harmonic filtering, etc.
The network node adopts the USB to UART chip FT232R of Future Technology Equipment Company as the communication interface with the PC. FT232R can complete the conversion from USB protocol to RS232 serial communication protocol without programming. The FT232R driver can support the establishment of a virtual communication port (VPC) on the PC side, and the VPC driver will complete the automatic conversion of USB signals and RS232 signals. The power supply of the system can be provided by a 3-3.3V DC source or by a USB interface 5V power supply converted to a 3.3V power supply by the FT232R, and the 3-3.3V DC source can be a battery or an AC/DC converter. The two power sources can be selected by jumpers.
System software design

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.
ZigBee Wireless Sensor Network Solution Based on EM250
The router in the ZigBee network is a full-featured device. It completes the routing of data between nodes such as various full-featured devices, simplified functional devices, and coordinators. It is necessary to build a ZigBee network with a network structure. Like the coordinator, the full-featured device also maintains It keeps track of the relevant information table of the nodes in the network, and because it must continuously monitor routing messages, it cannot enter the “sleep” mode. The software function module design of the full-function device is shown in Figure 4.
ZigBee Wireless Sensor Network Solution Based on EM250
The simplified function device is the end device of the ZigBee network. It can communicate with the coordinator and router, but cannot act as an intermediate router. The RFD can enter the sleep mode to reduce power consumption and greatly prolong the power usage time.

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 Solution Based on EM250
The management of each node can be done by dialing a hyperterminal to a connected single node or using a unified centralized network management interface. The centralized network management interface is installed on the PC connected to the coordinator, and is used for users to interact with the ZigBee network. The main functions include network topology Display, node status Display, node data, alarm information, and network logs.
summary
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

Design of Multi-axis Ultrasonic Testing System Based on Hybrid Control System In-depth article analyzes the “invisible hand” in the Internet of Things