The main performance indicators of the system are: (1) Constant temperature value setting range: 20-50℃, minimum resolution: 1℃; f 2) Digital tube displays the actual temperature value, display range: 0-99℃; minimum resolution: 0.1℃; (3) Temperature control error: ≤4-1℃; (4) Display accuracy: absolute error of temperature control ≤±3℃. In view of fan cooling, the ambient temperature is higher than 20℃. The lower limit of the constant temperature moves up accordingly.
1. System design
This system is based on the application development of the classic C51 series single-chip microcomputer, and is a digital control system that integrates ambient temperature signal acquisition, data processing, temperature control, etc. At the same time, the system is designed with a friendly human-computer interaction interface and simple setting buttons.
The system consists of the following functional modules: MCU module, display module, power module, button setting module, and temperature acquisition module.
Cooling module and heating module. The system solution block diagram is shown in Figure 1.
Figure 1 System solution frame
2. Component Selection
The MCU of this design adopts sTC89C52 single-chip microcomputer; considering the need to save the use of devices. The temperature sensor adopts the single-bus digital temperature sensor DSl8820, which does not need to be connected to A, D converters, and the sampling value can be directly sent to the single-chip microcomputer for processing, which is simple and convenient; the system uses an ordinary single-pole relay HK4100F as a control switch; two cement resistors (10W, 10Ω) are connected in series as heating devices, and low-voltage (maximum 24V) power supply is safe and reliable; a small fan is powered by 5V DC to achieve the purpose of cooling or making the container evenly heated; an ordinary key switch is used to realize the adjustable setting function of the constant temperature; the three-in-one digital tube displays the current temperature value of the container in real time, which is simple and low-cost, and realizes the goal of human-computer interaction interface.
3. Hardware Circuit Design
According to the system solution, the main module interface circuit is outlined; 1. Power module. 12~24V AC input, the input AC voltage provides electrical energy for the heat generated by the cement resistor; the input AC voltage is rectified and filtered, and connected to the voltage regulator chip 7805 to convert it into 5V DC voltage (VCC) to supply the MCU and its peripheral systems.
2. Display module. Common anode digital tube, segment selector connected to the P1 group pin of MCU I/013. 9012 transistor is used as the digital tube position selector switch, and the position selector is controlled by pins P2\'5, P2\'6, P2"7, etc. The three-digit digital tube displays the current temperature (sampled temperature) value, one of which is the decimal place. The other two are the tens place and the digits respectively.
3. Heating module. It mainly works according to the comparison result between the set constant temperature value and the sampled temperature value. That is, when the sampled temperature value is greater than the set value, the relay is closed and the cement resistance heating is turned on, otherwise it is disconnected.
In Figure 2, JD1 and JD2 are connected in series with a cement resistor and one end of an AC power supply respectively, and the relay is controlled by the P2\'4 pins of the microcontroller.
Figure 2 Circuit diagram
4. Button setting module. In order to save materials and hardware resources, the system is designed with three buttons. When setting the constant temperature value, one is used for increasing input; another is used for decreasing input; and the third is reserved. One end of the three buttons is grounded. The other ends are connected to the P2\'1, P2\'3, and P2"2 pins of the MCU respectively.
5. Cooling module. Install a small fan, powered by 5V DC voltage, and control the working state of the fan with a relay to achieve intelligent control. It mainly works according to the comparison result between the set constant temperature value and the sampled temperature value. That is, when the sampled temperature value is greater than the set value, the relay is closed and the fan cooling is started. Otherwise, it is disconnected. The relay is controlled by the P2"3 pin of the microcontroller.
6. Temperature acquisition module. The temperature acquisition module uses a DS18820 temperature sensor operated by a single bus as a temperature collector. The method of obtaining temperature values from the temperature sensor is very simple, without the need to connect an A, D converter. The temperature measurement can be realized and the measured data can be directly sent to the microcontroller for processing. The system can also realize the temperature measurement and display. Among them, the data pin of the temperature sensor is connected to the P3"5 pin of the microcontroller. [page]
4. System software design
1. System software overview, as shown in Figure 3, the main process of the system software is an infinite loop program. Its main tasks are:
(1) Initialize the system. Mainly complete the configuration of related MCU registers, initialize global variables, etc.
(2) Determine whether the setting button is pressed. If it is pressed, enter the setting process and set the timer for 10 seconds. If no button is pressed after 10 seconds, exit the setting process.
(3) Collect temperature and process data. Mainly reset DS18820 and read the value, process the obtained data and finally convert it into decimal number for digital tube display.
Figure 3 Main program flow chart
2. Part of the software program code is shown. The software is designed using Keil C51 to develop and write the software program. The software program mainly consists of the main program, initialization subroutine, subroutine for reading DS18820 sensor data, temperature data processing subroutine, display subroutine, interrupt timing subroutine, and key setting subroutine. Since the subroutine for reading DS18820 data involves the underlying hardware interface, the subroutine is written in assembly language. In addition, all other program codes are written in C language.
Main program:
[page]
Digital tube display program:
Temperature control subroutine:
5. PCB design and hardware welding
Use Altium Designer software to draw the design system PCB diagram.
As shown in Figure 4. When designing PCB, pay attention to the following issues: 1. Arrange components according to module circuit combination. That is, arrange components of the same module as close as possible to avoid complicated wiring and difficulty in finding, detecting or troubleshooting faults; 2. Ensure safe line spacing during wiring, and set wiring rules. It is best to wire manually; 3. Interfaces that need to be connected to the outside world are generally placed on the edge of the PCB; 4. Filter capacitors.
It needs to be close to the device accessories to be filtered, and the interconnecting wires should not be too long. Otherwise, the filtering effect will be affected. Check to ensure that the manufactured PCB has no short circuit, open circuit or wrong connection, and then solder the corresponding components to the manufactured PCB.
Figure 4 PCB diagram
6. System debugging and troubleshooting
Use a multimeter to check the connection lines of the hardware; ensure that there are no short circuits or open circuits in the hardware circuits. Use the download software provided by Hongjing Technology (as shown in Figure 5) to download the program to the STC89C52RC microcontroller. Then perform software and hardware combined debugging.
Figure 5 Download software interface
During the debugging process, the following faults were encountered. The download was successful and the system was powered on. At the beginning, the program ran normally with the expected effect - the digital tube displayed the temperature value. But in less than 1 minute, the digital tube no longer displayed. At this time, I touched the MCU with my hand and found that the temperature was normal and not hot. Pressing the reset button was ineffective; then unplugging the power supply and testing the digital tube with a multimeter. The digital tube was intact; later, another intact MCU was replaced, and the problem still existed; finally, I started to check the hardware problem and found that the electrolytic capacitor on the MCU reset circuit was welded upside down. The capacitor was replaced and the problem was solved. Use the WNY-03 type 0-1 50℃ mercury thermometer head to insert into the temperature control sample container box to measure the deviation between the control value and the actual value at 20℃, 30℃, 40℃, and 50℃.
VII. Function Introduction
The finished product is shown in Figure 6. The functions of the entire system are as follows: (1) It has a simple and feasible temperature acquisition function. (2) It compares the acquired temperature value with the set constant temperature value and decides whether to heat or cool the system environment to achieve automatic temperature control. (3) It achieves constant temperature in a small environment (such as a sample container box).
Figure 6 Finished product effect display
8. Summary
This design uses a classic low-cost single-chip microcomputer as a microcontroller, and designs a temperature-controlled sample container box with friendly human and interactive interface and high intelligence. In addition, it should be pointed out that the system still has room for improvement, such as the use of SMD packaged components and semiconductor refrigeration devices. There is also a lot of room for improvement in software. For example, the application of program filtering algorithms will further reduce temperature errors, which will make the system more accurate, power-efficient, and have a wider temperature control range.
Previous article:Design of Temperature Measurement System Based on Single Bus Digital Temperature Sensor DS18B20
Next article:Design of a two-color clock without hands based on single chip microcomputer
- Popular Resources
- Popular amplifiers
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
- [Mil MYC-JX8MPQ Review] 3. GPIO Application Programming
- 【Laser target detector】I2C and SPI
- The inverter outputs a sine wave, so how do we measure the harmonics and waveform distortion of the output voltage?
- Understand the MSP430F149 comparator by looking at a picture
- MOS tube knowledge
- 【GD32L233C-START Review】-I. Unboxing and Hardware Appreciation
- PCB technology: PROTEL's metal slot method
- [ATmega4809 Curiosity Nano Review] Using MCC to configure TCA
- circuitpy compass
- In a blink of an eye, half of this year has passed.