Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 9, No. 2, 2024 27 Design and Application of Greenhouse Intelligent Control System Tianqi Liu, Zhao Zhang * University of Science and Technology Liaoning, Anshan, Liaoning, China * Corresponding author: Zhao Zhang Abstract: With the rapid development of science and technology, the application of intelligent technology in the field of agriculture has become increasingly widespread. Traditional agriculture usually faces problems such as high labor consumption, a single production environment and unstable crop quality, which leads to a delay in the process of agricultural development. This study designs and realizes an intelligent control system for greenhouse environment based on Internet of Things (IoT) technology, which comprehensively utilizes sensors to monitor environmental parameters, such as air temperature, humidity, light intensity, etc., in real time through wireless communication. At the same time, the HC-05 Bluetooth module transmits the data to the cell phone APP in order to realize the intelligent regulation of key environmental parameters. The system can not only guarantee the stability of the growing environment of crops, but also improve the growth efficiency and production quality of crops, reduce manual intervention and waste of resources, and provide strong support for the development of smart agriculture. Keywords: Agriculture; IoT Technology; Sensors; Wireless Communication; Environmental Monitoring. 1. Introduction Sustainability of the environment and food production is one of the biggest challenges of the twenty-first century [1]. At present, China's economic and social development is in a critical period of transformation. With the implementation of the rural revitalization strategy, new rural industries are developing rapidly [2]. Solving this problem is of great significance in realizing rural revitalization. Modern greenhouse control system through the combination of mobile network and Internet of Things technology, adding intelligent sensing technology, remote monitoring of crop growth conditions, collect crop growth data, wireless transmission through the Internet, by the control center and the detection center of the received data signals for intelligent analysis and simulation algorithms [3]. In agricultural production, facility agriculture with agricultural greenhouses is an important part, and it occupies a very important position in China's agricultural development [4]. Globally, facility agriculture in developed countries developed earlier, especially in Western Europe, North America and Japan and other developed countries, facility agriculture has accounted for more than 70% of the total area of the world's facility agriculture, China's facility agriculture is also developing [5]. The use of IoT technology can realize the intelligent control of agricultural production, improve production efficiency and promote the modernization of agricultural production [6]. The design of the system not only meets the requirements of modern agriculture for high efficiency, environmental protection and safety, but also provides new ideas and methods for agricultural production and promotes the process of agricultural modernization. 2. System Main Hardware Design (1) STM32 master control unit The STM32F103C8T6 has a Cortex-M3 core, clocked at up to 72 MHz, with up to 112 fast I/Os and a variety of communication interfaces for low cost and good performance [7]. The STM32 minimum system board requires both 5 V and 3.3 V. 5 V can generally be supplied directly via USB or 5 V can be supplied with a power adapter. Kernel benefits: predictable runtime, interrupt controller embedded in the kernel, interrupt intervals of up to a minimum of 6 CPU cycles, and wake-up from low-power mode takes only 6 CPU cycles [8]. (2) Temperature and Humidity Sensor Modules The measurement of temperature and humidity is an important part of the greenhouse environment data acquisition, the temperature and humidity sensor used in this system is the DHT11 digital sensor, which consists of a resistive humidity measurement element and an NTC temperature measurement element, and is connected to a high-performance 8-bit microcontroller [9]. Local humidity and temperature can be collected in real time through a simple circuit connection of a microprocessor such as a microcontroller. the DHT11 and the microcontroller can communicate with each other using a simple single bus, requiring only one I/O port. Sensor internal humidity and temperature data 40 Bit data one-time transmission to the microcontroller, the data is used to check the way to check, effectively ensure the accuracy of data transmission. DHT11 power consumption is very low, 5 V supply voltage, the average maximum current of the work of 0.5 mA [10]. The selection of the system clock is done at startup, the internal 8 MHz RC oscillator is selected as the default CPU clock at reset, followed by an external, failure-monitored 4- 16 MHz clock; when an external clock failure is detected, it is isolated and the system automatically switches to the internal RC oscillator, and the software receives the appropriate interrupts if they are enabled. Similarly, full interrupt management of the PLL clock can be taken when needed [11]. (3) Photosensitive sensor The working principle of photosensitive sensors is to convert light signals into electrical signals using photosensitive elements, which are sensitive to wavelengths near visible wavelengths, including infrared-ultraviolet 28 wavelengths. Photosensitive sensors can not only realize the detection of light, it can also be used as a detection element to form other sensors to detect many non-electrical signals, as long as these non-electrical signals are converted into optical signals [12]. Photosensitive sensors to collect the current light values, light intensity collection is based on the system to collect external light intensity analog data, through the analog-to- digital (ADC) conversion, calculation formula conversion, the external light intensity value, light intensity collection of analog values for 0-4095, a total of 4096 units, according to the value of the external light value, by connecting the microcontroller PA1, the data transferred to the OLED display, the OLED display shows the current light intensity, when the current planting environment is detected to be weak, the buzzer alerts farmers. PA1 of the microcontroller, the data is transferred to the OLED display, the OLED display shows the current light intensity, when the current planting environment is detected as weak light, the buzzer sounds an alarm to remind the farmer, the user through the bluetooth module can be in the cell phone APP terminal real-time monitoring of the collected light data information, and according to the appropriate light intensity of the crop to be adjusted. The photosensitive sensor module outputs a high level at the DO output when the ambient light brightness does not reach the set threshold, and a low level at the DO output when the external ambient light brightness exceeds the set threshold. The DO output can be directly connected to the microcontroller. In order to study the performance of the photosensitive sensors, the sensors coated with sensitive materials were tested under a sun simulator. The results show that the sensitivity of the photosensor is 0.106 ± 0.03 db/klx at 0-32 klx light intensity in a dark environment and 0.784 ± 0.08 db/klx at 36.8-53.9 klx light intensity. the response time of the sensor is 20.1 s and the recovery time is 30.3 s in the light intensity range of 0-53.9 klx [13]. The effects of different intensities and wavelengths of light sources on the photosensitive sensors are all quite different. (4) OLED module OLED, or organic light-emitting diode, is a self-luminous organic semiconductor material, which is widely used in a variety of display devices and lighting fields with its superior performance. OLED displays have the advantages of good viewing angle, high color saturation, fast response time, long life, and power-saving, so they are widely adopted in a variety of terminal display fields, such as smartphones, tablet PCs, and notebook computers [14]. The driver IC used in this screen is SSD1306, which has an internal boost function. SCL connects to microcontroller PA4 and SDA connects to microcontroller PA5. (5) Bluetooth module The Bluetooth module consists of two main parts: a microprocessor and a microcontroller. The microprocessor is used to implement control functions; the microcontroller is used to implement various other functions, such as data storage, data processing, digital output and analog output. In the field of communication, Bluetooth modules are widely used in mobile communication systems, including 3G/4G wireless communication systems, smart mobile terminals (PDAs), personal digital assistants (PDBs), and mobile multimedia. 3. System Software Design Fig 1. The main flowchart of the system (1) System main flow chart Turn on the power, the system is initialized. Long press the key switch to set the data threshold of temperature and humidity sensor and photosensitive sensor. The temperature and humidity sensor and photosensitive sensor will detect the temperature and humidity of the current environment and light intensity, and collect the data, and real-time transfer the collected data to the OLED display to show the data. When the sensor detects the temperature of the current planting environment, which is lower than the set temperature value, 29 the buzzer will alarm to remind the farmer to turn on the heating pad to heat up the planting environment to realize constant temperature control. When the humidity of the current planting environment is detected, and it is lower than the set humidity value, the buzzer will alarm to remind the farmer to turn on the water pump for watering to realize the saturation of the planting environment. When the current planting environment is detected weak light, the buzzer alarm reminds the farmer to turn on the light for replenishment, to realize the planting of plants with sufficient light absorption. The main flowchart of the system is shown in table 1. (2) Temperature and Humidity Sensor Modules DHT11 adopts a single bus design, after STM32 starts to start, DHT11 starts to collect temperature and humidity data, when the current ambient temperature and humidity does not change, the OLED display shows the data directly, and when it detects the change of the current ambient temperature and humidity, it re-collects the temperature and humidity data and displays it. The main temperature and humidity codes are listed below: { for(i = 0; i < 40; i++) { if(i % 8 == 0 && i != 0) j += 1; DHT11_DATA_IN();//data entry while(rt_pin_read(DHT11_DATA_PIN)); //data retrieval while(!rt_pin_read(DHT11_DATA_PIN)); rt_hw_us_delay(40); dht11_data_buffer[j] <<= 1; if(rt_pin_read(DHT11_DATA_PIN)); //data validation dht11_data_buffer[j] |= 0x01; else dht11_data_buffer[j] |= 0x00; } rt_exit_critical(); if(dht11_data_buffer[4]==(dht11_data_buffer[0] + dht11_data_buffer[1] + dht11_data_buffer[2] + dht11_data_buffer[3])) return ((((rt_uint16_t)dht11_data_buffer[0]) << 8) + dht11_data_buffer[2]); } (3) Bluetooth module Bluetooth Low Energy (BLE) is a wireless technology designed and marketed by the Bluetooth Special Interest Group. BLE is designed for low-power devices operating in the 2.4 GHz ISM (Industrial, Scientific and Medical) band. The goal of the technology is to connect devices over relatively short distances. It is currently a very popular protocol widely used in Internet of Things (IoT), Industry 4.0 and Smart Home [15]. Bluetooth specific code is given below: int bluetooth_init(void) { rt_err_t res; // Find Serial Devices usart1_serial = rt_device_find("uart1"); if(usart1_serial == RT_NULL) return -RT_ERROR; // Open the serial device res = rt_device_open(usart1_serial, RT_DEVICE_FLAG_INT_RX); if(res != RT_EOK) return -RT_ERROR; // Setting the receive callback function rt_device_set_rx_indicate(usart1_serial, uart_recv); return RT_EOK; } void bluetooth_set(char *bluetooth_data, int len) // Setting Bluetooth data { rt_device_write(usart1_serial, 0, bluetooth_data, len); } 4. Conclusion This system is a kind of intelligent agricultural environment control system based on the Internet of Things, which can collect, process and control the temperature, humidity, light, and other environmental factors in the greenhouse in real time according to the site environment, and through Bluetooth data transmission, you can intuitively view the temperature, humidity, light intensity and other data information in the greenhouse on the cell phone APP to realize real-time monitoring. The application of greenhouse environment intelligent control system not only saves energy, but also improves work efficiency and reduces human error. Greenhouse management is liberated from heavy physical labor, so that it is more engaged in technical management work, thus improving its economic and social benefits. This is of great significance to increase the income of farmers and ensure the safety of agricultural production in China. Acknowledgments This work was supported in part by Innovation and Entrepreneurship Training Program for College students of University of Science and Technology Liaoning. References [1] Patel S K, Sharma A, Singh G S. Traditional agricultural practices in India: an approach for environmental sustainability and food security[J]. Energy, Ecology and Environment, 2020, 5(4): 253-271. 30 [2] Su K, Wu J, Yan Y, et al. The functional value evolution of rural homesteads in different types of villages: Evidence from a Chinese traditional agricultural village and homestay village [J]. Land, 2022, 11(6): 903. [3] Zhang Xiu. Application of internet of things technology in modern agricultural water-saving irrigation[J]. Modern Rural Science and Technology,2024, (06):85-86. [4] HONGQI ZHANG, YAN ZHANG, CHEN ZHANG, et al. Development and application of big data platform for facility smart farm[J]. Journal of Shandong Agricultural University (Natural Science Edition),2024,55(03):295-303+475. [5] SUN Qiuju, QIN Hongwei. Accelerating the development of facility agriculture in China[J]. China Farmers' Cooperatives, 2024, (07):49-50. [6] Du Juan. Analysis of problems related to the promotion and application of Internet of Things in agriculture[J]. Science and Technology Information,2024,22(13):151-153. DOI:10. 16661 / j. cnki.1672-3791.2403-5042-7337. [7] Zhang Xianyang,Xie Shaochun,Ding Liming et al. Greenhouse temperature control system based on STM32[J]. Electronic Technology and Software Engineering,2020. [8] FAN Kaiyu, WANG Huan, FAN Xu et al. Design of Arduino- based hexapod robot for forest fire prevention[J]. Communication and Information Technology,2023. [9] Deng Pan. Research and design of intelligent security system based on internet of things [D]. Guangdong University of Technology, 2020. [10] YANG Junjin, FU Chenghua, DONG Ziqi. Research on mine ventilation fan monitoring system based on internet of things[J]. TV Technology,2015,39(01):139-141+145.2015.01.035. [11] Wang Guifang. Design and realization of intelligent controller for internet of things based on NB-IoT technology [D]. Xi'an Petroleum University,2020. [12] Ding Su-Ying. Research on the application of sensors in smart home system[J]. Journal of Weifang College,2023,23(02):40- 43. [13] Jiao J , Ma H , Qiao Y , et al. Design of Farm Environmental Monitoring System Based on the Internet of Things[J]. Advance Journal of Food Science & Technology, 2014, 6(3):368-373. [14] Tao Bairui,Yao Tangjian,Miao Fengjuan,Zang Yu. Passive RFID microstripphotosensitive sensor based on TiO2/rGO/ CuO composite[J]. Vacuum,2023,208. [15] Lorenc Augustyn,Szarata Jakub,Czuba Michał. Real-Time Location System (RTLS) Based on the Bluetooth Technology for Internal Logistics[J]. Sustainability,2023,15(6).