Design of a resistance-type grain moisture meter

Publisher:机械梦想家Latest update time:2011-09-02 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
The traditional direct moisture measurement method has a long cycle and cannot meet the speed and continuity requirements of modern production. The non-electrical electrical measurement method is a more efficient moisture measurement method than the direct method and is currently widely used. The grain moisture detection methods can be: resistance method, capacitance method, neutron method, microwave method, infrared method, nuclear magnetic resonance method, etc. Considering the characteristics of the material object, the infrared method is mainly used for surface moisture measurement, which is often seen in paper moisture detection; the neutron method and nuclear magnetic resonance method are based on the hydrogen atom effect in water, the system is complex, the cost is high, and it cannot reflect the specificity of the detection object. The microwave method uses the principle that water absorbs microwave energy or the microwave parameters acting on grain change with moisture to measure moisture. Its measurement value is related to the material composition, the measurement circuit and signal processing are relatively complex, and the price is high. The resistance method has always been the most commonly used moisture measurement method due to its fast, accurate and low cost characteristics. However, due to the defects of the resistance method such as low signal strength, high sampling requirements and poor anti-interference, many new innovative methods based on the resistance measurement principle have emerged in recent years, such as the two-range DC resistance method, pulse resistance method, complex impedance separation method, AC impedance method, etc. Based on the above research, this design innovatively proposes a resistance ratio method based on pulse width measurement and a data processing method for measurement signals, which can quickly and accurately measure moisture.


1 Test Principle
Grain moisture meter is a product with regional characteristics. It has different measurement reference values ​​for grain crops in different regions. Therefore, before testing, it is necessary to calibrate it according to different types of grains and in different states to establish a standard measurement data relationship. These data can be written into the E2PROM data area of ​​the meter by the manufacturer, or calibrated on site by the user according to the standard. The system uses ATmega128's own 4 KB E2PROM to store parameters such as the calibration value of moisture of different types of grains, temperature compensation coefficient and system password. Before use, moisture calibration is required. The same sample is compared and measured in the standard meter and this meter at the same time to determine the relationship between moisture and resistance. Then, the corresponding relationship is written into the corresponding unit in the E2PROM through the keyboard and saved to form a standard measurement curve or data table. At the same time, considering the influence of temperature, the temperature compensation coefficient must be added for correction. In actual measurement, the current measurement value is compared with these standard values ​​to achieve moisture measurement.


2 System hardware design
The hardware structure diagram of the system is shown in Figure 1.

MCU uses Atreel's high-speed embedded single-chip microcomputer AT-mega128, which adopts advanced RISC reduced instruction set structure, has 128 KB online reprogrammable FLASH, 4 KB SRAM and 4 KB E2PROM, and has 8/16-bit timer/counter, PWM output module, UART, SPI and other serial communication interfaces, programmable watchdog timer and other functional modules, rich external and internal interrupt sources, and multiple working modes. These features make ATmega128 a more powerful microcontroller, better supporting applications such as pulse width modulation, high-speed I/O, increment/decrement counting capabilities and other industrial control occasions. In the program, the main tasks are to complete the sampling and high-speed processing of moisture, LCD display, keyboard input, drive output, and communication with PC. The measuring range of the meter is between 5% and 30%, with an accuracy of ±0.2%. The moisture is represented by 2 bytes, so a total of 1 KB is required to save the moisture value under a certain temperature condition, plus the temperature compensation coefficient and password setting. 4 KB space is enough. Its programmable watchdog timer module can ensure that the system can work reliably and stably. [page]

