Share this

Multi-point temperature measurement system based on thermistor

2026-04-06 03:53:32 · · #1
0. Introduction In modern agriculture, temperature measurement is required in many situations. Many types of sensors are used to measure temperature, and thermistors are one of them. Thermistors are widely used in temperature measurement and control due to their high sensitivity, good stability, small size, and high resistance. Among all passive temperature sensors, thermistors have the highest sensitivity (i.e., the change in resistance for every degree Celsius change in temperature). In greenhouses, the temperature measurement accuracy is generally around ±0.5–1°C. In this case, the lead length of the thermistor is 100–200 meters, and the error caused by this is negligible, making the measurement system circuit simple and easy to use. 1. Thermistor Measurement Circuit In a multi-point temperature measurement system, the thermistor uses the temperature-frequency method, as shown in Figure 1. [align=center] Figure 1 Temperature-Frequency Measurement Principle[/align] In Figure 1, IC1 is a 555 timer IC, a typical astable multivibrator, and IC2 is an AT89C52 microcontroller. R3 is the pull-up resistor for the 555 timer circuit output, stabilizing the high-level output at 5V. C2 is the anti-interference filter capacitor, Rt is the thermistor, and f is the frequency signal output. Where f = "1".442695041/(C1 * (R1 + 2 * Rt)). From the above formula, it can be seen that when C1 and R1 are fixed values, the output frequency f of the 555 timer circuit is only related to Rt, while the resistance value Rt of the thermistor is related to the measured temperature. Therefore, the temperature to be measured is converted into a resistance value by the thermistor Rt, then converted into a frequency signal by the 555 timer circuit. The microcontroller measures the frequency through P3.5 (T1 port) to calculate the measured temperature value. The composition and working principle of the multiplexer are shown in Figure 2. [align=center] Figure 2 Multiplexer control principle[/align] In Figure 2, IC2 is the microcontroller, IC3 and IC4 are composed of 74LS138 integrated circuits, and J01-J16 are relays. The microcontroller uses P1.0-P1.2 as addresses for two 74LS138 chips, and P1.3 and P1.4 as chip select signals for the same two chips. By changing the values ​​of P1.0, P1.1, P1.2, P1.3, and P1.4, the microcontroller controls a relay, causing thermistors to connect sequentially for temperature signal measurement. Using relay control reduces the contact resistance of the thermistor circuit, improving measurement accuracy. The display device is a 5-digit LED display: 2 digits display the channel number of the temperature signal, and 3 digits display the temperature value (2 integer digits and 1 decimal digit). 2. Microcontroller Application The microcontroller used is the AT89C52, with 256B of on-chip RAM and 8KB of Flash ROM, allowing for easy reprogramming. The microcontroller's Timer/Counter T1 operates in Mode 1 as a 16-bit external pulse counter, recording the number of pulses input from the 555 timer circuit. The microcontroller's timer/counter T0 also operates in mode 1, serving as a 16-bit timer to record the microcontroller CPU's clock pulses. When programming, the timing interval of T0 is set to 0.1 seconds. By measuring the number of pulses within 0.1 seconds using T1, the frequency value can be calculated, thus revealing the measured temperature value. The reference program is as follows: (CPU oscillation frequency is 12MHz) MOV TMOD, #15H ; Set T0 to 16-bit counter mode and T1 to 16-bit timer mode MOV TH0, #00H ; Clear the T0 counter MOV TL0, #00H ; MOV 30H, #14AH ; Loop 20 times to set the timer interval to 0.1 seconds SETB TR0 ; Start the T0 counter to begin counting Y1: MOV TH1, #3CH ; Set the initial value of the T1 timer MOV TL1, #ACH ; SETB TR1 ; Start the T1 timer to begin counting Y2: JBC TF1, Y3 ; Determine if the T1 timer has reached 50ms; if so, proceed to Y3 AJMP Y2 ; If 50ms has not reached, continue Y3: DJNZ 30H, Y1 ; Determine if the timer has reached 0.1 seconds; if not, continue CLR TR0 ; After a timer of 0.1 seconds, clear the overflow flags of T0 and T1 (CLR TR1); MOV 7BH, TH0; Store the measured frequency value in memory 7AH and 7BH (MOV 7AH, TL0). When the microcontroller performs frequency sampling, it first outputs the address value of a temperature measurement signal through a multiplexer, and then performs temperature measurement. 3. Measurement Signal Processing 3.1 Linearization of Thermistor The resistance value of the thermistor has a serious nonlinear relationship with temperature. When the frequency signal enters the microcontroller CPU, software methods, such as the least squares method, can be used to correct the nonlinearity of the thermistor. Practice has shown that using this method, the measurement error can be less than 0.2℃ in the range of -20 to 80℃. 3.2 Data Filtering After the microcontroller measures the temperature signal, it is also necessary to filter the detection signal to reduce interference during the measurement process. The simplest method is the arithmetic mean method. For N sampled values, find a Y value as the effective value for this detection, minimizing the sum of squares of the deviations between the Y value and each sampled value. In practical applications, the N value should not be too large; for temperature measurement, N = 5-10 is preferable, maintaining both sufficient sensitivity and appropriate smoothness. The calculation method is: Y = (X1 + X2 + ... + XN) / N, where X1, ..., X2, ..., XN are the N detection values. Practice has proven that this method can accurately measure temperature values. After obtaining the correct measurement value, it is necessary to convert it into the corresponding actual temperature value. 4. Several measures to improve measurement accuracy 4.1 Stability of frequency signal In Figure 1, the thermal stability of R1 and C1 directly affects the output frequency of the 555 timer IC. Metal film precision resistors with small temperature coefficients should be selected, and C1 should be a CBB22 capacitor. R1, C1, and the 555 timer IC should be used after high and low temperature aging and stabilization. Each channel uses a precision resistance box to simulate the temperature change of the thermistor, and the actual resistance-frequency data is input into the microcontroller as the basis for measurement and calculation. 4.2 Multiple Signal Input To overcome the output frequency error caused by the performance dispersion of the 555 timer IC, multiple thermistors use the same R1, C1, and 555 timer IC. Each thermistor selects the signal input through a relay controlled by the microcontroller. 4.3 Influence of Thermistor Shape Thermistors are very small, so they can be manufactured in various shapes, such as columnar, beaded, needle-shaped, and planar, to suit different measurement requirements. A suitable thermistor shape should be selected so that the measured value accurately reflects the measured temperature value. For applications requiring rapid measurement, sensors with small size and fast response should be selected as much as possible; otherwise, measurement errors will occur. 4.4 Influence of Sensor Consistency Poor sensor consistency can cause significant measurement errors. When thermistors are used as precision temperature sensors, the interchangeability of the product should be above 0.1%, and its interchangeability accuracy should reach 0.025℃. 4.5 Temperature Calibration At a given temperature, the resistance of the thermistor is known. Therefore, a resistance box (e.g., a rotary resistance box ZX31) can be used to simulate temperature changes, ensuring the output frequency of the 555 circuit meets the requirements. However, errors in the microcontroller's program calculation methods and timing, as well as errors in the simulation formula obtained using the least squares method, directly affect measurement accuracy. Therefore, after verifying the accuracy of the measurement circuit, check whether the microcontroller can calculate the accurate temperature value. If errors are found, the program must be carefully checked and relevant statements modified until accuracy is achieved. Based on the above work, use a precision thermostat bath to set 5 or 6 temperature points within the range of -20 to +80℃. Check whether the thermistor's resistance value at these temperature points meets the requirements. Then, connect the thermistor's leads to the circuit, place the thermistor in the precision thermostat bath, and observe whether the microcontroller's display value at each temperature point meets the requirements. If it meets the requirements, the calibration is complete. 5. Conclusion The design of this multi-point temperature measurement system fully utilizes the computational and linearization capabilities of the microcontroller. By applying the resistance-frequency characteristics of the 555 timer circuit, high-precision temperature measurement is achieved with a very simple circuit. The author's innovation lies in the ingenious application of the temperature-resistance change of the thermistor to the 555 timer circuit, enabling the microcontroller's A/D conversion to employ frequency sampling, simplifying the circuit and improving measurement accuracy. Due to the thermistor's high sensitivity and large resistance, it can be directly connected to ordinary wires, achieving a measurement distance of approximately 200 meters, which is difficult to achieve with other sensors. Furthermore, the use of only a single 555 timer circuit minimizes the impact of integrated circuit discreteness and significantly reduces hardware costs. References [1] Zhao Xiaoyu, Li Baohua, et al. Portable ammonia detector [J] Microcomputer Information 2007, No. 6-1: 143-144 [2] Wang Jianjun Design of vibrating wire blood pressure measuring instrument using AT89C52 [J] Microcomputer Information 2007, No. 6-1: 199-201 [3] Chen Yongfu 800 cases of 555 integrated circuit application [M] Electronic Industry Press, February 1992 [4] Zhang Hongrun, Zhang Yafan Sensor Technology and Application Tutorial [M] Tsinghua University Press, April 2005
Read next

CATDOLL Rosie Hybrid Silicone Head

The hybrid silicone head is crafted using a soft silicone base combined with a reinforced scalp section, allowing durab...

Articles 2026-02-22