Development of a Greenhouse Environmental Control System Based on RS-485 Bus
2026-04-06 07:40:12··#1
Abstract: Crop growth requires a suitable environment. Under a controllable environment, the desired crops can be planted regardless of season or region. Control systems provide the foundation for achieving this goal. The control system design adopts a master-slave mode, based on the RS-485 bus protocol, and designs fully digital sensors and measurement and control input/output modules; COM component technology is used to design the data acquisition, control algorithm, and control output components of the application software. The entire system has been tested and operated, proving that it meets the requirements for controllable environment regulation. Keywords: Fieldbus, Distributed System, COM Component, Controllable Environment, Intelligent Node 1 Introduction Facility agriculture has become an important area of agriculture in China. It aims to create a controllable environment across geographical regions or time zones to provide crops with favorable living conditions. During the Ninth Five-Year Plan period, the state launched a demonstration project for factory agriculture, which achieved certain successes after five years of demonstration. One of the common problems in facility agriculture is environmental regulation, which attracted great attention from the facility and control fields during the Ninth Five-Year Plan period. Experts in these fields provided the Ministry of Science and Technology with many constructive strategic reports on the development of factory agriculture. Therefore, during the Tenth Five-Year Plan period, the state launched a key technology research and demonstration project for factory agriculture. Regarding a common problem in facility agriculture - environmental regulation, a research and demonstration project on key technologies for intelligent control of greenhouse environment was launched. One of the main research contents of this project is to study the control system based on bus technology, which provides a hardware foundation for greenhouse environmental regulation. This paper introduces the design principle and performance test method of the system. 2 System Description The system consists of a host computer, RS-485 communication bus, measurement sensors, control input and output modules, etc. As shown in Figure 1. The core part of the host computer software consists of a data acquisition and processing module; a control algorithm module; an output control module; a communication processing module and a real-time database, as shown in Figure 2. [align=center] Figure 2 Structure of the core part of the control software[/align] As can be seen from Figure 2, the real-time database [1] is the central link of the entire host computer control station software system. It is equivalent to a carrier, which transmits the information (including status, control, and data) of each part from one execution module to another execution module. This can also be understood as a warehouse, where data collected from various channels and uploaded from the network is stored in a real-time database. When other modules (such as output modules and control algorithms) need data, they can retrieve it directly from the real-time database instead of directly from the sensors. Intermediate results from calculations are also stored in the real-time database. Another function of the real-time database is to enable data sharing. For example, if several control algorithms need a particular sensor signal, without a real-time database, this data must be input from the channel each time it is needed. Furthermore, each module must repeatedly input, convert, and store this data. With a real-time database, only one input module needs to periodically input the information at that point, complete the conversion and limit conversion, and store the result in the database. This way, no matter how many control algorithms need this data, they can simply copy it from the real-time database. Software-aided functions include: storage of historical data; display and management of process screens; management of alarm information; management and printing of records and reports; display of parameter lists; and human-machine interface control. 3 Hardware System Design The hardware system is shown in Figure 1. After selecting the host computer, the RS-485 bus is configured reasonably according to the control site conditions. The main task is to develop hardware devices: intelligent sensors, I/O input/output modules, and analog input/output modules. Since the module communication protocol adopts RS-485, the communication reliability issue is particularly important. RS-485 is a master-slave communication mode. To ensure reliable data acquisition and control input/output, an interrupt software module must be designed. When the module interrupt is activated, all data acquisition and input/output tasks should be completed in the interrupt program [2]. 3.1 Intelligent Sensor Module The intelligent sensor module has temperature and humidity sensors and light intensity sensors. The design flowchart is shown in Figure 3. [align=center] Figure 3 Sensor Design Flowchart[/align] The main software flow is shown in Figure 4. All the required tasks are completed in the interrupt. [align=center] Figure 4 Sensor software interrupt flowchart[/align] 3.2 Input/output module There are four types of this module: (1) Digital output module: 8 output points; adopts opto-isolation technology; has soft and hard watchdogs; drive capability: maximum output current 500MA; communication protocol RS-485; power supply: 24VDC. (2) Digital input: 8 input points; communication protocol RS-485; adopts opto-isolation technology; has soft and hard watchdogs; detects input voltage 5~48VDC; power supply: 24VDC. (3) Analog input module: 8 input channels; has soft and hard watchdogs; input signal 0~5VDC or 4~20MA; communication protocol RS-485; resolution 8-bit or 12-bit; power supply: 24VDC. (4) Analog output module: output channel 2; output signal 4-20MA; resolution 8-bit or 12-bit; communication protocol RS-485; power supply: 24VDC. Due to space limitations, the hardware design principle flow and software design flow are omitted. 4 Software system design The core part of the application software consists of several controls, as shown in Figure 1, data acquisition component; control algorithm component; control output component, etc. The design principle of the control algorithm component is introduced here. 4.1 COM component technology The use of COM component technology brings flexibility to users. A COM component is a unit that executes program code, such as a *.EXE, *.DLL, *.OCX file. COM components conform to the COM specification used to provide objects. COM components display objects that can be used by other applications [3]. Three types of COM components can be created using Visual Basic: ActiveX control, Active document, COM executable and DLL. The following describes how to create the intelligent control algorithm Intell_algor.DLL. 4.2 Generation Method of the Intell_algor.DLL Algorithm Library The algorithm library includes many algorithms, such as intelligent PID algorithms, various algorithms based on genetic technology, fuzzy control algorithms, neural control algorithms, etc. The fuzzy control algorithm is described as an example. The process is shown in Figure 5. [align=center] Figure 5 Fuzzy Control Component with Optimizer[/align] Because a two-dimensional fuzzy algorithm is used and this algorithm is flexible—adapting to the requirements of different controlled objects or time-varying objects—the input information includes quantization factors k[sub]e[/sub], k[sub]ec[/sub], scaling factor k[sub]u[/sub]; input quantization levels p, q, output quantization level r; allowable error and error change rate Ena_E; control time interval Int_T; setpoint parameter Set_P, real-time acquisition parameter Samp_P, and previous sampling parameter Samp_P0. The output information of Intell_algor.DLL has two p, q. The control table is a control table independent of the component. The output quantization level r can be obtained by looking up the control table from p, q, and then output to the actuator after defuzzification. The control table optimizer can run online or offline, depending on the actual situation. For the principles, optimization methods, and programming specifications of two-dimensional fuzzy control, refer to references [4][5]. The compiled Intell_algor.DLL needs to be registered in advance before use. The registration method is referenced in reference [3]. 5 System Testing The system test includes two parts: one is the reliability assessment of network operation; the other is the assessment of the control algorithm of this system. The system has 14 data acquisition nodes, including four temperature and humidity sensor nodes; four output nodes; two input nodes; two light sensor nodes; one wind speed sensor node; and one sensor node. The test period is from January 27, 2003 to February 8, 2003. Data from all nodes is collected, with a sampling time of 5 seconds. Data is recorded without any processing. There was one network outage, which lasted for 25 seconds. Random bit errors occurred about 3 times a day at each node. After simple software processing, the above situation did not occur. The control algorithm was tested by regulating greenhouse environmental factors, specifically temperature. Initial data analysis over several days revealed gaps in fuzzy control. After component improvements, the system ran normally for nearly five days. 6. Conclusion The development of this system provides a foundation for the controllable environment and enhances the flexibility of control system construction. The developed intelligent sensors and measurement and control modules are designed based on network technology. The core of the developed application software utilizes COM component technology, making it user-friendly and enabling the development of user-friendly application software in a short period. After nearly six months of operation, the entire system has proven that the hardware and software design is reasonable and meets user needs. References [1] Wang Changli, Liao Daowen. Design and Application of Distributed Control System [M]. Beijing: Tsinghua University Press, 1993 [2] He Limin. Design of Single-Chip Microcomputer Application System [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 1990 [3] Li Hai. Popularization of Visual Basic Programming: ActiveX Control [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2000 [4] Wang Lei, Wang Weimin. Fuzzy Control Theory and Application [M]. Beijing: National Defense Industry Press, 1997 [5] Zhou Changfa. Numerical Algorithm for Science and Engineering [M]. Beijing: Tsinghua University Press, 2002