Hardware design of greenhouse intelligent controller based on single chip microcomputer

Publisher:ching80790Latest update time:2014-10-30 Source: ofweek Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  In recent years, greenhouse environmental control has been studied and applied accordingly at home and abroad. Most of the existing intelligent greenhouse system hardware in China is imported from abroad. The foreign system has undergone years of development and improvement and is relatively mature and advanced in technology. However, some problems have arisen in its application in my country, such as large size, high energy consumption, poor greenhouse cooling, and inadaptability to use in my country. From the perspective of economic benefits, due to its large equipment investment and high operating costs, it generally suffers losses. "Research and Demonstration of Integrated Application of Forest Seedling Factory Production Environment Control Equipment and Automatic Control" is an intelligent greenhouse monitoring system independently developed by us. The system has a certain role in promoting the realization of refined and automated agricultural production, improving the efficiency of agricultural production and the quality of agricultural products.

  The technical requirements for system hardware are as follows:

  (1) Real-time data collection, data signal processing, and data analysis of on-site air temperature and humidity, soil matrix temperature and humidity, and light intensity. The data collection delay is less than 3 minutes, and the data accuracy reaches 10 bits. According to the actual growth conditions of crops, the temperature control accuracy is less than 3°C, and the humidity control accuracy is less than 10% RH.

  (2) Establish and use a scalable master-slave controller communication mechanism with an accurate communication distance of up to 1.2 km.

  (3) Use learnable and adaptive control mechanisms to achieve precise control.

  (4) The entire system can be used reliably for more than 10 years within the humidity range of 0%-100% RH.

  (5) Annual temperature drift < 0.1°C, annual humidity drift < 1% RH.

  1 Solution design and device selection

  1.1 Solution design

  According to the project and specific technical indicators, RS-485 communication protocol is selected for lower communication. RS-485 is a bidirectional, half-duplex communication protocol that meets the requirements of a true multi-point communication network, and it stipulates that 32 drivers and 32 receivers are supported on a single bus (2 lines). Some RS-485 transceivers can modify the input impedance to allow up to 8 times more nodes to be connected to the same bus. Due to its excellent performance, simple structure, and easy networking, it can save signal lines when multiple stations are interconnected, facilitating high-speed and long-distance transmission.

  In order to ensure the reliability of the greenhouse control system, the system is designed as a three-level master-slave control system. The ARM series single-chip microcomputer is used as the intermediate master controller, and the lower-level data acquisition and control unit is modularized to facilitate the expansion of the system. The upper server directly faces the network and saves the lower-level collected data. The main controller is selected to have its own TCP/IP function to communicate with the server, and has its own RS485 communication function to connect to the lower-level data acquisition and control unit. The specific structure is shown in Figure 1.

  

  Figure 1 System structure diagram

  1.1.1 Collector Function

  (1) Timely and reliable collection of greenhouse temperature, humidity, soil temperature, humidity, and light intensity data at the greenhouse site.

  (2) Perform preliminary data collection and processing and complete data collection and storage twice.

  (3) Receive and identify instructions from the main controller and transmit data.

  1.1.2 Controller Function

  (1) Identify the control instructions of the main controller.

  (2) Execute control instructions.

  1. 1.3 Main controller function

  (1) Measurement data collection and monitoring

  Communicate with the measurement terminal through the 485 serial port to collect greenhouse environmental indicators monitored by the measurement terminal. If the data measured by the terminal exceeds the preset environmental parameter indicators, the main controller will implement monitoring alarms to remind observers that the greenhouse environment exceeds the indicator range.

  (2) Measurement data storage and transmission

  The data of each terminal is stored in the external SD card of the main controller, which is required to be able to store the measurement data of each terminal for more than one month. It can also communicate with any PC connected to the local area network through Ethernet to transfer the stored data to the PC for storage.

  (3) Ethernet communication

  The main controller and the server communicate via Ethernet. The selected main controller needs to have an Ethernet interface to achieve Ethernet communication. The system has a TCP/IP protocol stack and can build application layer network communication, HTTP web server function, TFTP, FTP file transfer function on the TCP and UDP protocol layers.

  (4) Terminal control

  The main controller controls the measurement characteristics of the measurement terminal, sets the environmental parameter sampling interval, parameter index threshold, etc. Complete the control theory calculation in time according to the detection data and control objectives. Send control instructions to the lower controller. The main controller is required to have two operation modes: on-site control and remote control. The main controller can be operated on-site to view the terminal measurement data, and the main controller can be used as a WEB server to display the measurement data on the web page provided by the server, and CGI function is added to the web page, so that users can achieve remote control through the web page.

  1.1.4 Server Functions

  (1) Network demonstration website server, storing lower-level collected control data and refining and improving expert control system.

  (2) Network communication with each main controller.

  1.2 Sensor selection

  According to the technical indicator requirements, the sensor devices are selected as shown below.

  (1) PTS-2 Ambient Humidity Sensor

  Supply voltage 4VDC; Humidity range 0 ~ 100%; Humidity resolution 0.1% RH; Output range 1 ~ 4VDC; Accuracy ± 2% (T > 0℃); Stability less than 1%RH/year Operating voltage:

  (2) Environment and soil temperature sensor DS18B20

  It supports the "one-wire bus" interface, the measurement temperature range is -55°C to +125°C, and the accuracy is ±0.5°C in the range of -10 to +85°C.

  The accuracy error of DS18B20 is ± 2°C. The field temperature is directly transmitted in a digital way of "one-wire bus", which greatly improves the anti-interference ability of the system.

  Suitable for on-site temperature measurement in harsh environments, such as: environmental control, equipment or process control, temperature measurement consumer electronic products, etc.

  (3) TDR-3 soil moisture sensor

  TDR-3 soil moisture sensor is a high-precision and high-sensitivity sensor for measuring soil moisture.

  Its technical parameters are: Range: 0 ~ 100% (m3 /m3); Accuracy: ± 2% (m3 /m3) in the range of 0 ~ 50% (m3 /m3); Measuring area:

  90% of the impact is within the cylinder with a diameter of 3cm and a length of 6cm surrounding the central probe; Stabilization time: about 10 seconds after power-on; Response time: the response enters the steady-state process within 1 second; Working voltage: 4.5~5.5VDC, typical value 5.0VDC; Working current: 50~70mA, typical value 60mA; Output signal: 0~2.5V; Sealing material: ABS engineering plastic; Probe material: stainless steel; Cable length: standard length 5m, maximum length 20m.

  (4) TBQ-6 Light Intensity Sensor

  TBQ-6 indoor light intensity sensor adopts advanced circuit module technology to develop transmitter, which is used to measure the ambient light intensity, output standard voltage and current signals, small size, easy installation, good linearity, long transmission distance, strong anti-interference ability. It can be widely used in the measurement of light intensity in environment, breeding, construction, buildings, etc., with adjustable range.

  Its technical parameters are: Range: 0 - 200Klux; Power supply voltage: 24VDC /12VDC; Wavelength measurement range: 380nm - 730nm; Output signal:

  4-20mA; Accuracy: ±5%; Working environment: Temperature -30-60℃, Humidity 0-90% RH.

  1.3 Controller selection

  1.3.1 Collector Selection

  The lower-level collector uses C8051F350 for the following reasons:

  (1) The C8051F350 device is a fully integrated mixed-signal MCU on -chip. It has a fully differential 24-bit analog-to-digital converter (ADC) with on-chip calibration. Two independent decimation filters can be programmed to a sampling rate of 1 kHz; the internal 2.5 V voltage reference can be used, or a differential external reference can be used for ratiometric measurements [3].

  (2) The C8051F350 includes an extended interrupt system that supports 12 interrupt sources, each with two priority levels. The allocation of interrupt sources between on-chip peripherals and external input pins varies from device to device. Each interrupt source can have one or more interrupt flags in an SFR.

  (3) The C8051F350 series MCU has an SMBus/I2C interface, a full-duplex UART with enhanced baud rate configuration, and an enhanced SPI interface. Each serial bus is fully implemented in hardware and can generate interrupts to the CIP-51, so very little CPU intervention is required. It is convenient to communicate with the RS485 bus interface.

  1.3.2 Controller Selection

  The lower controller uses C8051F310 for the following reasons:

  (1) The C8051F310 has 17 port I/Os; all are 5V resistant and have high current sinking capability. Pins selected as digital I/O can also be configured as push-pull or open-drain outputs. There are 4 general-purpose 16-bit counter/timers, which are more powerful and require less CPU intervention than the standard 8051 counter/timers. Each capture/compare module can output either an 8-bit or 16-bit pulse width modulator at high speed. These features ensure effective output control relays as controllers [4]. The C8051F310 extended interrupt system provides 14 interrupt sources to the CIP-51, allowing a large number of analog and digital peripherals to interrupt the microcontroller. The C8051F310 contains 16KB of FLASH program memory to meet usage. [page]

  (2) The C8051F310 series MCU has an SMBus/I2C interface, a full-duplex UART with enhanced baud rate configuration, and an enhanced SPI interface. Each serial bus is fully implemented in hardware and can generate interrupts to the CIP-51, requiring very little CPU intervention and facilitating communication with the RS485 bus interface.

  (3) The C8051F310's extended interrupt system allows a large number of analog and digital functions to work independently, interrupting the controller only when needed. An interrupt-driven system requires less MCU intervention and has higher execution efficiency. It contains 8KB of FLASH program memory to meet usage.

  2. Greenhouse control system hardware design

  The hardware system design selects typical circuits as much as possible and conforms to the conventional usage of the single-chip microcomputer, laying a good foundation for the standardization and modularization of the hardware system. The hardware structure is considered together with the application software solution. The hardware structure and the software solution will have mutual influence. The principle of consideration is: the functions that can be realized by software should be realized by software as much as possible to simplify the hardware structure. However, it must be noted that the response time of the functions realized by software is longer than that of the direct hardware implementation, and it takes up CPU time. Therefore, when choosing a solution, these factors should be taken into account, and the relevant devices in the whole system should be matched as much as possible.

  2.1 Power circuit design

  The main function of the power supply circuit is to provide power supply for the chip of the acquisition module and the control module. The requirements include the digital voltage 3.3V required by the microcontroller, the voltage 5V and 12V required by the sensor, and the analog protection voltage 3.3Av. The specific circuit is shown in Figure 2.

  Figure 2 Power supply design circuit diagram

  Figure 2 Power supply design circuit diagram

 

  2.2 RS-485 communication interface circuit design

  The main function of the RS-485 interface circuit is to convert the transmission signal TXD from the microprocessor into a differential signal in the communication network through the "transmitter", and also to convert the differential signal in the communication network into the RXD signal received by the microprocessor through the "receiver". At any time, the RS-485 transceiver can only work in one of the two modes of "receiving" or "transmitting". Therefore, a receive/transmit logic control circuit must be added to the RS-485 interface circuit. In practical applications, the response rate of the optocoupler device in the circuit will affect the communication rate of the RS-485 circuit. Therefore, the optocoupler device 6N136 with a faster response speed can be selected according to specific needs. 6N136 is an optocoupler device with excellent characteristics produced by Toshiba Corporation of Japan, which encapsulates a highly infrared light-emitting tube and a photosensitive triode. 6N136 has the advantages of small size, long life, strong anti-interference, high isolation voltage, high speed, and compatibility with TTL logic level. The specific circuit is shown in Figure 3.

  

  Figure 3 RS-485 interface circuit diagram

  3 System Hardware Anti-interference Design

  The interference in hardware circuits mainly includes crosstalk between signal lines, potential difference caused by multi-point grounding, parasitic oscillation, component thermal noise, influence of contact potential, coupling between adjacent loops, influence of digital ground and analog ground, etc. In this system, specific hardware anti-interference design is mainly carried out in the following directions.

  3.1 Power supply

  The anti-interference design of the power supply is the key to the anti-interference of the system hardware. If the power supply is well made, the anti-interference of the entire circuit will be solved by more than half. Because the power consumption of the acquisition unit and the control unit is relatively small, the required 12V, 5V, and 3.3V DC power supplies are all implemented with high-performance common DC voltage conversion chips. And the three-level voltage requirements are connected in series step by step with polar capacitors to stabilize the voltage, so that the 3.3V regulated power supply has better performance. The system uses a single-chip microcomputer with an operating voltage requirement of 2.7V-3.6V to provide a high-quality DC power supply to reduce the interference of power supply noise on the single-chip microcomputer. The structure is shown in Figure 4.

  

  Figure 4 Power supply structure diagram

  3.2 Interface circuit

  The anti-interference of the interface circuit is mainly to suppress the interference source, that is, to reduce the du/dt and di/dt of the interference source as much as possible. The most effective way to reduce du/dt is to connect capacitors in parallel at both ends of the interference source, while to reduce di/dt is to connect inductors or resistors in series with the interference source loop and add freewheeling diodes, etc.

  (1) A/D input channel

  The A/D input channel is connected to an RC absorption circuit to eliminate the du/dt effect of the interference source. The A/D conversion reference voltage of the acquisition unit is 3.3v. During the design, diodes are used to connect 3.3v and the ground for limiting protection. Accurate measurement values ​​are obtained by grounding. The specific circuit is shown in Figure 5.

  

  Figure 5 A/D conversion interface circuit

  (2) Relay control output

  The control relay should eliminate the back electromotive force interference when the coil is disconnected. The system design uses optocoupler isolation to suppress the intrusion of interference that may be caused by the relay. Optocoupler is a photoelectric combination device. The input end is a light-emitting device (light-emitting diode) and the output end is composed of a light receiving device (phototransistor). When the working current reaches the working current of the light-emitting diode, the diode converts the electrical signal into an optical signal. The phototransistor receives the optical signal emitted by the light-emitting diode and converts it into an electrical signal. The entire transmission process is completed through an electrical-optical-electrical conversion and is completely isolated in the circuit. The system design relay isolation channel is shown in Figure 6.

  

  Figure 6 Relay isolation channel

  3.3 Circuit board design

  Reasonable design of the system circuit board can effectively cut off the propagation path of interference and suppress the interference source. At the same time, it can also improve the anti-interference ability of sensitive components (such as single-chip microcomputers, digital ICs, A/D, D/A and other objects that are easily interfered with) [7]. The following measures are mainly taken in this system design:

  (1) Reasonable partitioning of the circuit board, such as strong and weak signals, digital and analog signals. Keep interference sources away from sensitive components as much as possible. High-power devices should be placed at the edge of the circuit board as much as possible.

  (2) When wiring, minimize the area of ​​the loop to reduce inductive noise; the power line and ground line should be as thick as possible. In addition to reducing the voltage drop, it is more important to reduce coupling noise.

  (3) All unused microcontroller pins should be connected to the power supply through pull-up resistors.

  (4) Place the crystal oscillator and the microcontroller pins as close as possible, isolate the clock area with a ground wire, and ground and secure the crystal oscillator casing.

  (5) Use ground wire to isolate the digital area from the analog area. The digital ground and analog ground should be separated and finally connected to the power ground point to form a "star" shape.

  (6) The cross section of the signal line should be selected according to the principle of voltage drop. The signal lines of the measurement and control device mostly transmit weak current signals. Although the current on the signal line is not large, it is generally long. If the wire diameter is too thin, it will inevitably cause excessive voltage drop. Utilize the space of the circuit board and choose larger diameter wiring in the system.

  4 Conclusion

  According to the functional requirements of greenhouse intelligent control system design, the three-level control structure of the system is designed. According to the technical indicators of the system, appropriate greenhouse parameter sensors, data collectors and controllers are selected, and the communication function is analyzed to select RS485 communication protocol. The hardware circuit and anti-interference measures are determined to ensure the system function. Since the system was put into operation in the E1 greenhouse of Ningxia National Economic Forest Seedling Rapid Propagation Engineering Technology Research Center in April 2010, all indicators have met the design requirements and the effect is good.

Reference address:Hardware design of greenhouse intelligent controller based on single chip microcomputer

Previous article:Design of Doppler blood flow meter system based on 51 single chip microcomputer
Next article:Design of a New Multi-rate Single-phase Watt-hour Meter Based on AT89S52 Single-chip Microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号