Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 13, No. 2, 2024 221 Design of Temperature and Humidity Monitoring System for Air‐cooled Granary Xu Wang Tianjin University of Technology and Education, 300222, Tianjin City, China Abstract: Most current society of granary temperature and humidity detection work experience or use personal judgment and manual control stage, because human experience is not accuracy, so can not accurate to test the temperature humidity in the granary and many times to collect more artificial experience control efficiency is low, the granary administrator is uneven, prone to uncertainty, and then cause grain storage and mildew. Aiming at the above problems, this paper gives a grain warehouse temperature and humidity monitoring system based on single chip microcomputer. The system mainly consists of single chip microcomputer, temperature and humidity sensor, display module and alarm module. The temperature and humidity sensor detects the temperature and humidity inside the granary in real time, and sends the temperature and humidity data to the SCM through a single bus. After processing the data, the temperature and humidity data are sent to LCD1602 for display. When the temperature and humidity exceed the preset upper and lower limits, the system will give a voice alarm. The experimental results show that the temperature deviation of the system is ± 1 ° and the humidity deviation is ± 3%, which basically meets the expected design requirements. Keywords: MCU; DHT11; STC89C52; LCD1602; Temperature and humidity. 1. Introduction 1.1. The purpose and significance of this study Our country is a big country of food consumption, the food will produce respiration and redox reaction and the surrounding environment during the storage, the improper storage is easy to appear corruption and economic loss. Therefore, during the storage process, the grain is often heated because of the excessive humidity in the air. During the storage process of grain on weekdays, due to the weather, the grain is often stormy and stormy, and the hot and humid temperature causes the grain to rot and deteriorate, and bring huge economic losses to the food security of human beings and the whole world. Therefore, it is necessary to design an efficient and convenient temperature and humidity detection system for grain storage, which can improve the loss of nutrients in the storage process. As a grain storage in our country, it is urgently needed and of great significance. Therefore, it is necessary to detect the temperature and humidity of the grain in the granary in real-time precisely, so that the processor can alert the relevant personnel through calculation. The problem of spoilage in grain storage has been an important and complex one. During grain storage, the focus of warehouse management is to accurately detect temperature and humidity at the test site, since the warehouse requires workers to constantly check and record temperature changes in order to better prevent food spoilage. Because of the slow heat transfer within the grain, the general staff can not grasp it by experience. It requires professional warehouse managers to constantly check the temperature and humidity of the grain stacks in hot and dark silos, if found abnormal will need to continue to turn over the warehouse, and if not handled in time will appear in the case of moldy grain. And the concentration of dust in the grain bin is high, which can cause permanent damage to the technician. In order to improve the logistical support of the country's war- ready grain and reduce the phenomenon of food decay caused by improper storage in human society, for silos of a very large scale, all silos should be protected for environmental testing, it will certainly reduce the mildew of grain caused by other external environmental factors, which will save a lot of food over time. The improvement of granary monitoring is of great significance to our country and every country in the world. Academician Yuan Longping has been contributing to the increase of grain production in our country all his life. As an aspiring young man in the new era, he must pass on the spirit of Yuan Lao, who devoted his life to grain, therefore, it is necessary to test the temperature and humidity of the granary, and cherish every hard-won grain. 1.2. The research status of temperature and humidity monitoring in grain storage at home and abroad Since the reform and opening up, thanks to Yuan Longping Academician's unremitting efforts and wholehearted contribution to the world grain, the rice yield has achieved even better results, and the annual grain yield of our country has been increasing year by year, the Chinese people finally have their own rice bowl. The increase in per capita living standards and the devaluation of agricultural costs in the country have caused a large number of farmers to leave their land and head to urban industrial production workshops. This makes the storage of grain silos more important, and the national war-ready grain silos increase rapidly year by year, which brings great challenges to our grain reserves. Liang Chengxi and Shi Xiaotao from the Grain Reserve Department of our country are the first to study the grain storage in the northeast of our country. The method is as follows: the temperature detection rod is embedded in the granary to collect the grain temperature, the detection rod adopts the electric bridge principle to convert the temperature signal into the electric signal, and then connects the ADC chip to carry on the analog-digital conversion, the WINCC system displays the real-time temperature at the system interface. After several years of exploration, this method can be as large as 222 the detection of the temperature of the granary, but the shortcomings of the method are also obvious, the sensor detection rod because of temperature changes will make the detection results error, the linearity of the electrical signal of the sensor is not good. When the temperature drops below 5°or above 30°, the detection is inaccurate and wrong because of the rough linearity of the sensor. So this detection method is feasible in theory, but it has great hidden trouble in practice. Since the temperature bar is only suitable for detecting 5-20 degrees, it is not suitable for the climate conditions in the northeast [2]. Professor Chen Dong's research team then improved on this foundation by replacing the initially large and inaccurate temperature stick with a small temperature sensor, the ZH-1 type sensor, and using the fieldbus technology to gather the multi-sensor signals into a bundle of data bus to do AD module processing, has solved the previously complex problem of line connection, the data of multi-point detection in large grain warehouse can be transmitted by only a bunch of data bus. However, the problem of poor linearity of the sensor has been slightly improved from the initial temperature of 5 to 20 degrees to -10 to 50 degrees, which can meet the requirements of warehouse inspection in southern China, temperatures in the northeast can drop as low as minus 20 degrees Celsius in winter, exceeding the threshold the sensor can detect. Chen's sensor can now be used to detect temperatures in some areas. With the rise of the Internet and Zigbee, GE's team is using ZH-2 sensors to connect to the Internet of things, allowing workers to monitor the temperature of granaries thousands of miles away from their desks. The signal detected by the sensor is processed by an embedded chip, and then the Data RJ-45 is communicated by network cable, and the data is transmitted to the internet, the remote office can view the temperature of a remote granary in real time through a network interface. However, the semiconductor industry of our country started late, and the technology is not mature enough, causing the sensor intelligent detection temperature data, can not detect humidity predicament. The United States is flat, suitable for large-scale mechanized cultivation, so the United States is the food cultivation and export superpower. In the United States, the technology for detecting grain silos was developed earlier, and the technology could withstand it. Uses the technology to be diverse, in the detection technology aspect has the Dallas company research and development DS18B20, this sensor not only does not need the AD analog-to-digital conversion, may use the monolithic integrated circuit to read the digital signal directly, its biggest advantage is that the temperature range of the detection is wide, but the connection of the bus technical circuit is more convenient, and the connection of the single- chip computer only needs one bus, and can be connected to multiple sensors on the same bus, any sensor on the bus can be communicated and read by the recognition sequence inside the sensor. Based on the technology of this sensor, American Walker Company develops a more comprehensive detection system, because its sensor wiring is convenient, can parasitic power supply. In the warehouse can set up 1000 DS8B20 sensors, and finally one by one into the communication, the adjacent blocks of data mathematical processing, get a scientific judgment and then through the internet transmission to the remote control center. This design is convenient and feasible, but there is only one long-distance transmission bus, so even the advantages are disadvantages, the disadvantage is that the single bus long-distance signal transmission instability, it is subject to interference and signal decay from other factors. Since the long-distance transmission above required a single bus, the Vandermonde team used HC-05 Bluetooth as the signal transmission module, because of the convenience of wireless Bluetooth transmission, this eliminates the need for factory wiring and eliminates the problem of signal attenuation. The temperature and humidity data of the grain bin are collected into the computer terminal, and the computer carries out big data analysis to simulate the human brain experience, and finally can give the optimal solution. But computer-based machine learning techniques are not mature enough, and manual analysis is needed to get the initial results. The company has developed an infrared temperature- measuring system that uses infrared thermal imaging to detect grain surface temperatures in silos, avoiding multiple point- by-point tests. Eventually the thermal imaging data came into the computer, which combined local weather temperature and humidity for analysis [4]. This infrared system can only detect the temperature of the outside surface of the grain heap, can not detect the situation inside the granary, which needs to be used in conjunction with the previous temperature and humidity sensors placed inside the grain heap. 1.3. Major work of the project This topic design uses the monolithic integrated circuit as the embedded system's data exchange and the control center, arranges many temperature and humidity sensors in the granary specified position, one end of the bus is connected with the sensor data bus and the other end is connected with the microcontroller port detection (or wireless remote transmission). The detected data are analyzed and processed by the microcontroller, and finally the detected data are converted and displayed, finally, according to the user design of the upper and lower limits of temperature and humidity threshold for the corresponding alarm notification operations and lighting. In the sensor and display stage, cable transmission or Bluetooth remote wireless transmission can be used, when the temperature and humidity exceed the threshold, the relevant voice alarm and LED indicator display. 2. The Comparison and Demonstration of The Overall Design Scheme 2.1. System proposal demonstration Option 1: The data transmission between each sensor in the granary needs very precise and precise detection and stable transmission, in order to achieve the stable and reliable data transmission of the sensor detection, LCD1602 to display the visual display of fixed position data detected in the granary and the use of CAN bus in the data set. The operation process of the temperature and humidity detection system: the sensor detection data is finally collected to the data bus, and then handed over to the single chip processor to process and transform, and the upper and lower limits of the temperature and humidity alarm are set on the display bus database of LCD1602, when the temperature and humidity exceed or fall below the upper and lower limits of the initial set, prompt staff to carry out the relevant treatment, and the temperature and humidity monitoring system can also be set to automatic mode or manual mode to control the mechanical equipment inside the granary, such as automatic or manual start the 223 ventilation fan and cooling and dehumidification equipment work, when the temperature of the barn is too high, the air supply device starts to blow cold air into the warehouse, and when the humidity is too high, the hot air is fed into the warehouse by the heating wire and the air supply system. The system can enter the self-fault self-checking function, can real-time detect the situation of each position module, can also carry on the self-checking to the DS18B20, if that DS18B20 appears the fault, the first time to locate and inform the administrator to change [7]. Option 2: DSP430F149 is used as the main controller (GPRS module and other Bluetooth module can be connected) , DHT11 is used as the temperature and humidity sensor, the chip is easy to connect with sensors and modules, and the program language is process-oriented C language, so it is easy to write. These advantages are very suitable for the main control chip of barn temperature and humidity detection system. By combining the UART mode of serial communication with the master chip and the ZigBee network, the initial data processing is transmitted to the GPRS module. Data is 16-bit binary data with high precision. DHT11 digital temperature sensor only three wire connection is convenient, narrow environment is also suitable, sensor case according to the use of different scenarios can be flexible choice. The DHT11 sensor without shell can be used to detect the temperature and humidity of community high-rise building, flour workshop, boiler, greenhouse and operating room. Because the sensor shell can be customized, it has the advantages of excellent wear resistance and small size, a single bus can mount multiple sensors on a bus at the same time, and the sensors support parasitic circuits. The buzzer is a kind of electronic alarm device, which is used in automatic control, fire alarm, all kinds of equipment prompt, washing machine equipment, telephone and other electronic products. Option 3: STC89C52 is selected, DHT11 is used to detect the temperature and humidity of the granary, LCD1602 is used to display the temperature and humidity value and the upper and lower threshold of the temperature and humidity, the alarm system is chosen buzzer and four LED lights. STC89C52RC single-chip computer is a kind of single- chip computer that I studied systematically in my university. I used it to do a lot of related design in my daily life. The size of ROM and Ram inside the single-chip computer also meet the requirements of this project design, sCM in the market is more common, and low price. The sensor used in this subject is a widely used digital temperature sensor, its output is 5 groups of 8-bit digital signal, the first 16-bit temperature signal, the last 16-bit humidity signal, the last 8-bit is parity effect, the sensor is characterized by small size, low hardware cost, strong anti- interference ability, high data accuracy for 16-bit binary data. In order to display the stability of data, the system every 5 seconds to collect data into MCU, single-bus technology analog-to-digital conversion without ADC chip, the sensor straight out digital signal. STC89C52 single-chip interface 40 pins, enough for this design to use, the common cathode digital tube display more intuitive and low-cost, DHT11 can display both humidity and temperature function is complete [9]. Conclusion: finally, the cost, function and application proficiency of the main chip, display visual Chengdu and economic line should be taken into account. 2.2. The overall structure of the system Main components: (1) Control chip: using 8-bit STC89C52 single-chip computer and the sensor each send 8-bit mutual adaptation. (2) Display module: because the display device needs to display humidity and temperature, common common cathode digital tube can not meet the requirements, only LCD1602 can display the value of temperature and humidity and upper and lower limits. The data of DHT11 is displayed on LCD1602 by MCU. (3) Key Module: three independent keys to control, one key as a choice to change the online or offline, the other two responsible for changing the temperature and humidity upper and lower limit values. (4) Temperature and humidity detection module: here is through DHT11 temperature and humidity sensor, this sensor can detect humidity and temperature at the same time, to achieve a sensor detection of two variables, and the wiring is simple. 3. System Hardware Design 3.1. Introduction of simulation software Proteus software can be used for hardware circuit simulation and embedded system circuit and program debugging, because it is software simulation so do not need physical welding circuit board and components, leaving the purchase of components and welding process, it is easy to modify the problem in the simulation, greatly reducing the development of the product developers cycle. 3.2. The minimum system design of single-chip microcomputer 51 series single-chip compatible with 8051 instructions and pins, and with 256K capacity of program memory and flash technology. Moreover, STC89C52 series also has the serial programming function minimum system connection diagram as shown in figure 3.1. Figure 3.1. STC89C52 SCM minimum system The smallest system includes the MCU and its power supply, clock, reset and other components. It can be controlled by external 8255A interface and 6264 external memory expansion to realize more functions of MCU. (1) Power supply circuit: 40-pin power supply 5v, 20-pin ground, pin diagram as shown in figure 3.5 above. (2) Reset circuit: the hardware consists of a push-button 224 switch connected in parallel with a resistor. After charging and discharging, a pull-up resistor is connected. During the normal operation of the system, the capacitor is charged, which is equivalent to an accumulator. When the switch is pressed, the capacitor begins to discharge because of its own characteristics, the single-chip microcomputer system detects the high-level signal and then resets the single-chip microcomputer. (3) Crystal oscillator circuit: it is composed of quartz crystal oscillator and two ceramic chip capacitors. Quartz Crystal is responsible for oscillation, which is similar to shouting whistle to the single chip microcomputer. 3.3. DHT11 temperature and humidity sensor circuit design Sensor Instructions: the DHT11 sensor case is wrapped in plastic as shown in figures 3.2 and. The user can use the case flexibly. There are four pins, one of which is an empty pin. This design uses multi-channel DHT11 detection, two sides for power supply and grounding pin, another for data pin for data transmission, it needs to connect pull-up resistance to use, the size of the pull-up resistance depends on the transmission distance between the sensor and the MCU to determine. Figure 3.2. DHT11 wiring diagram 3.4. Key module circuit design According to the requirement of the subject and considering the simplified circuit, the independent keyboard connection method is selected. In the single-chip testing keyboard, as a result of the mechanical characteristics o, the need for Shake See. This mechanical property is a period of instability in the level signal caused by the slight jitter between and among the keys after the finger presses the key, key functions are shown in table 3.1. Figure 3.3. Key module circuit diagram 3.5. LCD1602 LCD display circuit design Detection of data using a common cathode digital tube to display the need for a number of groups of digital tube to display, which will lead to digital tube wiring complex and difficult programming. Because LCD1602 can display many groups of data at the same time, so use LCD1602 as a display device, wiring diagram see figure 3.4. Figure 3.4 LCD1602 pin diagram 3.5.1. 1602 basic description of LCD type LCD1602 is a liquid crystal display (LCD) screen, which is composed of a liquid crystal layer and a backlight layer. Using the physical properties of the LCD, after a deflection voltage is applied to the liquid crystal molecule, the liquid crystal deflects, thus displaying the light from the backlight layer through the LCD, multi-pixel combination display can show a variety of forms, but because the LCD1602 is a low- end LCD screen, can only display ASCII code characters, size see figure 3.5. Figure 3.5. LCD1602 size diagram of the display 3.5.2. 1602LCD screen internal display address LCD1602 LCD screen initialization is divided into four steps: (1) set the display mode (2) select the cursor mode. (3) cursor selection (4) screen cleaning Code: Write (0x38) ;//screen initialization Write (0x0c) ;//turns on display, no cursor, no cursor flicker Write (0x06) ;//write the characters where the pointer points Write (0x01) ;//clear the screen 3.5.3. Circuit design Microcontroller P0.0 to P0.7 ports were connected to LCD1602 data port, 2.6 port E, 2.7 port RS, see figure 3.6. 225 Figure 3.6. shows the circuit 4. 4Program Design 4.1. Main program design After the power is turned on, the system runs, the I/O port is initialized, the data is collected at intervals, and the control mode is judged [14] . The LCD1602 LCD screen completes the initialization, the monolithic integrated circuit will DHT11 temperature and humidity sensor detection data display on the LCD1602. 4.2. DHT11 detection subroutine design The data pin does this: (1) the microcontroller sends the start-reading command to the sensor (2) the temperature and humidity sensor sends the answer instruction to the single-chip microcomputer (3) the temperature and humidity sensor sends 40 bits of data to the single chip computer through the high point of data line. 4.3. LCD1602 display subroutine design Using an LCD1602 as a display device to display this topic, the LCD screen can display two lines, each line can display 16 characters, but can not display Chinese characters. The first line shows the current temperature value, the upper temperature limit value and the lower humidity limit value from left to right, and the second line shows the current humidity value, the upper humidity limit value and the lower humidity limit value from left to right. Change the upper and lower temperature and humidity limits by using the keys and cursor display. Select the humidity upper line so the humidity upper cursor blinks and the rest of the settings are indented, it is shown in figure 4.1 and 4.2. Figure 4.1. LCD1602 read sequence When transmitting data to LCD1602, pull the R/S pin low and the E pin high. Figure 4.2. LCD1602 write sequence 226 5. Summary This project is designed to detect and display the temperature and humidity inside the granary in real time, and set the upper and lower limits of temperature and humidity. When danger occurs, the buzzer will alert the technician to come and check, by looking at the color of the LED lights, the technician can determine whether the upper or lower limit is exceeded. Each upper or lower limit has a corresponding alarm light. However, due to the limitations of the 8051 MCU, it can not connect to the cloud server, which results in the detected data can not be stored directly in the remote server. If it can be transferred to the remote server, it can be connected to the internet, staff can directly view the temperature and humidity of the granary on the mobile phone, and carry out the corresponding operation and management. There is this topic the use of single sensor design, can not detect multiple granary multiple areas, you can follow up with more sensors, networking. Data transmission by cable, without the use of unlimited long-distance Bluetooth HC-05 is also limited by the limitations of the 8051 single-chip, subsequent developers can use STM32/ARM 11 and other more advanced chips to replace. References [1] ye Jianxin, Wu Bin, Wang Anlan. Design and implementation of a granary environmental monitoring system [ J ] . Computer age, 2020,32(08) : 23-30. [2] Wang Xiaoyi. Granary environmental monitoring system design [ J ] . Microprocessor, 2020,41(03) : 37-42. [3] Sun Jie, Xu Qinghe, Liu Xiaoyue. Design of a remote grain situation monitoring system based on NB-IoT technology [ J ] . Automation and instrumentation, 2020,35(04) : 86-89 + 93. [4] Li Meng, Yuelong Li, Xiangjie Meng. A novel civilian granary temperature and humidity monitoring device based on C8051F020[ P ] . Other Conferences, 2013,7(7) : 64-89. [5] Qianqian Yuan. Granary Temperature and Humidity Measurement System based on Zigbee network. [ J ] . IJWA, 2015,7(4) : 15-57. [6] Weilin Qiu, Siqing Yang. Development of Granary Temperature and Humidity Prediction Model Based on RBF Neural Network [ P ] . Proceedings of the 20177th International Conference on Applied Science, Engineering and Technology (ICASET 2017) , 4(1) : 51-65. [7] Zhu Guang. Design and implementation of a food monitoring and safety early warning system [ D ] . Anhui University, 2020,41(05) : 13-24. [8] song Boyang. Grain storage quality safety inspection system [ J ] . Science and technology, 2020,16(06) : 27-36. [9] Jia Jia. Construction of temperature and humidity monitoring system based on NB-IoT and cloud platform [ J ] . Automation Technologies and applications, 2020,39(11) : 64-66 [10] Chen Guixiang, Liu Chaosai, Jiang Minmin, Chen Jiahao, Wang Haitao, Zhang Hongwei. Effect of vertical pressure on moisture and heat transfer of wheat grain pile in grain silos [ J ] . Journal of Agricultural Engineering, 2020,36(08) : 246-253 + 325. [11] Cui Hongwei, Wu Wenfu, Wu Zidan, Lan Tianyi, Dou Jianpeng. Detection method of grain storage status based on statistical characteristics of grain temperature [ J ] . Journal of Agricultural Engineering, 2020,36(02) : 320-330. [12] Gao Junfeng, Liu Binbin. Research on the design and application of RFID technology for grain storage [ J ] . Modern trade and industry, 2019,40(30) : 206-207. [13] Yu Xiaojing, Wang Yuancheng, Qi Yukang. Numerical simulation and comparative study on horizontal water conservation and ventilation in grain silos [ J ] . Journal of Shandong Jianzhu University, 2019,34(02) : 37-44 + 51.