TEC infrared imaging temperature control system and method based on STM32
By designing a TEC infrared imaging temperature control system based on STM32 microcontroller, the PID algorithm is used to adjust the current of the TEC refrigeration sheet to achieve accurate control of the baffle temperature, the problem of poor imaging effect of infrared thermal imagers with large differences in imaging noise and temperature at low temperatures is solved, and the imaging stability and accuracy are significantly improved.
Patent Information
- Application Number
- CN202411741257.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-07
AI Technical Summary
When infrared thermal imagers perform blank correction at low temperatures, they will produce ‘snowflake’ noise, affecting the imaging effect, and poor imaging effect when observing targets with large differences in temperature and ambient temperature.
A TEC infrared imaging temperature control system based on STM32 microcontroller is designed, including a TEC refrigeration sheet, ambient temperature sensor, STM32 microcontroller and baffle. The current of the TEC refrigeration sheet is adjusted through the PID algorithm to achieve precise control of baffle temperature and ensure that the baffle temperature remains balanced with the ambient temperature.
By accurately controlling the temperature of the blank, the inhomogeneity problems caused by temperature changes are significantly reduced, the stability and accuracy of imaging are improved, the snowflake noise is reduced, and the imaging effect of infrared imaging equipment is improved, especially in environments with large temperature changes.
Smart Images

