Indoor environment online monitoring-based on ZigBee network

. An online environmental monitoring system based on ZigBee wireless sensor network is designed to overcome the drawbacks of the traditional indoor environment monitoring system, such as the difficulty of wiring and the poor flexibility. The ZigBee communication technology, web server technology and GSM communication technology are synthesized, and the indoor temperature and humidity, carbon monoxide, formaldehyde concentration and other environmental information are collected and monitored in real time by various supporting sensors. Users can complete local and remote real-time monitoring of indoor environment by opening Web pages. When a fire or gas leak occurs, users will receive alert messages in time. Experiment show that the system has the advantages of stable operation, simple use and good flexibility, and has high practical value and wide application prospects.


Introduction 2 The overall structure of the system
The indoor environment monitoring and early warning system consists of three parts: the IMC(IMC), routing nodes and terminal nodes. The overall structure of the system is shown in Figure 1. The terminal nodes transmit the real-time collected indoor environment information to the ZigBee coordinator node of the IMC through the hierarchical network. The routing node is responsible for data forwarding and network path maintenance; the terminal node is a data collection node with sensors, which is responsible for real-time collection of indoor environmental parameters (temperature and humidity, CO volume fraction, formaldehyde concentration, etc.); the IMC stores important indoor environment information on the SD card, and updates the latest indoor environment information to the web server. The user can remotely open the web server web page through the Internet to view the indoor environment information (the user has a public IP), directly connect to the system router network locally to complete a comprehensive monitoring of the indoor environment. When there is an abnormal environment, the IMC will send an alarm message to the user in time through the GSM module for early warning.

System hardware design
The ZigBee wireless sensor network node chooses Texas Instruments' CC2530F256 chip as the processing core in terms of hardware. CC2530 is a 2.4GHz system-on-chip conforming to the ZigBee standard. It is suitable for various ZigBee and ZigBee PRO wireless sensor network nodes, including coordinators, routers and terminal nodes. CC2530F256 integrates 8051 core, 256KB system programmable FLASH, 8KB RAM, with abundant peripheral equipment, and the node transmitting power can reach 4.5dB. Using the AN9520 patch antenna in the antenna part not only ensures the stability of the network node communication.

Hardware Design of Information Monitoring Center
The IMC is mainly composed of central processing unit, storage unit, ZigBee coordinator node, Ethernet controller module, GSM module and router. The hardware structure of the IMC is shown in Figure 2. The central processing unit of the IMC uses STM32F103RET6 microcontroller of STMicroelectronics. It is a low-cost, low-power and high-performance microcontroller solution [6,7] ; the ZigBee coordinator node uses the same CC2530 chip as the routing node and the terminal node, and the ZigBee coordinator node receives the indoor environment information sent by the terminal node and sends the environmental information to Central processing unit STM32 microcontroller; Ethernet controller module adopts ENC28J60 Ethernet controller, data transmission rate up to 10Mb/s, the Web server that displays indoor environment information is realized by transplanting the uIP1.0 Ethernet protocol stack in STM32.

Terminal node hardware design
The terminal node is a network node with sensors. It mainly includes three parts: node core CC2530, sensor module and power management module. The terminal node hardware block diagram is shown in Figure 3. The sensor module is an important part of the terminal node. The sensor type can be flexibly determined according to the actual needs of the user. In this experiment, the system selected the SHT10 digital temperature and humidity sensor, MQ-7 carbon monoxide sensor and MQ-13 toxic gas sensor. Among them, the SHT11 digital temperature and humidity sensor is calibrated in full scale, with a two-wire digital output, and the CC2530 can directly read the indoor temperature and humidity information through peripherals. The gas detection module is composed of a gas sensor, a voltage divider resistor, and a voltage amplifier circuit [5] . The terminal node has a sensor module to detect the indoor environment, which is an important part of the indoor environment monitoring and early warning system. In order to save power consumption, after the terminal node is successfully connected to the ZigBee network, the indoor environment information is collected and detected periodically. The working process is: firstly initialize the terminal node equipment, and then connect the terminal node to the ZigBee network. After the detection period is reached, the terminal node collects sensor data, sends the sensor data to the ZigBee coordinator node of the IMC, and continues to sleep state, the software flow of the terminal node is shown in Figure 4.

Software design of Information Monitoring Center
The ZigBee coordinator node of the IMC mainly receives the sensor data sent by the terminal node, and sends the sensor data to the STM32 microcontroller of the IMC. The IMC uses STMicroelectronics' STM32 microcontroller as the core, and embeds the uIP1.0 Ethernet protocol stack in STM32 to establish a Web server to display indoor environmental information. The working process is as follows: (1) Initialize the STM32 device; (2) Initialize the uIP1.0 protocol stack, Web server and ENC28J60 Ethernet controller; (3) Set the SIM900a module to the TEXT SMS receiving mode through the AT command to complete the GSM initialization of the module; (4) Start the ZigBee coordinator node and wait to receive the environmental data collected by the terminal node sensors. After receiving the sensor data, first update the indoor environmental information in the Web server, and then store the important environmental data in the SD card for the user query, when the environmental data exceeds the warning value (such as the temperature exceeds 40 Celsius, etc.), the STM32 microcontroller will send an AT command to the GSM module to send an alarm message to the user in time. The STM32 program flow chart is shown in Figure 5.

Experimental test
In order to verify the practicability of the system, an indoor environment monitoring and early warning system based on ZigBee network was established. The IMC is arranged in the living room, and the routing node is arranged at the entrance of the two bedrooms, and the environmental information such as temperature and humidity, carbon monoxide and toxic gases (such as formaldehyde) in the two bedrooms are monitored and early warning.
Take 5 time points within a day, record the indoor temperature and humidity measurement results of terminal node 1 and terminal node 2 in the two bedrooms, and compare them with the indoor standard thermometer and hygrometer measurement results. The experimental data are shown in Table 1 and Table 2 show. It can be seen from Table 1 and Table 2: the temperature measurement accuracy is within 0.5 , the relative error of temperature measurement (the value measured by the thermometer is the true value) is within 1%, the relative humidity measurement accuracy is within 1.0%RH, the relative error of humidity measurement (the value measured by the hygrometer is the true value) is within 1%, so the error range is small. Experiments have proved that users of this system can monitor indoor temperature, humidity, carbon monoxide and formaldehyde and other toxic gases. When there is an abnormal indoor environment (such as fire, gas leak, formaldehyde exceeding the standard, etc.), the user can receive an alarm prompt message in time.

Conclusion
The indoor environment detection and early warning system introduced in this paper uses ZigBee network communication technology, embedded Web server technology and GSM communication technology to realize real-time monitoring and early warning of indoor environment information such as indoor temperature and humidity, carbon monoxide concentration, and formaldehyde concentration. Experiments have proved that the environmental monitoring and early warning system introduced in this article has certain practical value. It is a set of indoor environment monitoring and early warning solutions with high accuracy, good real-time performance, convenient operation and easy expansion.