With the development of my country's economy and the in-depth advancement of scientific research, temperature monitoring and control systems are becoming more and more widely used in industrial design, smart instruments, daily household appliances and other fields. Electronic products based on single-chip microcomputer design have a broad application market and development prospects.
DS18B20 is a digital temperature sensor produced by Dallas Company, with ultra-small size, ultra-low hardware cost, strong anti-interference ability, high precision and strong additional functions. The temperature detection and digital data output of DS18B20 are integrated on one chip, with single bus data communication, binary output, resolution up to 12 bits, detection temperature range of -55~+125℃, and temperature limit alarm function. At the same time, DS18B20 has built-in EEPROM and 64-bit photolithography ROM, supports multi-point networking, and multiple DS18B20 can be connected in parallel on the only three buses as needed to realize multi-point temperature measurement in networking, which is convenient for the expansion and upgrade of temperature control system.
1 System Working Principle
In order to achieve the temperature regulation of the controlled object, the temperature control system designed uses AT89S51 single-chip microcomputer as the control core, including temperature sampling module, temperature display module, execution module, over-temperature indication module and keypad and other external circuits. The system clock frequency is 12MHz, and the intelligent integrated device DS18B20 is used to monitor the controlled object, convert the temperature value into a signed digital signal, and output it through a single bus, realizing the functions of temperature acquisition, conversion and transmission, which is conducive to simplifying the circuit. Considering the DC output driving capability of the single-chip microcomputer, triodes, 74LS244 and 74LS07 are used to drive the corresponding peripheral integrated circuits. The temperature data is dynamically displayed through 4 parallel common anode LEDs, and a keypad is built by itself to achieve the setting of the target temperature of the controlled object. The execution module uses solid-state relays SSR for photoelectric isolation to realize the control of 220V AC on and off by low-power DC, so that the relays that control the on and off of the heating tube and the start and stop of the fan are energized or de-energized, and high-power fans and heating tubes are used to achieve effective temperature regulation. The system uses LED lights of different colors to indicate the working status of the system. The red LED lights up to indicate an over-temperature or under-temperature alarm, and the green LED lights up to indicate that the system is working normally. The system composition is shown in Figure 1.
In the core control processing module AT89S51 microcontroller, in order to effectively suppress the random error of the temperature digital signal transmitted from DS18B20 and improve the measurement accuracy and anti-interference of the system, a digital filtering subroutine is added to the control program of the AT89S51 microcontroller. The digital filtering smoothing process eliminates the influence of the system random error as much as possible and improves the anti-interference ability of the system from the software aspect. MATLAB is used to fit the temperature measurement data to further correct the measured temperature value and make the measured value closer to the accurate value.
2 System Hardware Design
2.1 Power supply and temperature display module
To avoid crosstalk between signals, a 5V DC power supply is used to power the microcontroller, keyboard, solid-state relay control module, and 8-segment digital tube, and to provide a power-on reset voltage. At the same time, 220V AC power is provided for the fan and 400W heater.
The temperature display module uses four 8-segment digital tubes to display the temperature. In order to stabilize the display, a dynamic display method with bus delay is adopted. The drive circuit and bit selection are respectively composed of 74IS244 and 74LS07.
2.2 Keypad module
The keypad module is built by ourselves, which consists of four keys: reset key, confirmation key, plus 1 key and TAB key. The keyboard circuit is simple and clear, meeting the human-computer interaction requirements for setting the target temperature of the controlled object. The function description of each key is shown in Table 1.
2.3 Temperature data collection
DS18B20 uses a single bus dedicated technology, connected to the microcontroller through the I/O port line, and can directly output the measured temperature value (12-bit binary number, including the sign bit) without going through other conversion circuits. Its pin functions are as follows: the VDD pin is connected to the working power supply, and when working in parasitic mode, this pin must be grounded; the DQ pin is used for data input/output; the GND pin is grounded.
In this system, the interface circuit between DS18B20 and the microcontroller is shown in Figure 2. VDD is connected to the external power supply through a 1kΩ pull-up resistor, GND is grounded, and DQ is connected to the microcontroller P0.0 port through a single bus.
The relationship between the measured temperature and the output temperature of DS18B20 is shown in Table 2. The output temperature is a 12-bit binary number, which is stored in two 8-bit RAMs of DS18B20. The first 5 bits of the binary number are the sign bits.
2.4 Solid-state relay driver module
In this design, an AC solid-state relay SSR is selected, which is a contactless switch with a small input control current and a photoelectric isolator. By controlling the on and off of the DC power at the SSR input end, the on and off of the AC power at the output end can be controlled, and the starting performance is stable and the radiation interference to the power grid is small. The solid-state relay control circuit is shown in the system overall circuit diagram (Figure 2). At the load end, a series circuit consisting of 100Ω and 0.1μF is used to protect the fan and heating tube from overvoltage.
2.5 AT89S51 single-chip microcomputer control module
AT89S5l is the control core of the whole system, and it has built-in FlashROM for storing user programs. The temperature digital signal sensed by DS18B20 and the user's target temperature are used as input signals. After being processed by the control program, the corresponding control signal is issued to display the system working status, the temperature value of the controlled object, and control the power on and off of the SSR DC terminal, thereby controlling the power on and off of the fan and heating tube to achieve the temperature adjustment of the controlled object. Although the interface circuit between DS18B20 and the single-chip microcomputer and the solid-state relay control circuit are given in the overall circuit diagram (Figure 2), since DS18B20 and the execution equipment are set at the site of the controlled object, the corresponding signal transmission line must be reserved in practice.
3. System software design
The software part adopts program modular design to facilitate the debugging and implementation of various functions. The system software program mainly consists of three modules: main program, function implementation and operation control.
[page]
3.1 Main program module
The main program module uses a loop query until it exits to achieve the purpose of automatic hot and cold control of the temperature control system. The main program flow is shown in Figure 3.
3.2 Operation and control module
The operation control module includes three subroutines: digital filtering, PID algorithm, and temperature sensor control. Digital filtering is implemented by speed limit filtering, which can make full use of each sampling value to ensure the real-time sampling and the continuity of sampling value changes. The speed limit filtering subroutine flow is shown in Figure 4.
The PID algorithm is implemented by the integral separation PID algorithm. The integral separation method is used to cancel the integral effect when the controlled quantity begins to be monitored, and the integral effect is generated when the temperature value approaches the target value, effectively reducing the oscillation caused by the frequent start and stop of the system. The integral separation PID algorithm is:
In the formula, Y(K) is the target setting value of temperature, C(K) is the temperature measurement value after digital filtering, and △Y is the set maximum allowable deviation value. According to this algorithm idea, the integral separation PID algorithm can be implemented by assembly language programming.
The DS18B20 control subroutine is compiled according to the DS18B20 communication protocol, including DDS18B20 initialization, DS18B20 read and write control subroutines, which are programmed and implemented according to the corresponding rules.
3.3 Function Implementation Module
The function realization module includes subroutines such as temperature value setting, temperature display, solid-state relay on-off control and system operation status display. In the temperature display subroutine, it is necessary to complete the calling of each position segment code, the selection of the digital tube and the stabilization of the data bus (generally achieved by delaying a few ms).
4 System Debugging
The system debugging mainly involves the setting of PID parameters and the correction of system errors of temperature values. The setting of PID parameters and other system parameters first adopts empirical values, and then fine-tunes them one by one to meet the control accuracy requirements. According to the experimental data in Table 3, MATLAB is used to perform one-dimensional curve fitting and correct the system errors, so as to obtain more accurate measurement data.
The MATLAB fitting process and results are shown in Figure 5. In Figure 5, "O" represents (test value, standard value), "*" represents (test value, fitting value), and the one-dimensional curve fitting equation is: y=0.9948x-0.3996. The sampling value after digital filtering can be processed by this equation to obtain a more accurate measurement value.
5 Conclusion
From the perspective of application, this paper gives the detailed hardware and software design of the temperature control system for hot and cold regulation, making full use of the accuracy and convenience of DS18B20 single bus temperature measurement, and using speed limit filtering, integral separation PID algorithm, MATLAB one-dimensional curve fitting and other methods to improve the reliability of the system and the accuracy of the measured value. However, the anti-interference of the signal transmission line and the de-jittering of the keyboard keys are not perfect enough, and the experimental data processing by MATLAB is not fully sampled, and the temperature drift when measuring too high or too low temperature is not considered. Therefore, the design of the system needs to be further deepened and improved.
Previous article:ON Semiconductor's advanced motor control technology meets the demand for higher energy efficiency
Next article:Design of temperature alarm control system based on mobile phone text messages
Recommended ReadingLatest update time:2024-11-16 23:38
- Popular Resources
- Popular amplifiers
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Single-chip microcomputer technology and application - electronic circuit design, simulation and production (edited by Zhou Runjing)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- The relationship between LoraWAN, LPWAN and Lora
- [Perf-V Review] + Driver for dot matrix blocks under Hummingbird soft core
- Single lithium battery boost 12V1.5A, 18W
- DS90UB954+ DS90UB913 debugging problem help
- CAP function frequency measurement
- Why is the output filter capacitor of the WM8918 audio decoding DAC so large?
- DLP projection face changing mask
- Become a Xilinx FPGA Design Expert (Basics)
- A brief history of channel coding
- Connected cars, where is the future?