APP下载

Research on Intelligent Monitoring System Based on Raspberry Pi 3

2019-11-20JufangOU1YifeiZHOU

Asian Agricultural Research 2019年10期

Jufang OU1, Yifei ZHOU

1. Zhejiang Fangyuan Test Group Co., Ltd., Hangzhou 310018, China; 2. Hangzhou Academy of Agricultural Sciences, Hangzhou 310024, China

Abstract In order to monitor environmental parameters for food storage more effectively in real time, an intelligent monitoring system was designed and implemented based on Raspberry Pi. Based on the Raspberry Pi 3 Model B, the system connects environmental sensors such as temperature, humidity, light intensity and CO2 concentration. It can be used to monitor environmental parameters such as air temperature and humidity, light intensity and CO2 concentration during food storage. Based on Raspberry Pi 3, this study successfully built an intelligent monitoring system, and developed web version for computer terminal and app (iOS version and Android version) for mobile terminal. The data about the environmental factors during food storage were obtained. The system is reliable, simple and practical in operation, and highly expandable, laying a foundation for the next step of research on food safety storage environmental parameters and intelligent control.

Key words Raspberry Pi, Intelligent monitoring, Sensor, Food storage environment

1 Introduction

Storage environment plays a vital role in the quality and safety of food. Food has to go through multiple transportation and storage links from the factory to the consumer. This urgently requires the effective monitoring of the food transportation and storage links through the development of the Internet of Things technology. The main place for food storage is warehouse. The determination and control of various indicators in the warehouse environment will help to better store food for a longer period of time. Parameters such as temperature, humidity, light intensity and carbon dioxide concentration in the warehouse have a very important impact on food storage. Only under appropriate comprehensive environmental factors, can safe storage of food be achieved. In recent years, Internet of Things technology has been widely used in environmental monitoring and warehouse management[1]. Therefore, it is especially important to use the Internet of Things technology to monitor the changes in storage environment data in real time, so as to make corresponding contingency measures in a timely manner and keep food safe.

Raspberry Pi is an open source hardware platform[2]. The platform includes an I/O- capable circuit board and an ARM chip of Broadcom BCM2835 system on a chip (SoC) that can be adapted to a variety of work environments such as the Internet of Things. It can not only run a full range of ARM GNU/Linux distributions but also support Snappy Ubuntu Core and Windows 10 IOT[3]. Based on the Raspberry Pi 3, combining soil moisture, air temperature and humidity, foliar temperature and humidity, light intensity and pH sensors, an agricultural intelligent monitoring system is built. The sensor technology is the source of information acquisition. The powerful data processing capability of Raspberry Pi 3 makes it possible for the system to realize real- time monitoring of complex and variable crop growth environment parameters, and it also makes the system more stable and usable.

2 Hardware design

2.1 Overall structural designThe system is mainly composed of Raspberry Pi 3 Model B (Fig.1), 7- inch display, DHT11 air temperature and humidity sensor, light intensity sensor and MH- Z19B carbon dioxide gas sensor. Raspberry Pi 3 is compatible with Raspberry Pi 1 Model B+ and Raspberry Pi 2 Model B. In comparison, the processor is upgraded to 64- bit 1.2 GHz quad- core ARM Cortex- A53, which is 10 times higher than that of the original Raspberry Pi in performance, provides a rich GPIO interface, and integrates 802.11n WiFi, Bluetooth 4.1 and other functions[4].

Fig.1 Raspberry Pi 3 Model B

2.2 Air temperature and humidity sensorThe DHT11 temperature and humidity sensor is mainly used to monitor the ambient air temperature and humidity (Fig.2). It is connected to Raspberry Pi through the interfaces of VCC (to pc power 3.3v interface), GND (to ground interface) and DATA (to gpio interface) are used. Three busbar- to- busbar wires are used to complete the connection. If a 5v power supply is used, a resistor needs to be connected in series, and the resistor acts as a current limit[5]. The NC interface is left vacant (the NC pin in the chip has no use, only for packaging, but it must exist).

Fig.2 Diagram of interfaces in DHT11 temperature and humidity sensor

2.3 Light intensity sensorLight can cause a series of changes inside the food. Under illumination, light- sensitive components in food can absorb and convert light energy quickly, thereby stimulating a chemical reaction that deteriorates inside the food. The more light energy the food absorbs, the deeper the transfer is, and the faster and severer the deterioration is. Therefore, it is necessary to monitor the light intensity during the food storage process. The light intensity sensor pin is connected to the Raspberry Pi (Fig.3).

