The traditional direct moisture measurement method has a long period, and it is difficult to meet the requirements of modern production for speed and continuity. The non-electricity electricity measurement method is a more efficient moisture measurement method than the direct method, and is currently widely used. In principle, grain moisture detection methods can include: resistance method, capacitance method, neutron method, microwave method, infrared method, nuclear magnetic resonance method, and the like. Considering the characteristics of the material object, the infrared method is mainly used for surface moisture measurement, and is mostly found in paper moisture detection. The neutron method and nuclear magnetic resonance method are based on the effect of hydrogen atoms in water, the system is complex, and the cost is high, which does not reflect the specificity of the test object. The microwave method uses the principle that the absorption of microwave energy by water or the microwave parameters acting on grain changes with the principle of moisture. The measured value is related to the material composition, and the measuring circuit and signal processing are complicated and the price is high. The resistance method is always the most commonly used method for measuring moisture because of its fast, accurate, and low cost. However, due to the defects of small signal strength, high sampling requirements, and poor anti-interference in resistance methods, many new methods have emerged in recent years. Innovative methods of resistance measurement principle, such as 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 data processing method based on the pulse width measurement of the resistance ratio method and the measurement signal, which can quickly and accurately determine the moisture content.

1 Test principle The grain moisture analyzer is a product with regional characteristics. It has different measurement reference values ​​for food crops in different regions. Therefore, before testing, it is necessary to perform calibration work under different conditions according to different food types. From the standard measurement data relationship, these data can be written by the manufacturer into the analyzer's E2PROM data area, or they can be calibrated by the user according to the standard field. The system uses ATmega128's own 4KB E2PROM to store parameters such as moisture calibration values, temperature compensation coefficients, and system passwords for different types of grain. Water calibration is required before use. The same sample is measured at the same time on the standard analyzer and the analyzer simultaneously to determine the relationship between moisture and resistance. Then the corresponding relationship is written to the corresponding cell in the E2PROM through the keyboard. Save it to form a standard measurement curve or data table. At the same time taking into account the effect of temperature, a temperature compensation factor must be added to correct it. In the actual measurement, the current measurement value is compared with these standard values ​​to realize the measurement of moisture.

2 system hardware design MCU using Atreel's high-speed embedded microcontroller AT-mega128, which uses advanced RISC RISC architecture, with 128KB of online reprogrammable FLASH, 4KB of SRAM and 4KB of E2PROM, also 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 operating modes. These features make the ATmega128 a more powerful microcontroller and better support industrial control applications such as pulse width modulation, high-speed I/O, and up/down count capabilities. In the program, water sampling and high-speed processing, LCD display, keyboard input, drive output, and PC communication are mainly performed. The measuring range of the analyzer is between 5 and 30%, the accuracy is within ±0.2%, and the water is expressed in 2 bytes. Therefore, a total of 1 KB of moisture value stored under a certain temperature condition is required. Temperature compensation coefficient and password settings. 4KB space is enough. Its programmable watchdog timer module ensures reliable and stable operation of the system.

The LCD adopts the 128×64 dot matrix module of T6963C controller. It can display the measured varieties of rice, corn, soybean and wheat at the same time. Then the specific test object can be determined through the keyboard. The measured value and the number of measurements can be displayed under each test submenu. The options such as average value, calibration value, and password are only allowed when the operator's input password is the same as the one given by the system. Normally, these values ​​cannot be freely modified.

The temperature sensor adopts DS18820 of DALLAS Company's single-bus device to compensate for the influence of ambient temperature on the internal moisture of grain. The ambient temperature is directly transmitted in the “first line bus” digital mode, eliminating the need for amplification processing of temperature sensors and greatly improving the The system's anti-interference is suitable for on-site temperature measurement in harsh environments. At the same time, it only occupies a single port of the microcontroller, which saves the hardware resources of the system and therefore has a higher price/performance ratio.

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. It is used to implement the selection of measurement types, the setting and modification of parameters, Test and data processing and other work.

