Design of greenhouse temperature and humidity wireless control system based on CC3200
2018-05-09ZHAOChengchengDINGHaifeiLIUWenyiKANGXi
ZHAO Cheng-cheng, DING Hai-fei, LIU Wen-yi, KANG Xi
(Science and Technology on Electronic Test & Measurement Laboratory, North University of China, Taiyuan 030051, China)
0 Introduction
Nowadays, crops planted in greenhouses play an extremely important role in people’s lives. The temperature and humidity (TH) are important standards of greenhouse measurement, which directly affect the growth and yield of cultivated crops. The method of TH measurement by traditional thermometer and hygrometer is inefficient and difficult to control the TH in the greenhouse. Aiming at this problem, a TH monitoring system that can automatically control the TH is designed in this paper, which effectively solves the issues in TH controlling[1,2].
1 Overall design of temperature and humidity monitoring system
The TH monitoring system mainly consists of digital TH sensor DHT22, FPGA, CC3200, heater, humidifier, air inlet and outlet devices and PC-side composition. The TH signals detected by the DHT22 are received by FPGA through the external input interface circuit, and are displayed on the PC (server mode) through the wireless MCU CC3200(STA mode)[3]. Meanwhile, FPGA takes the relevant measures for the air inlet and outlet devices, heater and humidifier, and improves the surrounding environment for the plants. Thus, a simple TH monitoring system is formed. The overall design block diagram of monitoring system is shown in Fig.1.
Fig.1 Overall design block diagram of TH monitoring system
2 Hardware design
2.1 DHT22 and its external interface circuit
DHT22 is a digital display sensor of measuring the humidity and temperature. It includes one capacitive humidity sensor and one high precision temperature measuring element, connected with a single chip microcomputer. The calibration coefficients are stored in the OPT memory of the microcontroller, and the calibration coefficients are called in the process of processing the detected signals to improve the accuracy of output digital signals[4].
DHT22 is a standard single bus interface with small size, low power consumption, space and resources saving, which makes the system integration more simple and convenient. Moreover, DHT22 has the characteristics of fast response speed, high performance price ratio and strong anti-interference ability. DHT22 has the ultra-long signal transmission distance, which can reach more than 20 m, and combines with CC3200 by wireless communication, so it is the best choice for remote monitoring of greenhouse TH system.
DHT22 uses the standard single bus interface which is 3 pin single row pin package, and its external interface circuit is shown in Fig.2.
Fig.2 DHT22 external interface circuit diagram
2.2 Single bus communication
The communication mode of sensor DHT22 is single bus, that is, there is only one data line, and the FPGA control bus and the data transmission of sensor are completed by this data line. The data line needs an external pull-up resistor about 5.1 kΩ to ensure that the bus in idle state is in high level, so that the sensor can receive the signal sent by FPGA to start work.
FPGA and DHT22 are master-slave structure, and the FPGA must strictly follow the single bus sequence to call sensor. The user sends the start signal, namely the data bus is pulled down at least 800 μs, then DHT22 sends a response signal from a low power mode to a high speed mode, and outputs TH data of 40 bit from the serial data bus[5]. The data transfer order is high humidity (8 bit), low humidity (8 bit), high temperature (8 bit), low temperature (8 bit), the parity bit (8 bit). Each 40 bit can trigger a collection of information, then DHT22 will automatically turn into sleep mode until the next communication starts[6]. The specific single bus communication timing diagram is shown in Fig.3.
Fig.3 Specific single bus communication timing diagram of DHT22
2.3 FPGA control module
FPGA is the core of greenhouse TH monitoring system, and its function is defined through configuring the logic function of the device and I/O port, FPGA adopts modular design method, and is easy to do timing analysis and search problems. In addition, FPGA has the advantages of programmability, high reliability and integration. The traditional digital circuit system meets the requirements mainly through the circuit board design, but FPGA focuses on the chip, so using FPGA as the core greatly improves the flexibility and efficiency of greenhouse TH monitoring system.
In this system, FPGA is not only an important component of information transmission and processing, but also plays a certain role in controlling system. Through processing data collected by the TH sensor, FPGA completes the fan and other equipments control and plays an important role in improving the greenhouse living environment. The specific design of control system is shown in Fig.4.
Fig.4 Design of FPGA control module
2.4 Radio frequency peripheral circuit
The radio frequency (RF) peripheral circuit of CC3200 is the basic configuration of the wireless communication, and its circuit diagram is shown in Fig.4. Thanks to the high degree integration of CC3200, the structure of the peripheral circuit becomes very simple. The transmitted signal is transmitted through RF_BG pin, 2.4 GHz band pass filter FL1 and impedance matching network, and finally sent out through the antenna[7]. The radio frequency peripheral circuit is shown in Fig.5.
Fig.5 RF peripheral circuit
3 Software design
3.1 FPGA specific control mode
In this design, strawberry growing in greenhouse in winter is as an example to introduce the specific control mode of FPGA. It is necessary to control the TH of the greenhouse by FPGA to ensure the normal development of strawberry plants in different growth stages. The specific control mode is shown in Fig.6.
Fig.6 FPGA control mode
3.2 FPGA data flow reading
The communication between FPGA and DHT22 can be completed by the following three steps.
1) DHT22 needs to wait for 2 s to get into the steady state after powered on. Then the sensor starts to measure the TH and records data. At this point, the data line turns to the low power mode, maintains at high level, stays in input state to detect the external signal at any time.
2) The FPGA outputs the starting signal (typically 1 ms) with a hold time no less than 800 μs, and then releases the bus; meanwhile, the data line of the DHT22 becomes as an idle state. After the release of FPGA bus, DHT22 sends a response signal, which is low level of 80 μs output, followed by a high level of 80 us output as the response signal to notify the FPGA to receive data. The signal transmission is shown in Fig.7.
3) Response signal of the sensor makes the FPGA to receive the data, and the data bus outputs 40 bit serially. The FPGA recognizes the 40 bit according to the change time of high and low levels.
Data format of “1”: time for low level of 50 μs and high level of 70 μs;
Data format of “0”: time for low level of 50 μs and high level of 26-28 μs[8].
Signal formats of the bit data “0” and “1” are shown in Fig.8.
Fig.7 Single bus response signal timing diagram
Fig.8 Signal formats of bit data “0” and “1”
The DHT22 data flow diagram readed by FPGA is shown in Fig.9.
Fig.9 DHT22 data flow chart readed by FPGA
3.3 CC3200 communication
CC3200 is the hub of information transfer between PC and FPGA, and all data transmission is done by CC3200 through wireless communication. First, CC3200 starts and initializes, connects the wireless router (Router) and establishes communication with the PC. CC3200 is connected with FPGA. The data collected by TH sensor is transmitted to CC3200 through FPGA UART port.
Fig.10 Workflow of CC3200
After that, the signal is sent to PC by Wi-Fi with using the secure TCP/IP protocol, so that the TH information in greenhouse can be obtained at the PC terminal, so the real-time monitoring of TH in greenhouse is realized. The wireless communication characteristic of CC3200 overcomes the obstacle of long-distance communication, and this characteristic is also its advantage in greenhouse. Fig.10 is the workflow of CC3200.
4 Verification of test results
4.1 Data fetch
The 40 bit data collected by DHT22 include 16 bit humidity data, 16 bit temperature data and 8 bit check data. The experimental data are ten times of the actual data, so it is necessary to transform the collected data to the actual value of temperature and humidity in the measured environment. For example, the collected 40 binary data are 00000010 10001000 00000001 00111000 11000011, 00000010 10001000B, which are 648D under decimal system, so the environmental humidity is 64.8%RH; 00000001 00111000B, which is 312D under decimal system, so the temperature is 31.2 ℃, check bit 11000011=00000010+10001000+00000001+00111000 (16 bit humidity data plus 16 bit temperature data), which means the check bit is verified correctly. This data recording method improves the accuracy of the measured data.
4.2 Conclusion verification
In the TH monitoring system, when the temperature reaches 25 ℃, the FPGA opens the fan. Fig.11 shows that during the cooling process, data is transmitted by CC3200 and displayed on PC when the distance between DHT22 and FPGA is 24 m.
Fig.11 PC data
It can be seen from the screenshot that the temperature value drops from 00FA to 00E1, that is, from 25 ℃ to 22.5 ℃, and the humidity value is kept constant, i.e., atmospheric humidity. It is verified that DHT22 can complete the data transmission in long distance, and FPGA can control the system in the absence of monitoring and provide a more suitable growth environment for plant.
5 Conclusion
The design of greenhouse temperature and humidity monitoring system based on CC3200 with digital sensor DHT22, FPGA, CC3200 and PC has the advantages of high measurement accuracy and high monitoring efficiency compared with the traditional temperature and humidity measurement used in traditional greenhouse. Moreover, the system can automatically take corresponding measures according to the change of environment, so that crops can grow in better environment. In addition, the transmission mode of wireless communication can give full play to the advantages of long-distance transmission in this system, and has strong practicability and broad prospects for development[9].
[1] Du Y F. nRF905 & DHT11 based wireless temperature & humidity logger. Information Technology, 2012, (1): 193-195.
[2] Du Z N. Implementation method of the greenhouse environment monitoring system based on wireless sensor. Value Engineering, 2014, (34): 242-244.
[3] Tang Z Y,Wang M S, Shu L. Design of remote data acquisition system based on NRF24L01. Automation & Instrumentation, 2011, (4): 44-45.
[4] Lin Z M. Design of a digital hygrometer based on DHT22. Journal of Jiamusi University (Natural Science Edition), 2016, 34(2): 223-225.
[5] Gao Z B. A digital storge temperature and humidity measuring system. Journal of Changzhou Institute of Technology, 2016, 29(5): 35-38.
[6] Liu Z F, Li X J, Lü Y P, et al. Design of RF heating temperature and humidity monitoring system based on STM32F103VBT6. Microcomputer & Its Applications, 2012, 16: 28-31.
[7] Lin T. The research and application of Wi-Fi developing oriented microcontroller CC3200. Suzhou: Soochow University, 2015.
[8] Jiang G Y. Design of remote temperature monitoring system based on ARM NUC 140. Computer Programming Skills & Maintenance, 2014, 20: 97-98.
[9] Chen M J, Xiong S C. Based on the P89LPC932 microcontroller system controlling the temperature and humidity in the greenhouse. Computing Technology and Automation, 2004, (2): 19-21
[10] Tian Z P. Design of remote monitoring system based on CC3200. Beijing: North China University of Technology, 2016.
杂志排行
Journal of Measurement Science and Instrumentation的其它文章
- A novel method of steel tape zero calibration
- Active disturbance rejection control FCS-MPC strategy based on ESO of PMSM system
- Effect of different casting methods on microstructure and mechanical properties of Mg-10Gd-3Y-0.6Zr alloy
- Tactical intention recognition of aerial target based on XGBoost decision tree
- Aircraft attitude estimation of MEMS sensor based on modified particle filter