Fig.3 Pin accesses of light intensity sensor

2.4 Carbon dioxide sensorCarbon dioxide is a very stable gas. It will sink in the air, separating the contact between air and food, thus avoiding deterioration caused by oxidation and bacterial growth. The carbon dioxide gas sensor MH- Z19B is a small general- purpose sensor. It detects CO2presenting in the air using the non- dispersive infrared (NDIR) principle, with good selectivity and long life, without oxygen dependence. A temperature compensator is installed inside to provide a variety of output methods such as UART and PWM waveforms. The sensor is a high- performance sensor that combines sophisticated infrared absorption gas detection technology with precise optical path design and sophisticated circuit design. The working voltage, average current, range, accuracy, operating temperature and working humidity are 3.6-5.5 V DC, < 18 mA, 0-2 000 ppm, ±(50 ppm+5% reading), 0-50℃, and 0%-95% RH (no condensation), respectively.

3 Software design

3.1 Design planThe Raspbian operating system with a graphical interface is installed to the Raspberry Pi 3. The system’s foreground, background and monitoring programs use the Python development language[6]. Pip3 and setuptools need to be installed for support. The integration libraries of Python GPIO and BCM2835 are used to facilitate the functional operations on Raspberry Pi related hardware resources[7], which is a reason why the Raspberry Pi 3 is selected as the motherboard. The framework of the system is shown in Fig.4. The main process is as follows: the platform releases the collection task to the Raspberry Pi, which is sent to the collector (sensor) through the bus; the sensor reads the program module, reads the currently acquired parameters (e.g. humidity and temperature) according to a predetermined time value, converts the analog signal into a digital signal, reports the digital signal to the Raspberry Pi and provides feedback to the Raspberry Pi; and the web version of pc terminal or app of mobile terminal displays the data.

Fig.4 Design plan of intelligent monitoring system

3.2 Computer terminal’s program development (web version)The web version is written in Html5, Css and JavaScript, and the background is written in Flask. The main functional modules include environmental parameter monitoring module (including air humidity monitoring, air temperature monitoring, light intensity monitoring, CO2concentration monitoring,etc.), intelligent management module (including equipment list, ventilation setting, humidity setting, temperature setting and conflict setting), manual control module (including manual humidification, manual heating and manual ventilation), control query module (including humidification query, heating query and ventilation query), system management module (including user management, role management, online statistics, user settings,etc.). The data table supports two patterns of query, date list and chart. The data export supports Excel or WPS function.

The technical features are as follows. Users can use this software to achieve real- time monitoring on the food storage environment, such as humidity, temperature, light intensity and CO2concentration, set appropriate environmental management according to food safety storage requirements (when the set value is reached, the air conditioner, humidifier, dehumidifier, CO2concentration generator,etc. can be automatically turned on), and view the operation status of each monitoring device through the software.

3.3 Mobile terminal’s APP development (iOS version and Android version)To facilitate viewing and operation of users, app has been developed for mobile terminal, and iOS and Android versions have been developed for the two mainstream smartphones in the market. The main functions include the follows: supporting the simultaneous running of multiple sets of devices (users can check the monitoring data of air temperature and humidity, light intensity, CO2concentration,etc. at the right time), capturing images of food or the environment, setting up common controls, such as watering, ventilation, humidification and heating, and installing an operation log.

4 Analysis of monitoring data

Through the intelligent management system, data such as air temperature and humidity, light intensity, and CO2concentration of the environment can be recorded. As shown in the humidity and temperature monitoring data charts (Fig.5 and Fig.6), the data monitored by the system has practical significance for the safe storage of food.

Fig.5 Chart of humidity monitoring data in June 2018

Fig.7 Chart of temperature monitoring data in April 2018

5 Conclusions

Based on the advantages of open source, standardization, scalability, and low cost of the Raspberry Pi 3, an environmental parameter monitoring platform for food safety storage is established, realizing real- time monitoring of storage environment, facilitating making corresponding solutions in a timely manner, and reducing the adverse effects of environmental factors on food storage. The system has good communication efficiency, safe and stable operation, changeable monitoring range. It is very suitable for parameter data collection of the environment in small and medium- sized warehouses. The application of this system is a good interpretation of the superiority of the Internet of Things technology, and improves real- time monitoring of food storage environments. It has a certain role in promoting the good and rapid development of food safety.