A desktop-level micro-plant factory suitable for laboratory or household is developed by using a low-power and high-performance STM32 microcontroller with ARM as its core.The micro plant plant factory is a concentration of the technology of large plant factory. It can control temperature and humidity accurately, light intensity and light quality ratio and nutrient circulation in a small space, providing the most suitable growth environment for plants.The system uses high-power RGB LED as lighting source. Compared with traditional lighting facilities, LED light source has the advantages of high efficiency, high brightness and long life.Because the high power RGB LED works for a long time and has a high calorific value, the water-cooled heat dissipation system and nutrient circulation system are added after the lamp set. It not only uses the heat emitted, but also reduces the temperature of the LED, prolongs its service life, and saves energy and environmental protection.In recent years, with the continuous progress of modern agricultural technology, plant factories and related technologies have also developed rapidly.The development of plant factories can not only meet people’s demand for safe and pollution-free crops, but also help to solve many social problems such as the reduction of cultivated land and food shortage caused by environmental pollution, population increase [1-2].Micro-plant factory is the concentration of large plant factory technology. It can accurately control the environmental factors needed for plant growth through intelligent control system in a small enclosed space, providing a suitable temperature and humidity, sufficient light and nutrients growth environment for plants.In Japan, the Netherlands, the United States and other advanced plant factories technology countries, not only the Internet of Things [3], temperature difference power generation [4] and other advanced technology applications in plant factories, but also household-level micro plant factories have been developed and widely used.It can not only purify indoor air and beautify living environment, but also provide green, organic, safe and pollution-free vegetables to meet people’s daily needs [5].However, due to the late start of plant factory research and the lack of mature technology in China, the development and application of micro plant factories are still in the stage of research and exploration [6].The traditional plant factory control system mostly uses PLC as the main controller, but the volume of PLC is too large, which is not conducive to the miniaturization of plant factory [7].Aiming at the above problems, this paper designs a micro plant plant factory control system based on embedded controller.Because the processor of ARM core has the advantages of low power consumption and high processing speed, it is very suitable for use in embedded system. So this paper chooses STM32F103 MCU based on ARM Cortex-M3 core as the main control chip of the system.The whole control system is divided into single-chip computer system, human-computer interaction system, environmental control system, sensor system and data storage system.The overall structure of the control system is shown in Figure 1.The human-computer interaction system consists of LCD screen and touch screen.The screen adopts a 3.2 inch TFT LCD screen, which can display the environmental factors information and control parameters of the system in real time.The 4-wire resistance touch screen driven by IC can be controlled by XTP2046 touch screen.
It can interact with human and modify control parameters in real time.The sensor system includes light intensity sensor, color sensor, temperature sensor, humidity sensor and concentration sensor. The number of sensors is optimized to 10. There are two light intensity sensor, color sensor and concentration sensor, and four temperature and humidity sensors, which are evenly distributed in the upper and lower layers [8].Light intensity and light quality proportion information can be collected by light intensity sensor and color sensor; temperature and humidity sensor can accurately collect air temperature and humidity information; CO2 sensor can real-time detect the concentration of CO2 in the box.STM32 MCU is the core of the whole control system. By processing and analyzing the temperature, humidity, light intensity and other information collected by sensors, it sends commands to control the switch-on of relays, the brightness of LED and the speed of pumps, so as to coordinate the work of various environmental control agencies, thus forming a suitable plant in the micro-plant factory. Long environment.STM32 microcontroller sends data acquisition commands to each sensor at regular intervals. The sensor receives the commands and sends the data to the microcontroller. After analysis and processing, the data is first stored in SD card. Then, according to the threshold value of environmental factors required for plant growth, the relays are judged, and then the pumps and heating are controlled. Opening or closing of pipes, refrigerators and other equipment, and changing the point-to-space ratio of PWM wave to control the brightness of LED light-compensating lamp.Because STM32 microcontroller continuously circulates the above process, continuously detects and controls environmental factors, thus constitutes a closed-loop control system.Light is one of the most important environmental factors affecting plant growth and development. Plant growth, morphogenesis and gene expression play an important regulatory role [9].Plants are always in a changing light environment throughout their growth and development cycle.This requires that the light source inside the micro plant factory can adjust different light intensity and allocate different proportion of light quality according to the needs of plants.Traditional artificial light sources mainly include incandescent lamp, fluorescent lamp and sodium lamp, but these light sources have disadvantages such as low luminous efficiency, high energy consumption and spectral mismatch [10-11].As a new generation of light source, the fluctuation of half-wavelength of LED is less than 30 nm, which can realize the setting of high-purity monochrome light. At the same time, it can also be accurately matched to form a spectrum that basically coincides with plant photosynthesis [12].In addition, the LED light source has high utilization rate of light energy and good energy-saving effect, which provides high quality artificial light source for agricultural lighting production and application, especially in plant factories and plant supplementary lighting fields.Therefore, the system uses a high brightness RGB LED light group to supplement the light for the whole system. The proportion of light quality and light intensity can be accurately controlled by PWM control, which is conducive to improving crop yield.The gas exchange between CO 2, O 2 and other gases in the internal environment of micro-plant factories is controlled by circulating fans.The structure of the circulating system is shown in Figure 2.The external gas enters the gas preparation area through the external circulation fan, then adjusts the air to the appropriate temperature and humidity, then opens the internal circulation fan, and sends the air into the plant factory.The opening and closing of the circulating fan are controlled by timing.The internal temperature and humidity control is based on the pre-set threshold automatic control.When the temperature is lower than the set value, turn on the heater, and the hot air moves upward from the bottom of the plant plant plant plant plant, and distributes the hot air evenly through the fan. When the temperature is too high, turn on the cooler and repeat the above process. Similarly, the humidity follows the above control mode.Microplant factories rely on nutrient solutions to provide nutrients for plants.So the velocity and temperature of nutrient solution in plant root also affect the growth of plant.The structure of nutrient circulation system is shown in Figure 3.The velocity of nutrient solution is controlled by the speed of the pump at the inlet and outlet pipes.Velocimeter in plant plant plant transmits velocity information to STM32 microcontroller. After analysis and treatment, the controller controls the speed of water pump through PWM, thus controlling the flow rate of nutrient solution.The temperature control of nutrient solution is realized by opening or closing heaters and refrigerators.Because the high brightness LED lamp group will produce a lot of heat after a long time of work, so add water-cooled radiator to the LED lamp group, and make nutrient liquid flow in the radiator through water pump, which not only takes away the heat of the LED, reduces the start-up time of the heater, and saves energy, but also plays the role of cooling the LED lamp group and prolongs the service life of the LED lamp group [13].- 14].Traditional plant factories mostly use PLC as the main controller of the whole system, which makes the cost of the whole system very high, and the volume is very large, which is not conducive to reducing the volume of the system.Aiming at the above problems, the control system of micro plant factory based on embedded system is designed.The control system uses STM32F103 as the main control chip of the system. The MCU is a high performance and low power controller based on ARM Cortex-M3 core. Its working frequency reaches 72MHz. It integrates 512 KB FLASH and 64KB SRAM. It has I2C, SPI, USART, FSMC, SDIO and other interface modules. It also has 8 16-bit timers to meet the requirements of the system. The traditional design requirements [15-18].
The system mainly includes temperature sensor, humidity sensor, CO2 sensor, light intensity sensor and color sensor.DHT11 digital temperature and humidity sensor is used for temperature and humidity sensor.It is a temperature and humidity composite sensor with calibrated digital signal output.Its size is small, power consumption is low, anti-interference ability is strong, signal transmission distance can reach more than 20 m.The sensor adopts single-wire serial interface, which makes system integration easy and fast.The illumination intensity sensor adopts BH1750FVI digital sensor. The sensor has built-in 16 bit high precision A/D converter. The illumination can be detected in the range of 1-65 535 LX and the precision can reach 1 lx. It can communicate with the I2C bus interface of STM32 MCU conveniently and realize the collection of illumination intensity information by using standard I2C bus connection mode.MGS811 electrochemical module sensor is used in the detection. With temperature compensation, the sensor can output 0-2 V analog voltage. The measurement range is 0-10 000 ppm, and the accuracy is 1 ppm, which fully meets the system requirements.The color sensor adopts TCS3200 sensor, which can output RGB value directly, and control the proportion of various light quality conveniently.The circuit of the sensor is shown in Fig. 4.Because the system needs to record the information of environmental factors in plant factories during each period of time, thermostatic element a 2GB MicoSD card is selected to store the information.But the reading and writing speed of SPI mode is slower than SDIO mode, and STM32 MCU has SDIO interface, so the system adopts SDIO mode connection mode. The connection circuit between STM32 MCU and SD card is shown in Fig. 5.In SDIO mode, MCU needs 4 data lines to communicate with SD card, and each data line needs 10 K_pull-up resistance.CLK is a clock line generated by SDIO host, that is, output by STM32 controller; CMD is a command control line through which SDIO host sends commands to control SD card. If commands require SD card to respond, SD card also transmits response information through this line.There are many large current and high voltage equipment in plant factory, such as fans, heaters, etc. The GPIO driving ability of STM32 MCU is limited, so it can not drive these devices directly, so these controlled devices are controlled by relays.At the same time, in order to reduce the fluctuation of current or voltage caused by the start-up or shutdown of the device, the optocoupler TLP521-4 is added between the controller and the controlled device to enhance the stability of the system.At the same time, the power supply and grounding of the system are separated from the power supply and grounding of the control system in the circuit design to reduce mutual interference.The driving circuit of the environmental control system is shown in Fig. 6.The brightness of the LED in the system and the speed of the pump need to be controlled by the PWM signal. Similarly, the ability of the GPIO of STM32 MCU to output the PWM signal is limited, so the drive circuit is needed to control these devices.In this paper, two AOD4184 MOS transistors in parallel are selected as driving circuits.The driving circuit has smaller internal resistance and larger driving current, and the driving current can reach 10A at room temperature.The driving circuit of the MOS transistor is shown in Figure 7.The main task of the control system is to collect, process and store the data of each environmental factor in the micro-plant factory, change the control requirements of each parameter through the human-computer interaction interface, so as to realize the artificial control of the internal environment of the plant, and ultimately make the environmental factors such as temperature, humidity and light intensity inside the plant factory.
It varies according to the needs of different growth stages of plants and maintains in the suitable range for plant growth.STM32 MCU interrupt system is very powerful, each peripheral can produce interrupts.F103 series single-chip microcontrollers are equipped with an abnormal response system at the core level, which supports a large number of system abnormalities and external interruptions.Among them, there are 8 system anomalies and 60 external interruptions.Except that the priority of individual exceptions is fixed, the priority of other exceptions is programmable.Therefore, the system takes interrupt control as the core, and completes the control of various environmental factors by MCU responding to interrupts of different priorities.The system divides the control of environmental factors into four interruption service programs, which are LED brightness control interruption service program, temperature and humidity adjustment interruption service program, nutrient solution adjustment interruption service program and gas replacement interruption service program.Firstly, the system initializes all parts of hardware, including system clock initialization, SDIO interface initialization, FSMC interface initialization, GPIO initialization and so on.After initialization, each sensor has been in normal working state. STM32 MCU sends instructions to collect factor information, and determines whether the set writing time of SD card is reached. If it is reached, the collected data information will be written to SD card through SDIO interface.Then it judges whether the environmental factors exceed the limit interrupt arrives or not, and if one or more interrupts arrive, they are executed according to the pre-agreed priority sequence of interrupts.After the execution, return to the main program, continue to collect environmental factor information, and cycle the above process.The flow chart of the control system is shown in Figure 8.The control and parameter setting of plant factory are mainly accomplished by human-computer interaction interface, so the design of this interface becomes very important.The main interface of LCD displays the running time and mode of the current system, as well as the control range and real-time data of various environmental factors.At the top of the main screen interface, there are three sub-interface buttons: time setting, mode selection and data management. By clicking the corresponding button on the touch screen, you can enter the corresponding sub-interface, and then set the parameters in detail.In the time setting interface, the operator can set the current time and running time of the system; in the data management interface, the operator can not only browse all the data recorded in the system, but also export or delete the data; in the mode selection interface, the operator can choose the automatic mode or the mode according to the need. Manual mode.In the automatic mode, the duration of different growth stages and the range of environmental factors can be set according to the needs of plants. In the manual mode, the start and stop of each executive body can be controlled.The block diagram of the human-computer interaction interface is shown in Figure 9, and the screenshot of the human-computer interaction interface is shown in Figure 10.This paper designs a desktop micro plant factory for laboratory or family.The system uses STM32F103 single chip computer as the main control chip of plant factory. Its abundant interface and high performance fully meet the control requirements.Through the powerful interruption system of STM32 single chip computer, the real-time monitoring of environmental factors such as temperature, humidity, illumination intensity and light quality ratio in the factory is realized.At the same time, the system also has a man-machine interface, through the LCD screen real-time display system operation status, touch screen at any time to change the parameters of the system, easy to operate.
The system uses high-power LED as plant supplementary light source, and the light intensity and light quality ratio can be changed by PWM control, which is convenient and efficient.Because high-power LED works for a long time with high calorific value, water-cooled heat sink board is installed on the LED lamp set, and nutrient circulation system is connected. At the same time, the problems of heat dissipation and nutrient solution heating are solved, energy saving and environmental protection are achieved.