Design of foot bath temperature control system using AT89C2051 microcontroller

Publisher:风清扬yxLatest update time:2023-10-08 Source: elecfansKeywords:AT89C2051 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Design of foot bath temperature control system using AT89C2051 microcontroller

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.


Keywords:AT89C2051 Reference address:Design of foot bath temperature control system using AT89C2051 microcontroller

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

Design of intelligent fast charging system based on AT89C2051 single chip microcomputer
    1. Introduction   It has been 140 years since the French physicist Plante invented the lead-acid battery in 1859. Lead-acid batteries have the advantages of low cost, wide applicability, good reversibility, good high current discharge performance, high voltage of single cells, and can be made into sealed maintena
[Microcontroller]
Design of intelligent fast charging system based on AT89C2051 single chip microcomputer
Schematic diagram of 6-bit electronic clock based on AT89C2051
The principle of the 6-bit electronic clock using AT89C2051 is shown in the figure below. As long as the hardware connection is correct, success is guaranteed. In addition, the SET button in the picture is used to calibrate the time. Press and hold for more than 2 seconds to enter the calibration time state, shift gea
[Microcontroller]
Schematic diagram of 6-bit electronic clock based on AT89C2051
Application of X25045 in the design of stage lighting color changer
introduction Stage lighting effect design is an important part of stage scene design. At present, various new lighting equipment used in China, such as color changers, dimmers, computer lights, etc., are mostly imported from abroad, and there is almost no domestic production. For this reason, we designed a new stage l
[Microcontroller]
Application of X25045 in the design of stage lighting color changer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号