LCD uses the 128×64 dot matrix module of the T6963C controller, which can simultaneously display the measured varieties of rice, corn, soybeans, and wheat. Then the specific test object is determined through the keyboard, and the measurement value, measurement times, average value, calibration value setting password and other options are displayed under each test submenu. Only when the operator's input password is the same as the password given by the system, can the calibration value be set. Under normal circumstances, these values ​​cannot be modified at will.
The temperature sensor uses the single-bus device DS18820 of DALLAS Company to compensate for the influence of ambient temperature on the internal moisture of grain. The ambient temperature is directly transmitted in a digital way of "one-line bus", eliminating the amplification and processing of the temperature sensor, greatly improving the anti-interference of the system, and is suitable for on-site temperature measurement in harsh environments. At the same time, it only occupies one port of the single-chip microcomputer, saving the hardware resources of the system, so it has a high cost performance.
The keyboard circuit consists of mode keys, plus keys, minus keys, confirmation keys, exit keys, test keys, average keys, clear keys, stop keys, correction keys, etc., which are used to realize the selection of measurement varieties, setting and modification of parameters, testing and data processing, etc.
The motor drive circuit is composed of a relay driver chip ULN2003 and a +5 V DC relay. When the test starts, the microcontroller sends a control signal, and the motor drives the sampler to press the sample firmly and keep the pressure constant to obtain a relatively consistent resistance sampling value. When a sample test is completed, the sampler is reset to prepare for the next measurement. The
microcontroller communicates with the PC through the RS 232 serial communication interface and uploads the measured data to the computer for further data processing. It can also be remotely operated to achieve online measurement. The signal conditioning circuit uses a non-repetitively triggered monostable trigger circuit composed of a 555 chip. In order to improve the response speed, the 555 chip uses the 7555 model of the CMOS process. The specific signal conditioning circuit is shown in Figure 2.

In order to eliminate the capacitance variation error caused by long-term operation, the resistance ratio method is used for measurement, that is, when measuring, first measure the circuit composed of standard precision reference resistor and capacitor, and measure its pulse width:
Tp1=Rref*C*ln 3 (1)
Then switch to the state of measuring input resistance through the electronic switch MAX4624 with an on-resistance of 1 Ω, and measure its pulse width:
Tp2=Rin*C*ln 3 (2)
Dividing equations (1) and (2) gives the relationship between input resistance and pulse width:
Rin=Tp2*R ref/Tp1 (3)
In general, the measurement resistor and reference resistor are both megohm-level, so the measurement error introduced by the electronic switch can be ignored.
The electronic switch and trigger signal are both controlled by the microcontroller. The measurement of pulse width is completed by the external interrupt and timing interrupt of the single-chip microcomputer. Since the external interrupts INT0 and INT1 of the single-chip microcomputer are both negative edge triggered interrupts, an inverter is added to the output end of 555. The INT0 interrupt samples the rising edge of the output signal, and then passes through an inverter, and INT1 samples the falling edge of the output signal. The time difference between the two samplings is the pulse width. The calculation of the time difference can be realized by the timing interrupt of the single-chip microcomputer. The timing interrupt is turned on in the interrupt program of INT0, and the timing interrupt is turned off in the interrupt program of INT1. The sampling waveform of the signal is shown in Figure 3.

3 System software design
The software part includes the main program, human-machine interface and data measurement and processing part. The main program is responsible for the coordination and control of the entire system, and completes the corresponding work by calling different modules. This measuring instrument uses the arithmetic mean of 10 random samples of each variety as the measurement result, which effectively improves the accuracy and repeatability of the measurement. The flow chart of the main program is shown in Figure 4. [page]

The human-machine interface includes LCD display program, keyboard scanning program, etc. The LCD display is divided into three pages. The first page is the measurement variety selection page. You can select the corresponding variety by using the plus key and minus key, and then press the confirmation key to enter the second page for measurement. This page contains parameters such as the current measurement value, number of measurements, average measurement value, and the entry password of the calibration value setting page of this variety. Press the relevant function key to complete the measurement, save and exit functions. When it is really necessary to recalibrate on site, you can enter the calibration password. When the entered password is the same as the password inside the system, you can enter the third page and recalibrate. You can also reset the system password on this page. For the security of the system, you can also set the number of password inputs. When the wrong password is entered more than a certain number of times, the system is locked to prevent malicious modification of data. The measurement and processing of data completes the data processing of moisture sampling interrupt processing, temperature sampling, measurement data linearization and temperature drift compensation. The moisture measurement program uses two external interrupts 0 and 1 and a timer 2 to realize the measurement of pulse width. The specific program code is as follows:

4 Conclusion
After nonlinear compensation and error correction, the actual prototype has a measurement error of less than or equal to ±0.5%, a measured moisture range of 5% to 30% (depending on the grain standard), a repeatability error of less than or equal to 0.1%, and a temperature range of 0 to 40°C. It has reached the technical indicators of similar advanced products at home and abroad. It can be applied to the measurement of moisture content of different types of grains and has a relatively broad market prospect.

Reference address:Design of a resistance-type grain moisture meter

Previous article:Design of Multifunctional Test Instrument
Next article:Design of automatic tester for digital circuit boards of electronic equipment

Latest Test Measurement Articles
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号