0 Preface
At present, water temperature control is widely used in many fields such as food, medicine, chemical industry, and home appliances. The quality of water temperature control directly affects the quality of the product. Therefore, water temperature control is of great significance. The task and requirement of this design is that 1 L of water is heated by a 1 kW electric furnace. The water temperature can be set manually within a certain range and can be automatically adjusted when the ambient temperature drops to keep the set temperature basically unchanged. Main performance indicators: The temperature setting range is 25.0~100 ℃, the minimum resolution is 0.1 ℃, the static error of temperature control is less than or equal to 0.1 ℃, the SMC1602A LCD module is used to display the actual water temperature and the three main parameters Kc, Ti, and Td in the PID control algorithm. The output of the PID controller and the temperature sampling value are displayed on the PC using the serial port debugging wizard.
1 System Solution
This design is based on the STC89C52 microcontroller and uses the temperature sensor DS18B20, RS232 standard interface and PID control algorithm to control the temperature.
The water temperature control system is a typical detection and control application system, which requires the system to complete the whole process from water temperature detection, signal processing, input, operation, to output control of electric furnace heating power to achieve water temperature control. This design realizes the intelligent control of water temperature and provides a complete human-computer interaction interface and PC and single-chip communication interface. The system consists of PC and single-chip communication module, temperature detection and display module, PID control algorithm and other modules. Its feature is that it uses PC and single-chip communication. The system block diagram is shown in Figure 1.
2 Hardware Circuit Design
The overall design of this circuit includes four parts: host control part (STC89C52), temperature sampling and display circuit, temperature control circuit, and PC and microcontroller communication circuit.
2.1 Host control part
The host control part is the core of the circuit. The system is controlled by the single-chip microcomputer 89C52. The single-chip microcomputer 89C52 has an internal program memory of 8 KB units and a data memory of 512 B. Therefore, the system does not need to expand the external program memory and data memory, which can greatly reduce the complexity of the system hardware part.
2.2 Temperature sampling and display circuit
The signal acquisition and display circuit of the system mainly consists of two parts: temperature sensor DS18B20 and SMC1602A liquid crystal display module.
DS18B20 uses a unique single-line interface. When connected to a microprocessor, only one line is needed to achieve two-way communication between the microprocessor and DS18B20. The temperature measurement range is -55~+125℃, the inherent temperature measurement resolution is 0.5℃, the working power supply is 3~5 V/DC, and no peripheral components are required during use. The measurement results are transmitted serially in 9~12 bit digital quantity mode. It is suitable for temperature measurement of various medium industrial pipelines of DN15~25, DN40~DN250 and equipment in narrow spaces.
SMC1602 LCD has been widely used in pocket instruments and low-power application systems for its advantages of low power consumption, small size, and flexible use. LCDs can usually be divided into two categories, one is dot matrix type and the other is character type. Dot matrix LCDs usually have a large area and can display graphics; while general character LCDs have only two lines and a small area, and can only display characters and some very simple graphics. They are simple, easy to control and low cost. At present, most of the character LCDs on the market are based on the HD44780 LCD chip, so the control principle is exactly the same. The control program written for HD44780 can be easily applied to most of the character LCDs on the market. Character LCDs usually have 14 pin lines (there are also many LCDs with 16 pin lines on the market. The extra 2 lines are the power line VCC (pin 15) and the ground line GND.
2.3 Temperature Control Circuit
This part of the circuit is mainly composed of photocouplers, transistors and relays.
The withstand voltage of the photocoupler is 400 V. Its output stage controls the on and off of the normally open contacts of the relay after amplifying the power through the transistor, thereby ultimately achieving the purpose of controlling the electric furnace. The 100 Ω resistor and the 0.01 μF capacitor form a bidirectional thyristor protection circuit.
2.4 Communication circuit between PC and MCU
In order to make the system have a better human-computer exchange interface, we designed the microcomputer control interface through Visual Basic language in the system design. The communication between the system and the microcomputer greatly improves the performance of the system in all aspects.
Since the serial port of the microcontroller 89C52 is TTL level, and the PC is RS232 level, the system uses the MAX232 level conversion chip to perform level conversion.
Because the system is designed with communication function, that is, the communication between the main system (89C52) and the PC, it is more obvious when observing the output of the PID controller, which greatly reduces the difficulty of parameter setting. In addition, the sampling value of the system can be seen through the visualization window.
3 Software Design
The software design of this system mainly includes three parts: software design of PC and single-chip microcomputer communication module, software design of temperature sampling and display circuit module, and software design of temperature control module.
3.1 Main program flow chart
The main program flow is shown in Figure 2. The program mainly completes the following tasks:
(1) Initialization: Set the initial values of each parameter, set the serial port, timer and LCD display module.
(2) Communication between PC and MCU: This part of the program mainly completes the mutual transmission of data between PC and MCU, which is mainly completed through the half-duplex serial port of 89C52 MCU, thereby completing the connection with the microcomputer control interface RS232 and the control of communication.
(3) Temperature acquisition and display: mainly completes the acquisition of temperature signals and processes the converted digital quantities, and then uses a character liquid crystal display module to display the real-time temperature.
3.2 PID Control Algorithm
The PID algorithm is the decisive factor in the performance of this temperature control system. Its general formula and analog control law expression are as follows:
In the formula, u(t) is the output of the controller; e(t) is the deviation, that is, the difference between the set value and the feedback value; Kc is the controller's amplification factor, that is, the proportional gain; Ti is the controller's integral constant; Td is the controller's differential time constant. The principle of the PID algorithm is to adjust the three parameters of Kc, Ti, and Td to make the system stable.
Since the general PID formula is not easy to process with a single-chip microcomputer, an incremental PID algorithm is used in the design. Convert formula (1) into:
u(k) in equation (3) is the on-time of the output PWM wave. Its control algorithm is shown in Figure 3.
4 Test methods and test results
4.1 Test Method
Put 1 L of clean water in the electric stove, connect the electric stove to the control system, power on the system, and the system enters the ready-to-work state. Set the temperature to 35.3 ℃, 40.2 ℃, 45 ℃, 60 ℃, 74.0 ℃, and 81 ℃ respectively, observe the set temperature and actual temperature, and record the data. Fill in Table 1, observe the dynamic situation of water temperature changes, and record the time when the temperature stabilizes, and fill in Table 2.
4.2 Test Results
The data comparison of the set temperature and the measured temperature is listed in Table 1. Table 2 lists the relationship between temperature stability and time. The set temperature in Table 2 is 50℃, and the measured temperature is recorded every 30 seconds.
5 Conclusion
From the data in Table 1, it can be seen that the error of the system is basically stable at ±0.3 ℃, so it can well meet the design requirements of the system. From the data obtained in Table 2, it can be seen that the system has basically reached stability after running for 5 minutes, indicating that the system can well control the temperature to reach the ideal value, providing a reference for tasks that require precise temperature control. At the same time, the system realizes the communication between the PC and the single-chip microcomputer, and displays the control parameters and control results on the PC, which is convenient for monitoring and realizes temperature control and intelligent monitoring.
Previous article:Design of two-way temperature controller based on 51 single chip microcomputer
Next article:Infrared sensor CO2 gas detection circuit design
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
- I hope this book "PCB Design Secrets" will be passed on to you!
- [National Technology Low Power Series N32L43x Evaluation] 3. Key Driver + SPI_LCD Screen Driver
- A comic book about CircuitPython and Mu
- Is there any ADR3433 chip that can be replaced by PINTOPIN?
- [National Technology N32G457 Review] Comparison of two N32G457 development tools and lighting programs
- 【Distributed temperature and humidity acquisition system】+temperature and humidity acquisition module
- MSP430 Remote Upgrade Solution
- Calculate the frequency of the sinusoidal signal collected by msp430
- I recently used a chip that is compatible with both RS232 and RS485, but I don't know which pins are A and B for RS485.
- [ATmega4809 Curiosity Nano Review] Configuring GPIO using MCC