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.
Previous article:Design of Multifunctional Test Instrument
Next article:Design of automatic tester for digital circuit boards of electronic equipment
- Popular Resources
- Popular amplifiers
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- When studying the working principle of RCD circuit, what is the energy accumulated in the parasitic inductance?
- There is a spike after the rectifier bridge, which cannot be clamped by a varistor.
- [Chuanglong TL570x-EVM] Solve the problem of domain name ping failure
- 【Silicon Labs BG22-EK4108A Bluetooth Development Evaluation】Part 2: Create a new project and control and print logs through a mobile phone
- The overall architecture of the Weisheng WS51F7030 series
- ESP8266EX——Knowledge Sharing on Clock and RF
- Virtual static random access memory in mobile and portable applications
- Fatal Error[Pe1696]: cannot open source file "stm8s.h"
- 【NXP Rapid IoT Review】+8. Brief summary
- Does anyone have the engineering source code that can run on Chuanglong 6678 nor-writer?