# Research on the Monitor and Control System of Granary Temperature and Humidity Based on ARM

Liu Yang, Xinrong Cheng, Zhijie Jiang, Zhijun Ren

► To cite this version:

Liu Yang, Xinrong Cheng, Zhijie Jiang, Zhijun Ren. Research on the Monitor and Control System of Granary Temperature and Humidity Based on ARM. 5th Computer and Computing Technologies in Agriculture (CCTA), Oct 2011, Beijing, China. pp.257-264, 10.1007/978-3-642-27275-2_28. hal-01361146

HAL Id: hal-01361146

https://inria.hal.science/hal-01361146

Submitted on 6 Sep 2016

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Research On the Monitor and Control System of
Granary Temperature and Humidity Based on ARM

Liu Yang¹, Xinrong Cheng², Zhijie Jiang³, Zhijun Ren¹,

¹ Engineering College, China Agricultural University, 100083, Beijing China;
² College of Information and Electrical Engineering, China Agricultural University, 100083, Beijing China; ³ The Department of Automobile, Beijing Jiaotong Vocational Technical University, 102200, Beijing China
yangliu@cau.edu.cn, hh0188@sina.com,
jiangzhijie@163.com, zhijunr@gmail.com

**Abstract.** The temperature, humidity, air composition and pH value are very important parameters in the granary that keep the grain safely store and good quality. Nowadays only temperature and moisture are used in most granary monitor and control system. Air composition, pH and insect pest are not monitored because classic industrial personal computer or microcomputer are not able to handle these real-time multiply tasks at the same time. So it is necessary to design a monitor and alarm system to monitor these parameters in the granary to minimize or curtail damage or loss. Applying the advanced embedded technology and sensor technology, a set of granary temperature and humidity monitor and alarm system is designed based on the ARM. Temperature sensor, humidity sensor, air composition sensor and pH value sensor are selected to monitor the parameters in the granary. Based on the ARM microprocessor LPC2290, the hardware system consists of serial communication module, LCD display module and alarm module. Based on the embedded operation system, the software completes the allocation design and testing of the tasks and realizes the functions such as pulse frequency signal acquisition, analog signal A/D convert, serial digital signal communication, alarm in different grades and LCD display. All the parameters can be real-time displaying on the LCD screen. The system meets the requirement of the monitor and alarm functions in the granary.

**Keywords:** Monitor, Alarm, Sensor, ARM

# 1 Introduction

Grain safety storage is the important strategy relating to people's' livelihood and has its social meaning and economic value. The temperature and humidity in the granary varies when the environments and ventilation situation changes during the storage that leads to the grain becoming worse and insect damage. At the same time, the quality of the grain influenced by the air in the grain and microorganism. According to the specific of the grain storage, the temperature and humidity are the main parameters
which should be monitored in the granary and the air composition and pH value are the auxiliary parameters[1].

In the old days the temperature and humidity in the granary are controlled by the workers. The granary workers check the temperature and humidity in the granary periodically in order to make decision how long and how strong the wind is supported to ventilate the granary. It is hard to control the temperature and humidity accurately in the granary just by the workers. With the developments in the electric and electronic technology, the sensors are used to monitor the temperature and humidity in the granary. At the beginning granary measure and control system consisted of only some electronic temperature measurement and several controlled fans[2]. Later on industrial personal computer and semiconductor PN temperature components are used in big and middle granary to control the limited parameters[3]. And then the digital sensors and industrial personal computer with windows operation were used in the control system[4]. Nowadays wireless technology is used in the monitor and control system[5].

Although in the 20 years monitor and control system have developed and applied greatly and achieved economic benefits, many problems still exist. In wireless system, it is hard to improve the system accuracy and reduce the repeated error because of the useful detected signal being added by surrounding wireless signals. In the wireless system communication data temporary disappearing with the environment temperature varied leads to unreliability[6]. On the other hand, nowadays only temperature and moisture are used in most granary monitor and control system. Air composition, pH and insect pest are not monitored because classic industrial personal computer or microcomputer are not able to handle these real-time multiply tasks at the same time[7]. However the ARM monitor system in this article solved the problems above. It can process multiple signals at the same time using the multiple tasks and real-time functions.

## 2 Scheme of the Hardware System

The monitor system mainly consists of controller, signal acquisition module, LCD display module, alarm module, testing module and power module. The controller makes the data acquisition and compares the values to the boundary condition values. The alarm beeps and at the same time lights flash if the real value is greater than the boundary ones. Every parameter can be real-time displaying on the LCD screen. This project is based on the LPC2290 belonging to ARM microcomputer of Zhi Yuan company. According to the functions, hardware part bases on the LPC2290 microprocessor and connects to inputs and outputs through the bus and interface circuit. The diagram of hardware system is shown in Fig.1.
<figure><img src="image_2.png" /><figcaption>Fig. 1. The diagram of hardware</figcaption></figure>

## 2.1 Sensor Signal Acquisition

