ZigBee-based embedded gateway design

introduction

The Internet of Things (IoT) is an information carrier based on the Internet and traditional telecommunication networks, allowing all common physical objects that can be independently addressed to communicate. It has three important characteristics: common object equipment, autonomous terminal interconnection and ubiquitous service intelligence.

With the development of Internet of Things technology, wireless sensor networks based on ZigBee technology have been widely used in people's production and life (such as home automation, smart agriculture, etc.). How to connect the ZigBee network to the Internet is a hot issue that people face when applying ZigBee technology networking.

However, the ZigBee protocol is not compatible with the TCP/IP protocol used in the Internet. To connect a ZigBee network to an IP-based Internet, a device is needed to perform data forwarding between two heterogeneous networks. Therefore, the concept of a gateway is proposed, and the gateway performs data forwarding between two heterogeneous networks. This paper uses PXA270 embedded platform and CC2430 ZigBee module, based on windows CE6.0 embedded operating system and Z-Stack protocol stack, designed an embedded gateway solution. The gateway works between two heterogeneous networks, connected to the wireless sensor network and the Internet. Its functions include data forwarding between heterogeneous networks and management of ZigBee networks.

1 system overall design

The overall design of the gateway is shown in Figure 1. It generally includes the CC2430ZigBee module, the PXA270 embedded platform, the Ethernet port, the power module, and other peripheral modules.

Figure 1: Overall design of the gateway

The software design of the gateway is based on the Windows CE6.0 embedded operating system and the Z-Stack v1.4.3 protocol stack. Windows CE6.0 system is rich in functions and stable in kernel. It is a highly modular system with preemptive multi-tasking scheduling and powerful network communication capabilities. The system supports the Winsock network programming interface, and implements command and data interaction between the gateway and the Internet client through the C/S Socket communication model. The Z-Stack v1.4.3 protocol stack is a complete protocol stack developed by TI to support ZigBee 2006. The protocol stack provides a large number of programming interface functions for development and design based on the protocol stack.

In the design, the CC2430 ZigBee module is connected to the PXA270 embedded platform through the serial port. Both Windows CE and Z-Stack protocol stacks provide support for serial communication. Calling the corresponding serial port API enables read and write operations on the serial port, which facilitates the serial port between the PXA270 embedded platform and the CC2430 ZigBee module. The design of the communication program.

2 design of each module software

2.1 ZigBee Coordinator Module Section

The ZigBee network consists of a coordination node, multiple routing nodes, and multiple terminal nodes. The device type is usually determined by compile time (ZDO COORDINATOR and RTR NWK). In this design, the CC2430 module connected to the PXA270 embedded platform through the serial port serves as the coordination node of the entire ZigBee network, and its main functions are: (1) data transmission and reception. Receive data uploaded by the ZigBee network, parse and forward it to the PXA270 platform through the serial port; forward the data sent by the PXA270 platform to the zigBee network. (2) ZigBee network management. Including network channel and network ID selection, network startup, node joining, etc. The program flow chart of the coordination node is shown in Figure 2.

Figure 2: Program flow chart of the coordination node

When the coordination node communicates with the PXA270 platform, the serial application interface function provided by Z-Stack is used. Among them, HalUARTInit () is used to initialize the serial port when the device starts (such as setting the baud rate is 115200), HalUARTOpen (), HalUART Close () is used to open and close the serial port, HalUARTRead (), HalUARTWrite () is used to complete the serial port Reading and writing.

2. 2 PXA270 embedded platform part

The PXA270 embedded platform acts as the main control module of the gateway. Its functions include: communicating with the ZigBee coordination node, receiving data forwarded by the coordination node through the serial port or sending control commands to the coordination node; through the TCP/IP-based streaming Socket method and IP network Communication, such as uploading data and receiving remote commands. The workflow of the PXA270 platform is shown in Figure 3.

Figure 3: Workflow of the PXA270 platform

In this design, two threads are used to complete the above two aspects, namely the serial communication thread and the Socket communication thread, and the two threads use the mutual exclusion mechanism to achieve mutually exclusive access to the common buffer.

3 test results

Perform ZigBee networking test and system overall test on the design. In the ZigBee networking test, the parameters of the ZigBee protocol stack are configured as default values ​​(MAX DEPTH=5, MAXROUTERS=6, MAX CHILDREN=20), and the address allocation mode selects the distributed allocation mechanism. The ZigBee coordinator is directly connected to the COM1 port of the computer through the serial port, and the ZigBee coordinator sends the node network ID in the ZigBee network to the computer through the serial port, and displays the node information in the ZigBee network through the serial port debugging assistant, and the test result is shown in FIG. 4 Show.

Figure 4: ZigBee networking test results

In the overall system test, the ZigBee coordinator is directly connected to the serial port of the PXA270 embedded platform through the serial port. The ZigBee coordinator sends the node network ID in the ZigBee network to the PXA270 embedded platform through the serial port. The PXA270 embedded platform passes the C/SSocket. The communication model implements command and data interaction between the gateway and the Internet client, and the test results are shown in FIG. 5.

Figure 5: System overall test results

4 Conclusion

Aiming at how to connect ZigBee wireless network to TCP/IP-based Internet, this paper proposes a design scheme of embedded gateway based on WindowsCE embedded operating system and ZigBee protocol stack, which realizes the basic functions of gateway. The data collected by the ZigBee network can be forwarded to the TCP/IP-based network through the gateway, and the ZigBee network can be managed through the gateway, thereby achieving the purpose of interconnecting two heterogeneous networks, and has practical application value.
On April 8th, there was a wireless communication technology seminar to guide the development of the offline, so that the development of technical problems is worry-free ~!

METAL DESIGN - Our metal oil diffuser comes with openwork design and it is a great piece for decoration. They are also small enough to fit anywhere you like, home, office desk, bedroom nightstand, baby's room, bathroom, and yoga studios.

Three IN ONE FUNCTION---metal essential oil diffuser, Cool Mist Humidifier, Night Light. It can help make your environment aromatous and humidify air. Lights can be turned off for aromatherapy.

SUPER QUIET- Adopted ultrasonic technology, this metal diffuser is extremely quiet when working. Metal Aroma Diffuser generate the vapor without any heat, which best preserves the integrity of the Essential Oil .

WATERLESS AUTO SHUT-OFF METAL Oil Diffuser - It will automatically power off when it is detected there is little water. No worry about causing any harm to you or the machine itself.

Metal Diffuser

metal diffuser,metal essential oil diffuser,metal oil diffuser,diffuser metal

Shenzhen Dituo Electronic Co.,Ltd. , https://www.sz-dituo.com