Share this

Agricultural greenhouse control system based on single-bus technology

2026-04-06 08:57:29 · · #1
Abstract: A low-cost microcomputer control system for agricultural greenhouse cultivation was designed using advanced sensors, and the hardware and software design methods are presented. Because the system adopts single-bus technology, analog signals are converted into digital signals at the measurement site, enabling long-distance measurement with high accuracy and application value. Keywords: Greenhouse; Single-bus; Control system 0 Introduction In greenhouse control systems, environmental factors such as air temperature, air humidity, light intensity, soil moisture, and soil temperature affect the growth and reproduction of organisms from different aspects and play different roles under different conditions. Therefore, the measurement of these parameters is particularly important. Traditional acquisition methods use one signal per channel. Due to the large number of parameters and points to be collected in a greenhouse, and the need for long-distance transmission of analog signals, data distortion is easily caused. In this system, the DS18B20 single-bus digital temperature sensor chip is used to achieve long-distance, multi-point measurement of air and soil temperatures. The analog signals from sensors such as air humidity, light intensity, and soil moisture are converted into digital signals by a single-bus A/D chip, and then transmitted to the microprocessor through the DS2480B single-bus driver. The system has a certain degree of intelligence. 1. Single-Bus Devices and Their Working Principle The system mainly uses a DS18B20 temperature sensor, a DS2450 A/D converter, and a DS2480B single-bus driver. The internal ROM of single-bus devices such as the DS18B20 temperature sensor and the DS2450 A/D converter contains a 64-bit photolithographically etched serial number, which is the device's address sequence code. The 64-bit photolithographic ROM is arranged as follows: the first 8 bits (28H for DS18B20, 20H for DS2450) are the product type identifier, also known as the family code; the next 48 bits are the device's own serial number; and the last 8 bits are the cyclic redundancy check (CRC) code (CRC = x8 + x5 + x4 + 1) of the preceding 56 bits. The purpose of the photolithographic ROM is to ensure that the address of each single-bus device is unique, allowing multiple single-bus devices to be connected to a single bus. The DS2480B single-bus driver performs the conversion to single-bus operation, improving the driving capability of the single bus. The microprocessor can control the DS2480B to drive all online single-bus devices. 2. System Hardware Design 2.1 Digital Temperature Sensor DS18B20 The DS18B20 is a digital temperature sensor launched by Dallas Semiconductor, USA. It follows a single-wire protocol and its working principle utilizes the relationship between the frequency of a temperature-sensitive oscillator and temperature changes, measuring temperature by counting the oscillation cycles. It supports a voltage range of 3V to 5.5V, can communicate bidirectionally with the processor digitally, has a wide temperature measurement range (-55℃ to +125℃), a wide operating temperature range (-10℃ to +85℃), and high resolution (reaching 0.0625℃ when set to 12-bit conversion mode). The field temperature is directly transmitted digitally via a single-wire bus. The DS18B20 has two bytes of RAM to store the converted temperature value. The second byte is the two's complement of the lower 8 bits of the temperature value (called A), and the first byte contains the sign bit and the higher 3 bits of the two's complement of the temperature value (called B). The data format is as follows: Temperature algorithm: ① SSSSS=11111B, D=-1; SSSSS=00000B, D=1; minimum resolution is 0.0625℃. ② When D=1, the temperature value is: T=[(B and 7) * 256 + A] * 0.0625 ③ When D=-1, the temperature value is: T=D * [(B and 7) * 256 + A] * 0.0625 2.2 Single-bus A/D converter (DS2450) The DS2450 is a single-bus 4-channel successive approximation A/D converter manufactured by DALLAS, namely A, B, C and D analog voltage input channels. Its input voltage range, conversion accuracy bits, and alarm threshold voltage are programmable; each channel has its own memory to store parameters such as voltage range settings, conversion results, and threshold voltage. The DS2450 has 24 interconnected 8-bit memory addresses, which can be divided into three pages, each 8 bytes. Page 0 is the A/D conversion result memory. Each channel occupies 2 bytes (16 bits), and this page is cleared to 0 upon power-on reset. 00H and 01H store the conversion results for channel A, 02H and 03H for channel B, 04H and 05H for channel C, and 06H and 07H for channel D. Page 1 is the A/D conversion control and status memory. 08H and 09H correspond to channel A, and so on for the remaining channels. Page 2 is the high/low limit alarm value memory for each channel. 10H stores the 8-bit low threshold alarm value for channel A, 11H stores the 8-bit high threshold alarm value for channel A, and so on for the remaining channels. The DS2450's channel selection word and preset control word are used to select the channels participating in the A/D conversion and to initialize the conversion result memory before conversion. It is worth noting that if the DS2450 is powered by VCC, then 40H must be written to address 1CH after power-on to keep the analog circuit permanently in working state. Due to space limitations, readers can refer to reference [1] for detailed information. 2.3 Single-bus driver DS2480B The DS2480B is a bridge that converts the serial interface to the 1-Wire network protocol. As long as the host has a common serial communication UART, it can generate a 1-Wire waveform with strict timing and voltage slew rate control through this bridge. The DS2480B accepts the instructions and data to be sent, performs the 1-Wire operation, and returns the result to the host (see reference [2] for detailed information). 2.4 System schematic Considering the driving capability of the single bus, a star structure is adopted, that is, several single-bus devices are connected on several single buses respectively. The hardware is based on AT89C55WD, and the system schematic is shown in Figure 1. It mainly includes the button module, display module, signal input, control output, clock, serial port expansion and storage circuits. LEDs are used to cycle through the parameters of each measurement point, buttons are used to set given parameters, and the AT24C256 is used to store the serial number (device address of the measurement point) of each single-bus device and some important parameters. GM is used to expand the serial ports. The three expanded serial ports are used for conversion to 1-Wire network protocol, LED display, and communication with the host computer, respectively. [align=center] Figure 1 System Schematic[/align] 3 Software Design 3.1 Bus Structure Software Design In this system, multiple single-bus devices are connected to a single bus. To operate any single-bus device, the address of the device, i.e., the serial number, must first be obtained. There are generally two methods to obtain the device address. The first method is to write a separate program to read the address of each measurement and control point device in turn and store it in the microcontroller program table [3]. However, when a device of the measurement and control point is damaged, it is necessary to read the new single-bus device address, replace the bad device, modify the main program microcomputer program, and re-solidify the main program. The second method is to complete the online single-bus device address through the binary tree algorithm, but the system cannot specifically determine the single-bus device address of each measurement point. The system adopts the method of sequential power-on and completes the online single-bus device address of each measurement point through the binary tree algorithm (see reference [4]). It is easy to maintain. The method is as follows: (1) Turn on the power supply of the single-bus device of measurement and control point 1, turn off the power supply of other measurement and control points, start the online address search operation through the "Search" key, and the LED displays "1", indicating that it is searching for the address of the single-bus device of measurement and control point 1. Store the address of the single-bus device of measurement and control point 1 in AT24C256. (2) After the search for measurement point 1 is completed, the LED displays "2". Turn on the power supply of the single-bus device of measurement and control point 2. The system searches for the address of the single-bus device of measurement and control point 2 online according to the binary tree algorithm and stores the address of the single-bus device of measurement and control point 2 in AT24C256. (3) After the search for measurement point 2 is completed, the LED displays "3". If there is a measurement and control point 3, turn on the power supply of the single-bus device of measurement and control point and search for the device address of measurement and control point 3, and so on; if not, press the "OK" button. 3.2 Anti-interference software design The system adopts three anti-interference methods: (1) Applying the on-chip watchdog of AT89C55WD; (2) Applying software traps; (3) Adopting CRC fault tolerance technology. 4 Conclusions The innovative points of this paper (hardware and software): (1) The hardware is all customizable and flexible in configuration. Each module can run independently without relying on other modules. The operation mode can be automatic or manual. The system can be networked using the 485 asynchronous serial communication bus to adapt to the different needs of users of different levels. According to different configurations, the system can adapt to large-scale users with high degree of automation and distributed characteristics, as well as various small and medium-sized individual applications. (2) The single-bus structure in the field allows all signal acquisition to be connected to a single bus consisting of only two wires. Since the changes of various parameters in agricultural greenhouses are relatively slow, serial time-division multiplexing can be used to solve the problem of transmitting a large amount of field information, which greatly simplifies the field forward channel circuit structure. (3) The fuzzy decoupling algorithm is used to deal with the strong coupling problem between field parameters. The matrix decoupling result is converted into a related result linked list, and the decoupling output result is located by pointer variables. References [1] Dallas Semiconductor Data Books. Dallas Semiconductor Corporation 1995 [2] Li Huayi, Wang Daohui. Application of DS2480 to realize the serial interface between RS-232 and single bus [J], Microcomputer Information, 2002.12:45-46 [3] Wen Zhexiong, Luo Zhongliang. Design of single bus multi-point distributed temperature monitoring system [J], Microcomputer Information, 2005.06s:63-65 [4] Yan Weimin, Wu Weimin. Database Structure [M]. Tsinghua University Press, 1998
Read next

Research on Comprehensive Performance Testing System for Vehicle Clutch

Abstract : This paper presents a measurement and control system utilizing the combined operation of a microcomputer and ...

Articles 2026-02-22