The difficulty in designing a foot bath lies in cost control and the design of the temperature control system. In recent years, switching power supply technology has gradually matured, providing a high-efficiency and low-cost solution for low-power power supply, abandoning the traditional low-efficiency power supply method of transformer step-down, rectification, and three-terminal voltage stabilization. Through the improvement of software algorithms, such as the use of PID algorithms, some hardware overhead can be reduced, costs and system complexity can be reduced, and the stability of the system can be improved. The design combines the above technologies, focusing on cost minimization and performance maximization, and realizes LED temperature display, dual-button target temperature adjustment, and high-precision temperature control functions. Since the main control chip AT89C2051 has only two sets of 16 IO pins and 2 kB of memory, it is necessary to make reasonable use of IO resources, simple program design, and reasonable allocation of memory space.
1 System structure design
The system consists of power supply, sampling, button, display and microcontroller parts.
The sensor is responsible for collecting the temperature value and passing it to the MCU. The target value is set by pressing the button. The MCU compares the sampled value with the target value. After processing by the time PID algorithm, it calculates the required heating time based on the different temperature difference values in each period. Then Control the closing and opening of the relay through the IO port to make the heating plate work, and at the same time, the LED displays the real-time temperature.
2 Design of sub-modules
(1) Power supply module. The power supply part adopts switching power supply technology. The use of switching power supply can solve the problems caused by traditional transformers. The entire design can be simplified; the power supply efficiency is high and stable; and the system structure volume can be reduced. Since the traditional base driving method limits the safe operating voltage of ordinary NPN switching transistors to BVceo, the emitter driving method can expand the safe operating voltage from Vceo to Vcbo. Since BVcbo》BVceo, NPN can be improved Type transistor's safe working range, ordinary NPN type power switch tube can be used for the grid voltage of 220 V. This circuit is connected to AC 220 V and passes through the rectifier bridge to form a DC voltage. R2 is the starting resistor. The switch tube is an NPN tube. The output current and output voltage signals are fed back to the emitter driver chip U2 through the optical isolation U3. U2 adjusts and controls the switch according to the signal. The duty cycle of the tube keeps the output stable.
(2) Sampling module. The sampling part uses DS18B20, which is a first-line programmable digital temperature sensor produced in Dallas, USA. It is different from the traditional analog temperature sensor. It can generate a digital signal corresponding to the temperature and only needs a single line of communication with the main control chip, making the system structure simple and reliable. Since the communication line is a bidirectional input-output OC gate, an additional pull-up resistor needs to be added to VCC. The timing requirements for communication between DS18B20 and MCU are strict, so it is necessary to turn off the interrupt function of the MCU during the sampling process to prevent external interference from collecting erroneous data.
(3) Control module. The control part of the south homomorphic relay (SSR) realizes the control of weak signals to strong electricity. Due to the application of the optical coupler inside the solid-state relay, the power required for the control signal is low, and the required operating voltage is compatible with common level standards such as TTL and CMOS, allowing direct connection. SSR has no mechanical action when working. It has the advantages that the traditional "coil-reed contact type" relay (MER) does not have, that is, high operating reliability and long life. In addition, SSR also has the ability to withstand higher current than the rated current. Approximately 10 times the surge voltage characteristics. Considering that the IO port driving capability of the 51 series microcontroller is weak, an additional PNP switch tube is required in the schematic design, as shown in Figure 3.
(4) Algorithm module. The thermal resistance wire has overshoot and overcooling phenomena, and the software PID algorithm can make up for the shortcomings of the hardware part. The PID algorithm is a fuzzy control algorithm that is widely used in parallel with proportion, integral, and differential. The mathematical model of the PID algorithm can be expressed by the following formula
Among them, Kp is the proportional coefficient; Ti is the integral coefficient; Td is the differential coefficient; e(t) is the deviation between the sampling value and the target value. The proportional part is represented by the formula Kp*e(t). If Kp is larger, the transition process will be faster and oscillation will easily occur. Therefore, proper selection of Kp can achieve a rapid transition and stable effect. The points part is. It can be seen from the expression that as long as there is a deviation, the control effect of the integral part will continue to increase. Only when the deviation part e(t)=0, the integral expression will be a constant. Among them, the integration time Ti has a greater influence on the integral control. The larger Ti is, the weaker the integration effect is and the longer it takes to eliminate the deviation. The smaller Ti is, the stronger the integration effect is and the shorter the time required to eliminate the deviation, but it is easy to produce oscillation during the elimination process.
The differential part expression is
The function of the differential part is to suppress deviation changes. The larger the Td, the stronger the inhibitory ability; the smaller the Td, the weaker the inhibitory ability. Obviously the differential part plays a greater role in the stability of the system.
Because the computer cannot continuously output the control value like analog control, it can perform continuous control. Therefore, the above equation needs to be discretized. The idea of discretization is: use T as the sampling period, divide the continuous time t into k sampling periods, that is, t = kT, and substitute t into equation (1) to obtain the discrete PID expression
The advantage of using the incremental PID algorithm is that it can reduce the computing tasks of the computer, and the incremental algorithm only depends on the values of the current moment, the previous moment, and the previous moment, and is not sensitive to the starting parameters.
The values of the three coefficients depend on actual experience. In order to achieve better control effects, the optimal PID control parameter values are measured experimentally in each temperature area. The system PID algorithm flow is shown in Figure 4.
It can be seen from Figure 4 that if the output value is x, the heating time within 2 s is x × 20 ms, and the non-heating time is (2 000-x·20) ms.
(5)PCB design. Based on the principle of strong electricity and weak points, analog signals and digital signals need to be separated. Take the following measures when designing your PCB:
1) Since a switching power supply is used for power supply, attention must be paid to isolating the high-frequency and high-voltage parts from the low-voltage DC parts.
2) The system is sensitive to noise. Since digital devices, especially MCUs, will cause current changes when switching, resulting in voltage noise, it is necessary to use a star wiring topology on the wiring to provide separate power supply to sensitive devices.
3) The digital ground needs to be paved over a large area, and each device must be individually connected to a 0.01μF high-frequency decoupling capacitor. On large-scale digital devices (such as MCU), an additional 47μF electrolytic capacitor is required to suppress interference. . The analog and digital parts are isolated, i.e. connected to digital ground at a single point where appropriate.
3 test results
(1) Design requirements.
1) Heating from room temperature to 40°C must be controlled within 30 minutes.
2) After starting PID control, the fluctuation range of water temperature needs to be within ±0.5°C of the target temperature.
(2) Experimental data.
According to the design requirements, the target temperature is set at 47°C, which is controlled according to the PID algorithm starting from 46.5°C. After stabilization, the water temperature change range should be within ±0.5°C.
Starting from room temperature, the water temperature rises steadily, about 0.7°C every minute, as shown in Table 1.
After reaching 47°C, the water temperature is controlled between 46.5 and 47.5°C, as shown in Table 2 and Figure 5.
4 Conclusion
This foot bath uses the cheap AT89C2051 and makes full use of all its resources. 11 of the two sets of IO pins are used as LED digital tubes to display the temperature. The remaining 5 pins are used as relay control pins, reset button, DS18B20 temperature acquisition interface and two temperature adjustment buttons. The PID algorithm is used to solve the problem of overshoot and overcooling of the thermal resistor, reducing hardware requirements and thus reducing costs. Experiments have proven that this temperature control system operates stably and has high accuracy.
Previous article:How to make a countdown timer using AT89C2051 microcontroller
Next article:Wireless data transmission design between AT89C52 microcontroller and PC
Recommended ReadingLatest update time:2024-11-16 09:38
- Popular Resources
- Popular amplifiers
- Learning MCU Technology from Scratch (Liu Jianqing)
- Wireless doorbell alarm based on AT89C2051 single chip microcomputer
- Infrared remote control LED electronic clock using real-time clock chip DS1302+AT89C2051
- Infrared remote control LED electronic clock using real-time clock chip DS1302+AT89C2051.rar
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