The adjustable temperature controller circuit is relatively simple and does not have a temperature adjustment function. This is reproduced a controller that Wen Zhengwei published in the radio magazine that can easily adjust and set temperature.
1. Features
The temperature controller designed by the author is still a commonly Electric Filter Fan Cabinet Heater Fan Heater with Thermostat used DS18B20 integrated temperature sensor, or it is displayed in seven -segment digital tube. The CPU that completes the temperature collection and processing control is still the AT89C2051 single -chip microcomputer, but the circuit has a simple circuit. There is no need to debug it to make. After installation, you can use the advantages of convenient DIY.

The biggest feature of this circuit is the temperature value that can be limited to intuitive and convenient adjustment. The temperature value is displayed in 3 7 sections of the aode digital tube. After power -on, the current temperature value will be displayed. Display the setting temperature value. At this time, you can adjust the setting temperature value according to the up/down downside key. When you press the settings key again, return the current temperature display. At the same time, the set temperature value will be saved. In the middle, it will not be lost after the power is lost. When the power is called next time, the single film will automatically read the temperature setting value of the last time. Long press the settings to turn off the display and temperature control, and open the function again when pressing again. The circuit is also designed with relay control, and the relay is driven by the setting temperature in the program to be driven by the set temperature.
2. Component background and selection
Table first is the list of components. The two key components in this circuit are single -chip microcomputers AT89C2051 and temperature sensing sensing chip DS18B20. The AT89C2051 has a 2K Flash memory with a multiple times, and has 15 I/O ports. It is a good choice to make some small control display and data collection system. In this production, the 2051 single chip machine must complete the data collection. In addition to the task of processing, control, and display, the collection and processing of key values ??must be completed. It is relatively difficult to achieve with conventional digital plus analog circuits. DS18B20 is a single -bus digital temperature sensor designed and produced by Dallas Semiconductor Corporation (now MAXIM). The range is 3-5.5V. In addition to the 8pin patch type of SO/USO, the form of TO -92 in the form of more convenient transistor (please see Figure 1 in the form of packaging and pin explanation). The measurement temperature range of DS18B20 is -55 ° C ~+125 ° C. The sub-debate rate of A/D conversion can be controlled by 9, 10, 11, and 12, respectively. In the range of -10 ~+85 ° C, its accuracy is ± 0.5 ° C. This accuracy can meet the requirements of ordinary environmental temperature control or temperature measurement consumer electronics. There are three 8 -bit E2RAM units in DS18B20 (non -easy -to -use electrococchemable wiper storage). You can read and write the temperature value and a custom value of the upper and lower limit alarm. In this production, only the upper limit temperature value unit is used. Each DS18B20 has a unique sequence number when it is left, which means that multiple DS18B20 can be controlled in the same single bus system. The operation method of the single total line of DS18B20 is impossible to explain one by one due to space issues. Interested readers can view the DS18B20 data by themselves.
3. Circuit principle
DS18B20 uses the power supply method of external power supply. The data end is pulled up with a 4.7K resistance and connected to the 11th foot of 2051.
The crystal uses 12M and uses a simple power -on reset circuit. Select a digital tube with common anode, drive with S8550, and segment pins are connected to the P1 port of 2051 through the 470 euro electric liquid resistance. If the selected digital tube is insufficient, the small -limited current resistance value can be adjusted. The author has also used a co -cathode digital tube to provide current with a 1K resistance on the P1 port. The brightness is not high, but it can save three digits of the IO foot, and the circuit is simpler. There are three keys in the circuit, which display the switch/temperature settings, the temperature is up, and the temperature is down. When the electric running on the circuit is initially closed, click the S2 circuit to start display and monitor. Enter the temperature setting state, and the setting value flashes once every second. At this time, you can press S1 or S3 for adjustment, and then press S2 to return the current temperature state and save the temperature value to the DS18B20. Use the 9th pin of 2051 to control the output end, which is effective at low level. I use it to drive a 5V relay through 9012. The author installs this circuit on the front panel of the computer. The heat dissipation fan connected to the chassis at the contact end of the relay sets a temperature value such as 28 degrees. When the temperature in the case exceeds 28 degrees, the control terminal is low, and the relay is closed. The fan starts the heat dissipation. Figure 3 is a physical photo installed on the computer panel.
4. Software Implementation
The biggest difficulty of this temperature controller should be regarded as the compilation and debugging of the 2051 program. Due to the number display in the circuit, button settings, data collection and relay control. The first thing to consider is that the cathode of the three digital tubes in the circuit is connected to P1, that is, the programming method of dynamic display is used. For 20 milliseconds, the number to be displayed by the time interrupt display to be displayed at 20 milliseconds per interval. At the same time, the button will be scanned in this timing interrupt to see if there is a key that is pressed and the results are processed. In this 20ms time, the program will also complete the collection and conversion of temperature data and compare the current temperature and setting temperature. When writing the function of collecting and collecting DS18B20 data, the DS18B20 single -total line protocol is used. When reading and writing DS18B20, the level sequence of IO port should be consistent with the data provided in the data. Most of the program uses modular design, readers and friends modify or use its functions to write their own temperature control program