There is four-channel & ten-digital converter in LPC2290 microcontroller which can successively convert analog signals to digital signals. The outputs of temperature sensor and humidity sensor signal are plus frequency signals which input into the AIN0 and AIN1 of LPC2290 after go through optical coupler. Air composition sensor and pH value sensor output the signals that directly go through the multiple serials converter and communicate with LPC2290[8][9]. The interface diagram of sensor signal data acquisition is shown in Fig.2.

<figure><img src="image_3.png" /><figcaption>Fig. 2. Interface circuit of sensor data acquisition</figcaption></figure>
## 2.2 Alarm Module Design

The alarm system is divided into three levels. When the acquisition data reach to the critical value, the system judge the type of the alarm level and output the related results. Also the alarm result is divided into three levels. Green light will be flashing in the first level, reminding the granary clerk to monitor the parameters carefully. Yellow light will be flashing while beeping in the second level, reminding the granary clerk to deal with the dangerous situation in twenty four hours. Red light will be flashing while beeping in the third level, reminding the granary clerk to deal with the emergency immediately.

<figure><img src="image_4.png" /><figcaption>Fig. 3. Alarm Module</figcaption></figure>

## 2.3 LCD (Liquid Crystal Display) Module

The LCD module is designed base on M240128-1A1 made by Xin Li company to display the temperature, humidity, air composition and pH values. The LCD matrix dot is 240×128.The LCD display module consists of controller, line driver, row driver, display memory and LCD display screen assembled in one low-cost PCB board. The module can be real-time displaying the data monitored by the temperature sensor, humidity sensor, air composition sensor and pH value sensor. The LCD display module is connected with the microcontroller by input and output ports[10][11]. The circuit is shown in the Fig.4.
<figure><img src="image_5.png" /><figcaption>Fig. 4. LCD Display Interface Circuit</figcaption></figure>

## 3 Software Scheme based on μ C/OS-II

The more powerful functions and system calling, the more effective and simple supports can be provided by the applying program and the less amount of maintain. The μ C/OS-II only provides a task scheduling kernel. In order to realize a complete and reality online multiple task operating system, the basic common task is built such as serial ports, LCD and A/D according to the function acquirement of the monitor and alarm system.

The bottom layer consists of the alarm hardware system whose kernel is LPC2290 (RM7 serial chip) and some surrounding devices such as LCD and alarm module. The middle layer consists of signal supported by operating system, mailbox and information line etc. communication mechanism, driving program library and API functions. The top layer is the customer applied program which is established in the main task and operated through calling API function by the customers to satisfy their requirements. Customers can establish their own tasks in their own applied programs. Multiple tasks complete the cooperative communication depending on the system information line.
<figure><img src="image_6.png" /><figcaption>Fig. 5. Main Program Diagram</figcaption></figure>

## 3.1 System Task Modules and Priority Level Division

The tasks division is the important step of the real-time software system development. The whole system will be low effective, poor real-time and less capacity if the division is unreasonable. According to the design requirement, the program establishes six tasks: the main task, A/D acquisition task, the switch signal I/O acquisition task, serial communication task, alarm task and LCD display task. The allocation of the tasks is shown in the table 1. Every task has its own stack space depending on the variety numbers and interruption numbers in the task after the priority is decided.

In the μ C/OS-II system, the static and active ways are used to allocate the stack space. The static stack allocation is completed when compiling while the active stack allocation is completed when operating. The static allocation is used in the design that keep the priority in the process of system operation is the same as before.

<table><caption>**Table 1.** Tasks Allocation</caption><thead><tr><td>Task Name</td><td>Priority</td><td>Task Stack</td><td>Function Description</td></tr></thead><tbody><tr><td>Main Task</td><td>17</td><td>256</td><td>Initialized Display Interface, Established Other Tasks</td></tr><tr><td>A/D Acquisition Task</td><td>18</td><td>128</td><td>Measure Temperature, Humidity</td></tr><tr><td>Switch Signal I/O Acquisition Task</td><td>19</td><td>128</td><td>Acquire I/O Signals</td></tr><tr><td>Serial Communication Task</td><td>20</td><td>256</td><td>Send Air composition Signals, pH Value Signals To Serial Ports</td></tr><tr><td>Alarm Task</td><td>21</td><td>128</td><td>Beep and Light Alarm</td></tr><tr><td>LCD Display Task</td><td>22</td><td>512</td><td>Display Measurement</td></tr></tbody></table>
## 4 Experiments

The experiments methods and steps are designed and operated in the lab and in the granary. Take wheat as the sample. Fig.6 shows the LCD system.

<figure><img src="image_7.png" /><figcaption>Fig.6 LCD Module in the Monitor and Control System</figcaption></figure>