Figure CN119576045A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of video image processing, and in particular relates to a TEC infrared imaging temperature control system and method based on STM32. Background Art
[0002] The imaging effect of infrared thermal imagers will be affected by changes in ambient temperature, so it is necessary to perform baffle correction on infrared detectors. However, the existing technology will produce "snowflake" noise when performing baffle correction at low temperatures, which affects the imaging effect. In addition, when observing targets with a large temperature difference from the ambient temperature, the imaging effect is also poor. The document "Temperature Control System Design Based on STM32 Microcontroller" discloses a design idea for a temperature control system, analyzes its hardware design from two aspects: temperature acquisition and logic control, and finally designs the system software part, ultimately achieving the purpose of improving the accuracy of the temperature control system, reducing losses, and improving the circuit working efficiency and reliability. This study aims to reduce switching losses and improve the reliability of the temperature control system. The focus of the temperature control of infrared detectors is on the need for baffle temperature correction in different temperature scenarios, and improving the imaging effect of infrared imaging equipment in environments with large temperature changes. Therefore, this solution is not suitable for application in infrared detectors. Summary of the invention
[0003] The present invention proposes a TEC infrared imaging temperature control system and a temperature control method based on an STM32 microcontroller, which are used to solve the demand for baffle temperature correction of an infrared thermal imager in different temperature scenes.
[0004] The TEC infrared imaging temperature control system based on STM32 is characterized in that it includes a TEC cooling piece, an ambient temperature sensor, an STM32 microcontroller and a baffle. The TEC cooling piece is circular and is installed inside a hollow circular baffle that matches the shape and size of the TEC cooling piece. The ambient temperature sensor is arranged on the front side of the baffle. The baffle is also electrically connected to the baffle temperature sensor. A rotating motor is arranged at the bottom of the baffle. The STM32 microcontroller is electrically connected to the baffle temperature sensor through an I2C or 1-Wire interface. The STM32 microcontroller is electrically connected to the TEC cooling piece through a PWM output interface. The power supply is electrically connected to the STM32 microcontroller and the rotating motor respectively. The ambient temperature sensor is electrically connected to the STM32 microcontroller through an analog-to-digital converter.
[0005] Furthermore, the TEC cooling plate is driven by a driving circuit, and a MOSFET power driving module is provided in the driving circuit. The MOSFET power driving module adjusts the current of the TEC cooling plate by controlling the gate voltage, provides driving current for the TEC cooling plate, and ensures that it switches quickly between heating and cooling modes.
[0006] Furthermore, the ambient temperature sensor and the baffle temperature sensor both adopt high-precision digital temperature sensors of model DS18B20, with a measurement accuracy of ±0.5°C and a measurement range of -55°C to +125°C.
[0007] The TEC infrared imaging temperature control method based on STM32 is to adjust the current of the TEC cooling plate based on the PID algorithm through the STM32 microcontroller to achieve temperature control. The specific method is as follows: S1, set the set temperature value setTemperature of the STM32 microcontroller, and read the baffle surface temperature data on the baffle temperature sensor once in each temperature sampling period through the external analog-to-digital converter (ADC) in the STM32 microcontroller to obtain the actual temperature value currentTemperature; S2, calculates the current and voltage driving the TEC cooling plate through the PID algorithm: S2-1, initialize the proportional coefficient Kp, integral coefficient Ki and differential coefficient Kd of the PID algorithm, and initialize the variables used to store the previous error value prev_error and the integral term cumulative value integral, and initialize them to 0; S2-2 calculates the current error in each temperature sampling cycle, and the current error error = setTemperature –currentTemperature; S2-3, calculate the three parts of the PID algorithm respectively, Proportional term P: P=Kp*error; Integral term I: I= Ki*error; Differential term D: D = Kd*(error-prev error); S2-4, calculate the comprehensive control quantity u(k)=P+I+D, and update prev_error to error, in preparation for the next calculation; S3, use the PWM timer and PWM output interface of the STM32 microcontroller to control the current and voltage of the TEC cooling chip: The calculated comprehensive control quantity u(k) is used to calculate the appropriate PWM duty cycle range: The value range of u(k) is [0, a], and the automatic reload value of the PWM timer is set to b, then the duty cycle range dutyCycle = (u(k) / a) * b; S4, dynamically adjusts the PWM duty cycle according to the control quantity output by the PID algorithm, and achieves heating or cooling by changing the current direction to accurately control the temperature of the TEC cooling plate, so that the temperature of the baffle is balanced with the ambient temperature.
[0008] Furthermore, the temperature sampling period is 10s.
[0009] Furthermore, the value range of the comprehensive control quantity u(k) in S4 is [0, 100], and the automatic reload value of the PWM timer is set to 1000.
[0010] The beneficial effects of the present invention are: (1) Improved temperature stability: The temperature of the baffle is precisely controlled by the TEC cooling sheet, so that the baffle remains constant within the operating temperature range of the infrared imaging device, effectively reducing the non-uniformity problem caused by temperature changes during the infrared imaging process, ensuring that the temperature of the baffle is not affected by ambient temperature fluctuations, and improving the stability and accuracy of imaging.
[0011] (2) Improved imaging effect: When the ambient temperature changes, the TEC cooler automatically adjusts the cooling or heating power according to the signal fed back by the temperature sensor, thereby ensuring the stability of the baffle temperature and reducing the problem of imaging snow noise caused by the temperature change of the baffle. This significantly improves the imaging effect of the infrared imaging device, especially when observing targets with a large temperature difference from the ambient temperature.
[0012] (3) Wide environmental adaptability: It can keep the temperature of the baffle plate stable within a wide temperature range, and is suitable for infrared imaging needs under various harsh environmental conditions. Whether it is a hot summer or a cold winter, it can ensure the normal and stable operation of the infrared imaging system.
[0013] (4) Compact structure and easy installation: The system components are reasonably laid out and compact in structure, making them easy to install on existing infrared imaging equipment, facilitating the upgrading and transformation of existing equipment without requiring large-scale changes to the equipment structure, thus reducing the cost and difficulty of upgrading.
[0014] (5) Accurate temperature control: The PID algorithm based on the STM32 microcontroller is used to adjust the TEC cooling chip current. Combined with a high-precision temperature sensor and an optimized PWM control strategy, accurate control of the baffle temperature is achieved. The proportional term, integral term, and differential term in the PID algorithm work together to quickly respond to temperature changes, eliminate steady-state errors, and predict temperature trends, ensuring that the temperature control accuracy reaches a high level.
[0015] (6) Efficient power management: The power supply provides stable power support for the STM32 microcontroller and the rotating motor respectively. The overall power consumption of the system is low, and the power management design is reasonable, which avoids system instability or performance degradation caused by power problems, and further improves the reliability and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a connection diagram of the TEC infrared imaging temperature control system based on STM32.
[0017] Figure 2 This is the exploded structure diagram of the TEC infrared imaging temperature control system based on STM32.
[0018] Among them: 1-TEC cooling sheet, 2-environmental temperature sensor, 3-STM32 microcontroller, 4-blocking sheet, 5-blocking sheet temperature sensor, 6-rotating motor, 7-power supply. DETAILED DESCRIPTION
[0019] Embodiment 1: A TEC infrared imaging temperature control system based on STM32, comprising a TEC cooling sheet 1, an ambient temperature sensor 2, an STM32 microcontroller 3 and a baffle 4, wherein the TEC cooling sheet 1 is circular and installed inside a hollow circular baffle 4 that matches its shape and size, an ambient temperature sensor 2 is arranged on the front side of the baffle 4, the baffle 3 is also electrically connected to a baffle temperature sensor 5, a rotating motor 6 is arranged at the bottom of the baffle 3, and the rotating motor 6 is used to control the switch of the baffle, and the baffle 3 is rotated in front of the infrared detector for correction when shutter correction is performed, and the baffle 3 is rotated away when normal imaging is performed. The STM32 microcontroller 3 is electrically connected to the baffle temperature sensor 5 via an I2C or 1-Wire interface, the STM32 microcontroller 3 is electrically connected to the TEC cooling sheet 1 via a PWM output interface, a power supply 7 is electrically connected to the STM32 microcontroller 3 and the rotating motor respectively, and the ambient temperature sensor 2 and the baffle temperature sensor 5 are electrically connected to the STM32 microcontroller 3 via an analog-to-digital converter.
[0020] The ambient temperature sensor 2 and the baffle temperature sensor 5 use high-precision digital temperature sensors, model DS18B20. This model has a measurement accuracy of ±0.5°C, a measurement range of -55 to +125°C, a fast response speed, and a single bus communication interface that is easy to connect to the STM32 microcontroller 3, and can accurately obtain ambient temperature and baffle 4 surface temperature information.
[0021] The TEC cooling sheet 1 is driven by a driving circuit, which includes a MOSFET power driving module. The module adjusts the current of the TEC cooling sheet 1 by controlling the gate voltage. The module has the characteristics of low on-resistance and high switching speed, and can quickly respond to the control signal of the STM32 microcontroller 3, providing a stable and sufficient driving current for the TEC cooling sheet 1, ensuring that it quickly switches between heating and cooling modes to achieve precise temperature control.
[0022] Method for using this system for external imaging temperature control: S1, set the set temperature value setTemperature of the STM32 microcontroller 3, and read the surface temperature data of the baffle 4 on the baffle temperature sensor 5 through the external analog-to-digital converter (ADC) in the STM32 microcontroller 3 every 10 seconds to obtain the actual temperature value currentTemperature. This temperature sampling cycle is determined by comprehensively considering the system's response speed to temperature changes and avoiding the occupation of system resources by frequent sampling, ensuring the efficient and stable operation of the system while ensuring the temperature control accuracy.
[0023] S2, calculates the current and voltage driving the TEC cooling plate through the PID algorithm.
[0024] S2-1, initialize the proportional coefficient Kp, integral coefficient Ki and differential coefficient Kd of the PID algorithm. Kp, Ki and Kd are determined based on the dynamic characteristics and control requirements of the system, and are obtained through experience debugging or based on system identification technology. At the same time, initialize the variables used to store the previous error value prev_error and the integral term cumulative value integral, and initialize them to 0; S2-2, calculate the current error every 10 seconds, current error error = setTemperature –currentTemperature; S2-3, calculate the three parts of the PID algorithm respectively, Proportional term P: P=Kp*error. The proportional term quickly adjusts the control strength according to the error size, prompting the system output to quickly respond to temperature changes. Its function is to enable the system to have an immediate regulatory effect on temperature deviations. The larger the deviation, the stronger the regulatory effect. Integral term I: I = Ki*error. When calculating the integral term, an anti-integral saturation mechanism is provided. The upper and lower limits of the integral term are set to prevent excessive accumulation of the integral value, which may lead to system instability. The role of the integral term is to eliminate the steady-state error of the system and ensure that the temperature is finally stabilized at the set value. Differential term D: D = Kd*(error-prev error). The differential term can predict the temperature change trend and adjust the control amount in advance, thereby improving the stability and response speed of the system. It adjusts the control amount according to the change rate of the error and responds quickly to the temperature change trend. S2-4, calculate the comprehensive control quantity u(k)=P+I+D, and update prev_error to error, preparing for the next calculation.
[0025] S3, using the PWM timer and PWM output interface of the STM32 microcontroller 5 to control the current and voltage of the TEC cooling piece 1: The calculated comprehensive control quantity u(k) is used to calculate the appropriate PWM duty cycle range: The value range of u(k) is [0, 100], and the automatic reload value of the PWM timer is set to 1000, then the duty cycle range dutyCycle = (u(k) / 100) * 1000; S4, dynamically adjust the duty cycle of PWM according to the control quantity output by the PID algorithm, and precisely control the temperature of the TEC cooling plate 1 by changing the direction of the current to achieve heating or cooling, so that the temperature of the baffle 4 is balanced with the ambient temperature. The TEC cooling plate 1 works based on the Peltier effect and achieves heating or cooling functions by changing the direction of the current.
[0026] Using this method to evaluate performance, the following test results were obtained: (1) Temperature control accuracy test: Under different ambient temperature conditions, such as -20℃, 0℃, 25℃, and 50℃, use a high-precision thermometer with an accuracy of more than ±0.1℃ as a reference standard to measure the actual temperature of the baffle. Set the set temperature value setTemperature of this system to different target temperatures, such as 10℃, 20℃, 30℃, etc. After the system runs stably, record the actual temperature value currentTemperature measured by the baffle temperature sensor and compare it with the set temperature value setTemperature. Take the average value of multiple measurements and calculate the temperature deviation. The experimental results show that the temperature control accuracy of this system is within ±0.5℃, which meets the requirements of infrared imaging equipment for baffle temperature stability.
[0027] (2) Imaging quality evaluation: Under normal ambient temperature, the infrared imaging equipment of this system and the same model of infrared imaging equipment that are not used are used to perform imaging tests on targets of different temperatures in the same scene, including low-temperature targets, such as ice cubes at -10°C, high-temperature targets, such as heating objects at 50°C, and targets with a large temperature difference from the ambient temperature, such as a human body at 35°C in a 10°C environment. Comparing the number of snowflake noise points, image clarity, temperature resolution and other indicators in the imaging results, the imaging of the equipment using this system has significantly reduced snowflake noise points, improved image clarity, and more accurate temperature resolution, which can clearly distinguish the temperature distribution details of the target object. However, the imaging of the equipment that does not use this system has more noise points, blurred image edges, and low temperature resolution, making it difficult to accurately judge the temperature characteristics of the target.
[0028] (3) Environmental adaptability test: The system was placed in a high and low temperature test chamber, and different environmental temperature gradients were set, from -40°C to +60°C, with each test point set at 10°C. After running stably for 2 hours at each temperature point, the system's temperature control performance, imaging effect, and the working status of each component were checked. The experimental results showed that the system could work stably throughout the entire test temperature range, the baffle temperature was controlled within the set range, the imaging device imaged normally, and the components did not have abnormal heating or damage, etc., proving that the system has good environmental adaptability and can meet infrared imaging requirements over a wide temperature range.
[0029] (4) System response speed test: When the ambient temperature changes suddenly, from 25°C to 10°C or from 10°C to 30°C, record the time required for the system to adjust the baffle temperature back to the set temperature value. The average value is taken through multiple experiments. The results show that when the temperature suddenly changes, the system can stabilize the baffle temperature near the set value in a short time of no more than 5 minutes, quickly respond to ambient temperature changes, and ensure that imaging is not affected by temperature fluctuations.
[0030] (5) Stability and reliability test: The system was run continuously for 1,000 hours, and the temperature control accuracy, imaging quality, and the working status of each part of the system hardware were regularly checked during the long-term continuous operation. The experimental results showed that the temperature control accuracy of the system remained stable during the long-term operation, the imaging quality was always good, and the hardware components did not fail, proving that the system has high stability and reliability and can meet the needs of long-term practical applications.
Claims
1. TEC infrared imaging temperature control system based on STM32, characterized by The invention comprises a TEC cooling sheet, an ambient temperature sensor, an STM32 microcontroller and a baffle. The TEC cooling sheet is circular and is installed inside a hollow circular baffle whose shape and size match the TEC cooling sheet. The ambient temperature sensor is arranged on the front side of the baffle. The baffle is also electrically connected to the baffle temperature sensor. A rotating motor is arranged at the bottom of the baffle. The STM32 microcontroller is electrically connected to the baffle temperature sensor via an I2C or 1-Wire interface. The STM32 microcontroller is electrically connected to the TEC cooling sheet via a PWM output interface. The power supply is electrically connected to the STM32 microcontroller and the rotating motor respectively. The ambient temperature sensor is electrically connected to the STM32 microcontroller via an analog-to-digital converter.
2. The TEC infrared imaging temperature control system based on STM32 as claimed in claim 1, characterized in that The TEC cooling plate is driven by a driving circuit, in which a MOSFET power driving module is provided. The MOSFET power driving module adjusts the current of the TEC cooling plate by controlling the gate voltage, provides driving current for the TEC cooling plate, and ensures that it switches quickly between heating and cooling modes.
3. The TEC infrared imaging temperature control system based on STM32 as claimed in claim 1, characterized in that The ambient temperature sensor and the baffle temperature sensor are both high-precision digital temperature sensors of model DS18B20, with a measurement accuracy of ±0.5°C and a measurement range of -55°C to +125°C.
4. TEC infrared imaging temperature control method based on STM32, characterized in that The STM32 microcontroller uses a PID algorithm to adjust the current of the TEC cooling chip to achieve temperature control. The specific steps are as follows: S1, set the set temperature value setTemperature of the STM32 microcontroller, and read the baffle surface temperature data on the baffle temperature sensor once in each temperature sampling period through the external analog-to-digital converter (ADC) in the STM32 microcontroller to obtain the actual temperature value currentTemperature; S2, calculates the current and voltage driving the TEC cooling plate through the PID algorithm: S2-1, initialize the proportional coefficient Kp, integral coefficient Ki and differential coefficient Kd of the PID algorithm, and initialize the variables used to store the previous error value prev_error and the integral term cumulative value integral, and initialize them to 0; S2-2 calculates the current error in each temperature sampling cycle, and the current error error = setTemperature –currentTemperature; S2-3, calculate the three parts of the PID algorithm respectively, Proportional term P: P=Kp*error; Integral term I: I= Ki*error; Differential term D: D = Kd*(error-prev error); S2-4, calculate the comprehensive control quantity u(k)=P+I+D, and update prev_error to error, in preparation for the next calculation; S3, use the PWM timer and PWM output interface of the STM32 microcontroller to control the current and voltage of the TEC cooling chip: The calculated comprehensive control quantity u(k) is used to calculate the PWM duty cycle range: The value range of u(k) is [0, a], and the automatic reload value of the PWM timer is set to b, then the PWM duty cycle range dutyCycle = (u(k) / a) * b; S4, dynamically adjusts the PWM duty cycle according to the control quantity output by the PID algorithm, and achieves heating or cooling by changing the current direction to accurately control the temperature of the TEC cooling plate, so that the temperature of the baffle is balanced with the ambient temperature.
5. The TEC infrared imaging temperature control method based on STM32 as claimed in claim 4, characterized in that The temperature sampling period is 10s.
6. The TEC infrared imaging temperature control method based on STM32 as described in claim 4, further, the value range of the comprehensive control quantity u(k) in S4 is [0, 100], that is, a is 100; the automatic reload value of the PWM timer is set to 1000, that is, b is 1000.