Temperature control It is widely used in both industrial control and consumer electronics, such as the control of boilers and heating furnaces in industrial control, and the control of water heaters and water dispensers in consumer electronics. Temperature control is involved internally. The current abundance of control algorithms also provides convenient conditions for temperature control. The more commonly used ones are proportional integral differential (PID) control and fuzzy control.
1 System Hardware Design
This system uses SPCE061A as the control core, including four modules: sensor circuit, keyboard and display circuit, relay control circuit and UART communication circuit. The 10-bit A/D converter of SPCE061A is used in combination with PT100 temperature sensor to complete the sampling of water temperature. The interference factors of the system are eliminated through digital filtering and other technologies to restore the current temperature value, which is displayed through the digital tube, and the collected temperature value is processed by PID operation to realize the control of water temperature. In addition, the system also needs to realize the communication function between the upper and lower computers of PC and single-chip microcomputer, and display the temperature heating curve in real time on PC. The overall block diagram of the system is shown in Figure 1.
1.1 SPCE061A core controller
SPCE061A is a 16-bit u'nspTM core microcontroller, which can not only realize basic control functions but also has some DSP functions. The chip has built-in 32k FlashROM and 2 k words of SRAM, and also integrates ADC, DAC, AGC amplifier circuit, etc. It is a powerful SOC chip. The chip has 8 10-bit precision ADCs, one of which is an audio conversion channel, and the other 7 can be used as ordinary AD conversion channels. It can realize simple addition and subtraction operations. In order to handle complex arithmetic operations, a hardware multiplier is added, which can perform n inner product operations. The highest system clock can reach 49 MHz. The high processing speed enables SPCE061A to perform complex arithmetic and logical operations very easily and quickly. This system uses the 61 board, which is the development system of SPCE061. In addition to the minimum system of the single-chip microcomputer, the 61 board also has power supply circuits, audio circuits, reset circuits and buttons.
1.2 Sensor Circuit
The sensor circuit consists of two parts: a measuring bridge and an amplifier circuit, as shown in Figure 2.
The temperature sensor of this system uses a platinum thermal resistor temperature sensor PT100. The physical and chemical properties of the platinum thermal resistor are very stable in high temperature and oxidizing media. It can be used as an industrial temperature measurement element, and this element has good linearity. At 0-100°C, the maximum nonlinear deviation is less than 0.5°C. R2, R3, R and PT100 form a sensor measurement bridge. In order to ensure the stability of the bridge output voltage signal, the input voltage of the bridge is stabilized to 2.5 V through TL431. The differential signal obtained from the bridge is amplified by a two-stage op amp and then input into the microcontroller. One arm of the bridge uses an adjustable resistor R3. By adjusting R3, the size of the differential voltage signal input to the op amp can be adjusted, which is usually used to adjust the zero point.
The amplifier circuit uses the LM358 integrated operational amplifier. In order to prevent the nonlinear error caused by the excessively high single-stage amplification factor, the amplifier circuit uses two-stage amplification, as shown in Figure 2. The first stage is about 10 times, and the second stage is about 3 times. The temperature changes from 0 to 100℃. When the temperature rises, the resistance of PT100 increases, the differential signal input to the amplifier circuit increases, and the output voltage AV of the amplifier circuit increases accordingly. [page]
1.3 Keyboard and display circuit
The keyboard directly uses the keys that come with the 61 board, and can be used without connecting additional hardware. The display circuit is implemented using an LED keyboard module, which is powered by DC 5 V and integrates LED, KEY, and digital tube functions. It is used as an expansion module for SPCE061A peripheral devices. The LED module expands the 6-bit 8-segment digital tube, and the maximum display data is 999 999; there are 8 light-emitting diodes, 8 keys (can be composed of 1x8KEY or 2x4KEY), and 1 potentiometer, which can provide 0-5 V analog voltage signals or 0-3.3 V analog voltages, which are related to the VDD input of the module. The keyboard and display circuit are mainly used to set and display real-time temperature.
1.4 Relay control circuit
The main power device of this system is an AC 220 V/1 000 W electric heater, which is driven by a relay. The relay is the OMRONG6B-1174P relay, which has the advantages of low trigger voltage (DC: 5 V), large controllable power (AC: 8 A, 250 V), and short response time. The relay is driven by the NPN8050 transistor. When the control terminal Ctrl is loaded with a high-level signal, the transistor is turned on and the relay works. When the control terminal Ctrl is a low-level signal, the transistor is turned off and the relay stops working. There is a freewheeling protection circuit around the relay.
The circuit and working indication circuit of the power drive part are shown in Figure 3. Ctrl is the relay control signal input terminal, which is controlled by IOA7 of the single chip microcomputer. J2 is the switch interface for controlling the heater.
2 System Software Design
The control idea of the system program: After setting the target temperature, the system samples the water temperature, and generates four output parameters through PID calculation based on the preset temperature, current temperature, historical deviation, etc. The heating time is controlled by this parameter, thereby adjusting the average power of the heater and realizing the PID control of the system. The overall function is realized by the cooperation of the main program and the interrupt service program. The interrupt service includes IRQ5_2Hz interrupt, IRQ5_4Hz interrupt, IRQ2_TimerB interrupt and IRQ6_TMB2 (1 024 Hz) interrupt. The main program flow and the main subroutine flow are mainly introduced here. The system first initializes I/O, TimerB, UART and other components, and then enters the main loop to perform temperature sampling and related processing. The core idea of the software design of this system lies in the realization of PID control. The target temperature can be reset by pressing KEY3 during the operation of the system. The main program flow is shown in Figure 4.
2.1 A/D conversion subroutine
A/D conversion: The temperature sampling operation is performed every 1 second. 18 A/D conversions are performed for each sampling. This is done in the IRQ5_2Hz interrupt service routine. IRQ5_2Hz is used to provide 1 second to determine the time interval for AD sampling. The A/D conversion subroutine flow chart is shown in Figure 5.
2.2 Implementation of temperature PID control
This solution uses the positional PID algorithm, takes the temperature sensor sampling input as the current input, and then subtracts it from the set value to get the deviation, and then performs PID operation on it to generate the output result four, and then lets four control the timer time to control the heater. IRQ2_TimerB provides an interrupt signal with an overflow frequency of 64 Hz, and cooperates with the PID operation result four of the main program to determine the heating time and realize the heater power regulation. The flow chart of this subroutine is shown in Figure 6 below.
3 System operation performance test
The key to this system is PID control. For a PID system, the performance of the system mainly depends on the setting of the PID control parameters. From the PID control principle, we know that: proportional (P) control can quickly respond to errors and reduce steady-state errors: the increase in proportional action will cause system instability. The role of integral (I) control is that as long as there is a deviation in the system, the integral action will continue to accumulate and output the control amount to eliminate the error; too strong an integral action will increase the overshoot of the system and even cause the system to oscillate. Differential (D) control can reduce overshoot, overcome oscillation, improve the stability of the system, and at the same time speed up the dynamic response speed of the system, reduce the adjustment time, and thus improve the dynamic performance of the system.
The basic functions that this system can achieve are as follows:
1) Real-time collection and display of temperature:
2) The temperature change can be processed in time and PID adjustment can be applied;
3) Realize communication between upper and lower computers through UART, and display the temperature change curve on the upper computer.
During the system debugging process, by changing the key PID system parameters Kp and Kd, the changes in system operating performance are observed to put the system in the best operating state. The following is the test process and test results.
1) The corresponding curve of Kp=1.5, Kd=1.0 (temperature rise: 20~40℃) is shown in Figure 7. It can be seen from the figure that the overshoot is too large due to the excessive value.
2) The corresponding curve of Kp=1.2, Kd=1.0 (temperature rise: 40~60℃) is shown in Figure 8. It can be seen from the figure that due to the small value, the system's rapidity is poor and the response is relatively slow.
3) The corresponding curve of Kp=1.3, Kd=1.0 (temperature rise: 30~50℃) is shown in Figure 9. It can be seen from the figure that due to being too small, the overshoot of the system is relatively large and the predictability is poor, resulting in long-term temperature overshoot.
4) The corresponding curve of Kp=1.3, Kd=2.0 (temperature rise: 50~70℃) is shown in Figure 10. It can be observed from the graph that if the selection is moderate, the overshoot of the system is very small, and the overshoot lasts for a short time before the equilibrium point is restored.
Through the above measurement curve analysis, Kp=1.3, Kd=2.0 are finally selected. At this time, the temperature control indicators are as follows: static error: T≤0.5℃; resolution: 0.1℃; overshoot: T≤0.5℃. In this case, the system operation can reach the best.
4 Conclusion
Based on the DSP function and fast processing capability of the 16-bit single-chip microcomputer SPCE061A, the data acquisition and calculation processing of this system are very convenient and simple. In addition, since the IDE supports the standard C language function library, complex mathematical operations become easy, greatly reducing the difficulty of programming. In addition, VC is used to realize the communication between the upper and lower computers, and the temperature change curve is directly displayed on the upper computer, the control performance is directly observed, and the PID parameters of the system are appropriately modified according to the curve to optimize the control.
Previous article:Design of Temperature Measurement Circuit Using Single Chip Microcomputer
Next article:Design of self-adaptive electric water boiler based on single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 18:00
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- Now DCDC design tools are made like this
- The disappearing boundary between MCU and MPU
- DS18B20 STM32G474 driver
- 【Fudan Micro FM33LC046N】Clock output test
- Python Basics: Dictionary Application
- A brief introduction to vehicle-mounted domain controllers
- Design of LED emergency lighting controller based on MSP430
- Disassembly of Taiwan TES-1316 temperature meter with temperature recording function
- Allwinner R528 core board and development board
- Pay attention when drawing and punching PCB!!