<table><caption>**Table 2** Compared Measured Value with Actual Value of the Granary Parameters</caption><thead><tr><th>Parameters Name</th><th>Moisture(%)</th><th>Temperature(°C)</th><th>Air<br>Composition<br>(%)</th><th>pH Value</th></tr></thead><tbody><tr><td>Measured Number 1</td><td>51.45</td><td>22.56</td><td>3.78</td><td>6.89</td></tr><tr><td>Actual Value</td><td>51.81</td><td>23.00</td><td>3.28</td><td>6.77</td></tr><tr><td>Measured Number 2</td><td>52.32</td><td>22.89</td><td>3.02</td><td>6.71</td></tr><tr><td>Actual Value</td><td>52.67</td><td>23.13</td><td>3.35</td><td>6.67</td></tr><tr><td>Measured Number 3</td><td>51.87</td><td>23.09</td><td>3.15</td><td>6.80</td></tr><tr><td>Actual Value</td><td>51.31</td><td>22.79</td><td>3.77</td><td>6.74</td></tr><tr><td>Measured Number 4</td><td>52.04</td><td>22.11</td><td>3.20</td><td>6.69</td></tr><tr><td>Actual Value</td><td>52.56</td><td>23.43</td><td>3.82</td><td>6.79</td></tr><tr><td>Measured Number 5</td><td>51.78</td><td>22.67</td><td>3.32</td><td>6.81</td></tr><tr><td>Actual Value</td><td>51.99</td><td>23.99</td><td>3.57</td><td>6.90</td></tr><tr><td>Measured Number 6</td><td>51.37</td><td>23.00</td><td>3.90</td><td>6.83</td></tr><tr><td>Actual Value</td><td>51.09</td><td>22.89</td><td>3.11</td><td>6.47</td></tr><tr><td>Measured Number 7</td><td>52.67</td><td>22.62</td><td>3.65</td><td>6.29</td></tr><tr><td>Actual Value</td><td>52.01</td><td>23.00</td><td>3.22</td><td>6.47</td></tr><tr><td>Measured Number 8</td><td>51.81</td><td>22.47</td><td>3.92</td><td>6.59</td></tr><tr><td>Actual Value</td><td>51.57</td><td>23.13</td><td>3.06</td><td>6.70</td></tr><tr><td>Measured Number 9</td><td>52.83</td><td>23.28</td><td>3.46</td><td>6.39</td></tr><tr><td>Actual Value</td><td>52.32</td><td>22.90</td><td>3.94</td><td>6.37</td></tr><tr><td>Measured Number 10</td><td>51.34</td><td>23.06</td><td>3.26</td><td>6.44</td></tr><tr><td>Actual Value</td><td>51.67</td><td>22.97</td><td>3.80</td><td>6.61</td></tr></tbody></table>
## 5 Conclusion

Applying the advanced embedded technology and sensor technology, a set of granary temperature and humidity monitor and alarm system is designed based on the ARM microprocessor LPC2290. Temperature sensor, humidity sensor, air composition sensor and pH value sensor are selected to monitor the parameters in the granary. The hardware system consists of serial communication, LCD display and alarm module. The software is based on the embedded operation system that completes the allocation design and testing of the tasks. The system realizes the functions such as pulse frequency signal acquisition, analog signal A/D convert, serial digital signal communication, alarm in different grades and LCD display. The system meets the requirement of the monitor and alarm functions in the granary.

## References

1. Liu Tieliu: The Design of Intelligent Granary Monitoring System Based on Wireless Sensor Network. J.Journal of Jinling Institute of Technology. vol. 26(4), 6--11 (2010)

2. Simulation of Temperature Measurement System forGrain Storage Based on ZigBee Technology, http://www.computer.org/portal/web/cmdl/doi/10.1109

3. Zheng Songfeng: The Development and Application of the Granary Temperature Measure System.D. Wuhan Polytechnic University (2009)

4. Wang Zhiguo, Wang Peng, Li Cheng: Wireless Oxygen Content Monitor Design in Metallurgy Gas Processing.J.Control & Automation. vol. 23(1), 109—110 (2007)

5. Cai Xiaowei: Research and Design of Smart Online pH Detector and Recorder.D. Zhejiang Polytechnic University (2009)

6. Chi Tao, Huang danfeng: pH Detection's Realizer and Control Based on Transcendental Knowledge of Neuron Model.J.Journal of Zhengzhou University (Science Edition). vol. 40(3), 32—34 (2008)

7. Li Tianbo, Zhao Wenqing, Huang Zhenyue: The pH Detecting System Based on nRF9E5 Wireless Transmission.J.Instrument Technique and Sensor. No. 4, 62—63 (2009)

8. Zhou Ligong: ARM Embedded System Tutorial: Tsinghua University Press. Beijing (2004)

9. Shen Linfeng, Song Tiecheng, Ye Zhihui: Development and Application of Embedded System: Electronics Industry Press. Beijing (2005)

10. Zhou Ligong: Basis and Practice of ARM Microcontrollers: Beijing Aerospace University Press. Beijing (2004)

11. Zhou Ligong: ARM Embedded System Experimental Materials: Beijing Aerospace University Press. Beijing (2005)12. labrose J Jean: Embedded Real-time Operating System µC/OS- II: Beijing Aerospace University Press. Beijing (2003)