Production of temperature control system for single chip thermostat

Publisher:忙中取乐Latest update time:2013-01-25 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  The main principle of this design is that the single chip microcomputer compares and processes the temperature value collected by the temperature sensor with the set constant temperature value in real time, thereby monitoring and maintaining the temperature value of the sample container box. This paper gives the system's scheme design, hardware circuit, software design, troubleshooting and system debugging.

  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

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

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

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

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

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

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.

Reference address:Production of temperature control system for single chip thermostat

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

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

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号