Design of moisture real-time detection system for grain dryer

STM32 MCU is used as the core control chip, and the parallel plate is designed as the data acquisition terminal of capacitance sensor. The parallel plate is a capacitive sensor to collect the moisture data of grain in the dryer, through AD conversion, signal processing. Through RS485 communication, the signal will be transmitted to the top computer for real-time display. The operator can calibrate grain moisture in real time through the upper computer. The influence of grain temperature and volume on capacitance was studied, and a mathematical model describing capacitance and moisture content was established, and the model was verified. Through field experiments, the reliability of the system was confirmed, and the accuracy of online monitoring could reach within 0.5%, which fully met the requirements.


Introduction
China is the world's largest producer and consumer of grain, with an annual output of about 600 million tons. According to statistics, China's grain harvest in threshing, air drying, storage, transportation, processing, consumption and other losses as high as 18% or so, far beyond the United Nations Food and Agriculture Organization set the standard of 5% [1] .Grain moisture content is too high will cause of grain mildew, keep the moisture content of grain is the most important link of grain drying, the process is to food after conveyor to the dryer, after heating, drying, cooling, to achieve the safety of the storage water back out of the dryer, in this process, real-time monitor of grain moisture content is the core technology [2] .The traditional moisture measurement method is to take out food samples from the dryer manually every other period of time in the drying process, and then measure with instruments. The method must be manually operated, complicated operation, safety risks, and real-time measurement without continuity. This monitoring system designed this time has good real-time performance, the system STM32F103RBT6 microcontroller as the main control chip, the use of parallel plate capacitance sensor as the acquisition terminal, and then through the microcontroller processing, the data will be transmitted to the top computer real-time display, convenient for personnel to observe the moisture change.

System Total Design
This design system on STM32F103RBT6 single-chip microcomputer as the processing core, based on parallel plate capacitor sensor, the sensor can be directly installed inside the dryer, real-time monitoring, the change of the internal moisture to dry grain dryer, moisture change through oscillator into frequency change of the capacitance change after processing transmitted to the microcontroller, After processing by single chip microcomputer, the display is transmitted through RS485 [3] . The president block diagram of system design is shown in Fig.1.

Power module
At the front end of the system, 24V voltage is input by 24V switching power supply, and the voltage is reduced to 5V by TPS5430 chip, providing 5V DC voltage for the rear modules. Since the frequency of the signal collection is similar to that of the switching power supply, in order to avoid interference, the relay is used for isolation. When the relay separates the front and rear of the signal collection, the rear is powered by a fully charged energy storage capacitor. B2412ls-1wr2 chip converts 24V voltage provided by switching power supply to 12V voltage, filters high-frequency noise through magnetic beads, and supplies power to capacitance sensor and oscillation chip. The power supply module has the characteristics of small volume, low power consumption, high efficiency, but also effectively avoids the interference caused by the switching power supply to the collected signal [4] .

Capacitive sensor
The capacitance sensor adopts the parallel plate capacitance sensor, which consists of three electrodes made of parallel insulation material to form two groups of capacitance measurement areas. The middle area of the parallel plate is the area through which food passes [5] . The plate is installed directly inside the dryer, as shown in the Fig.2. In the formula, ε 0 is the vacuum dielectric constant, ε r is the relative dielectric constant of the measured substance, D is the distance between the parallel plates, S is the area of the plates.
The parallel plate is directly installed in the dryer, parallel to the direction of food, food drying at the same time filled with parallel plate, you can get the capacitance value in real time.

signal processing circuit
The capacitance sensor transmits the measured capacitance value to the capacitance conversion circuit, which is composed of MIC1557 chip as the core, and converts the transmitted capacitance value into a stable square wave output with the output frequency between 20KHZ and 120KHZ. After a series of processing, such as filtering and amplification, the capacitance value is transmitted to the microcontroller.
After testing, the output of capacitor conversion circuit is low frequency small signal square wave, which needs further processing to filter the interference of high frequency signal. The circuit composed of the low-pass filter UPC842G2-E2-A and the inverter SN74LVC1G04DBVR further filters out the clutter of the square wave output by the oscillation circuit and sends it to the STM32 microcontroller for processing to make the measurement result more accurate. The circuit diagram is shown in Fig.3.

Frequency sampling control program
The flow chart of frequency sampling control program is shown in Fig.4.System initialization, relay closed first, the super capacitor charging, the charging is completed, the relay disconnect, chip powered by super capacitor start gathering frequency, frequency acquisition is completed, single-chip microcomputer for processing converts frequency values to moisture value, through the RS485 communication first place machine output, complete a signal collection and processing, to complete a cycle.

Host computer software design
The upper computer is the control and display unit of the whole system. The main interface is shown in Fig.5. The main programs written by the upper computer include: current temperature display, moisture value display, current frequency display, correction operation, data line chart display, and historical data storage.

Model building
First of all, through the establishment of mathematical model in the laboratory test, in the supermarket to buy different varieties of rice mixed with different amount of water, after the simulation environment, different water content through testing for many times, found that the bulk density (that is, the parallel plate how much grain content in) no significant impact on the model, only the moisture content and temperature has a great influence on the model, After that, the following mathematical model was established by simulating the influence of grain falling speed in the dryer on the test results:

Experimental situation
The field experiment environment is a local rice factory. During the dryer working in the factory, the sensor is installed in the dryer storage silo for data collection. In order to compare the reliability of the system, it is installed in several dryers that are not working at the same time, and finally the data is compared.

Field measurement results and analysis
During field measurement, the plate is first installed inside the dryer, and the frequency value is collected for correction when the dryer is empty. Began work on food dryer, system every minute will be measured value is displayed in the upper machine, at the same time every hour manual collection within the dryer grain use instrument to measure and record the moisture, stay after the round of grain drying, the system of on-line monitoring moisture value and manual measurement record to draw a line chart shown in  Fig.6. It is obvious from the figure that the value measured online by the system has the same trend with the value measured manually, and the error range is within 0.5%.

Conclusion
Based on the results and discussions presented above, the conclusions are obtained as below: (1)The system can measure the moisture change of grain inside the dryer in real time.
(2)The system works stably, has high measuring accuracy and is easy to observe.
(3)The system greatly reduces the working intensity of the staff and improves the safety of the working area. It is suitable for the moisture measurement of grain drying and storage