The motor drive circuit consists of a relay driver chip ULN2003 and a 5VDC relay. At the beginning of the test, the microcontroller sends a control signal. The motor drives the sampler to make the sample strong and keep the pressure constant to obtain a more consistent resistance sampling value when a sample test is completed. After that, reset the sampler and prepare for the next measurement.

The one-chip computer realizes the communication with PC through RS232 serial communication interface, upload the measurement data to the computer, carry on further data processing, can also carry on the long-range operation at the same time, realize on-line measurement. The signal conditioning circuit uses a non-repetitive single-shot trigger circuit composed of 555 chips. To improve the response speed, the 555 chip uses the 7555 CMOS technology.

In order to eliminate the variation error caused by the long-term operation of the capacitor, the resistance ratio method is used in the measurement, that is, the circuit formed by a standard precision reference resistor and capacitor is first measured during measurement, and its pulse width is measured:

Tp1=Rref*C*ln3(1)

Then, the MAX4624 electronic switch with a 1Ω on-resistance is switched to measure the state of the input resistor and measure its pulse width:

Tp2=Rin*C*ln3(2)

Dividing equations (1) and (2) yields the relationship between input resistance and pulse width:

Rin=Tp2*Rref/Tp1(3)

In general, the measurement resistance and the reference resistance are megohm level. Therefore, the measurement error introduced by the electronic switch can be neglected.

Electronic switches and trigger signals are controlled by the microcontroller. Pulse width measurement by the microcontroller interrupt and timer interrupt to complete, because the microcontroller external interrupt INT0 and INT1 are negative edge triggered interrupt, so the output of the 555 plus one inverter, INT0 interrupt sampling output signal The edge jumps up and then goes through one inverter. INT1 samples the next edge of the output signal. The time difference between the two samples is the pulse width. The calculation of the time difference can be implemented by the timing interrupt of the microcontroller. The timer interrupt is enabled in the INT0 interrupt routine, and the timer interrupt is disabled in the INT1 interrupt routine.

3 system software design software includes the main program, human-machine interface and data measurement and processing. The main program is responsible for the coordination and control of the entire system and completes the corresponding work by calling different modules. The measuring instrument takes the arithmetic average of 10 random samples of each species as the measurement result, which effectively improves the accuracy and repeatability of the measurement.

The man-machine interface includes the LCD display program, keyboard scanning program, etc. The LCD display is divided into three pages. The first page is the measurement type selection page. You can select the corresponding type by pressing the plus or minus key, and then press the enter key to enter. The second page carries out the measurement. This page contains parameters such as the current measured value, the number of measurements, the average measured value, and the entry password of the calibration value setting page of the product. Press the related function keys to complete functions such as measuring, saving and exiting. When it is really necessary to recalibrate the site, you can enter the calibration password. When the input password is the same as the internal password of the system, you can enter the third page, recalibrate, and you can also reset the system password on this page. . For the security of the system, the number of password input times can also be set. When the input error password exceeds a certain number of times, the system is locked to prevent malicious modification of the data. Measurement and Processing of Data Data processing such as moisture sampling interruption processing, temperature sampling, measurement data linearization, and temperature drift compensation is completed. The moisture measurement program uses two external interrupts 0 and 1, and a timer 2 to measure the pulse width.

4 Conclusion The actual prototype is nonlinearly compensated and error corrected, the measurement error is less than or equal to ±0.5%, the measured moisture range is 5% to 30% (depending on the grain standard), and the repeat error is less than or equal to 0.1%. The temperature range is 0 to 40°C. To meet the technical indicators of similar advanced products at home and abroad. Applicable to different types of grain moisture measurement, has a relatively broad market prospects.

CNC Machining Electronic Parts

Cnc Machining Electronic Parts,Cnc Machined Anodized Purple Electronic Part,High Precision Machined Components,Precision Cnc Components

Yihua Precision Machining Co, Ltd. , https://www.yhmachining.com