Design of high-precision temperature measurement system based on single-chip microcomputer

Publisher:沈阳阿荣Latest update time:2011-08-27 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: The design of a new high-precision temperature measuring instrument composed of a single-bus digital temperature sensor DS18B20 and a single-chip microcomputer is proposed. The structure, characteristics and working principle of the temperature sensor DS18B20 are introduced, and the hardware circuit and software programming of the temperature measurement system of DS18B20 and AT89S52 single-chip microcomputer are designed, mainly including functions such as temperature acquisition, temperature display and alarm control. The whole system has a series of advantages such as simple structure, high measurement accuracy, long transmission distance, strong anti-interference ability, convenient temperature reading and low cost. It is suitable for temperature measurement in production, life and scientific research, and has a broad application prospect.
Keywords: temperature measurement; single-chip microcomputer; DS18B20; digital tube display

0 Introduction
Temperature is an important parameter in industrial production and experimental processes. Accurate temperature measurement and timely temperature display are very important. At present, there are many types of temperature measurement systems with uneven functions. The single-chip microcomputer has the characteristics of small size, low price, strong versatility and flexibility. The design of a temperature measurement system using a single-chip microcomputer can not only meet the functional requirements, but also be economical. The digital temperature measurement sensor DS18B20 is a high-precision measurement device with a single bus. It overcomes the shortcomings of the A/D converter and other complex peripheral circuits required when the analog sensor is interfaced with a microcomputer. This article uses a single-chip microcomputer and its interface and an integrated single-bus temperature sensor DS18B20 to build a high-precision temperature measurement and display system, and sets the upper temperature limit through a switch. If the temperature exceeds the set value, an alarm will be issued or a corresponding control command will be issued. The designed circuit is simple and easy to implement, and it also has certain expansion functions, which can be expanded into multi-point acquisition and more complex functions.

1 System hardware design
The entire system is mainly composed of functional modules such as the main control center (single-chip microcomputer), temperature sensor DS18B20, digital tube display and switch control. The upper limit of the alarm temperature can be adjusted by the switch, which can increase or decrease the upper limit, so that it can be used in different occasions. The block diagram of the system is shown in Figure 1.

a.jpg


1.1 Temperature sensor DS18B20
DS18B20 is a digital temperature sensor produced by Dallas Semiconductor Company in the United States. It provides 9-bit temperature readings and indicates temperature. Temperature information is sent to or from DS18B20 through a single-wire interface, so only one line is needed from the processor to DS18B20. The power required for reading, writing and completing temperature conversion can be provided by the data itself, without the need for an external power supply. This makes it very simple to interface DS18B20 with a single-chip microcomputer, overcoming the shortcomings of A/D conversion and other complex peripheral circuits required when analog sensors are interfaced with microcomputers. It also has the advantages of simple structure, low cost, small size, strong anti-interference ability, and simple use. The most important thing is that the ROM of DS18B20 contains the unique identification code of its chip, that is, the identification codes of any two DS18B20 are different, which is particularly suitable for forming a multi-point temperature measurement control system with a microprocessor chip. DS18B20 is an improved version of DS1820, with a resolution of 9 to 12 bits of programmable control, which is determined by the two-bit state of its registers R0 and R1. The measurement range is from -55 to +125°C, and the increment value is 0.5°C.
DS18B20 measures temperature internally by counting the number of clock cycles and provides a resolution of 0.5°C. The temperature reading is provided in the form of a 16-bit, sign-extended binary complement reading. It should be noted that when the temperature is expressed in 1/2°C LSB (least significant bit) in DS18B20, the following 9-bit format is generated:
b.jpg
1.2 Keyboard control design
Before the system works, the user sets a two-bit temperature value as the alarm value, turns on the power, resets the microcontroller, closes the switch to interrupt the program, presses the reset switch, and each press of the alarm value will add 1°C to the initialization value, and the digital tube displays the set value. The user checks to see if the displayed digital value is the same as the set value, and then turns on the switch to transmit the ambient temperature measurement value. Since the alarm value can be set by the user, the system can adapt to various temperature environments.
1.3 Other parts
The system mainly uses a 7-segment common anode digital tube to display the measured temperature value, and the light-emitting diode and buzzer are used for alarm. If the measured temperature value is higher than the set value by 1°C, the alarm system will alarm (the light-emitting diode lights up and the buzzer sounds). In this way, the system alarm can be received by sound and vision.
1.4 System circuit schematic diagram
The system circuit schematic diagram is shown in Figure 2.

c.jpg

2 Software Design
When the system starts working, it first initializes the I/O port and the alarm value, then determines whether the switch is closed. The user changes the original alarm value by himself. After confirmation, the microcontroller control software issues a temperature reading instruction, collects the current temperature value through the digital temperature sensor DS18B20, and transmits it to the microcontroller through the single bus after conversion. The microcontroller processes it and displays it on the digital tube. If it exceeds the set alarm value by 1°C, the system will alarm (the LED lights up and the buzzer sounds). The software part of the system is mainly composed of four parts: interrupt subroutine, DB18B20 read and write program, display program and alarm system. The main program flow chart is shown in Figure 3.

d.jpg


Part of the designed procedure is as follows:
e.jpg
f.jpg


g.jpg

3 Conclusion
The temperature measurement system based on C51 series microcontroller and DS18B20 digital temperature sensor has simple structure, low cost, convenient operation, and is easy to promote. It can also be expanded according to the situation, such as multi-point acquisition.

Reference address:Design of high-precision temperature measurement system based on single-chip microcomputer

Previous article:A design of pan/tilt system based on single chip intelligent control
Next article:Design of intelligent control system for temperature and humidity in warehouse based on single chip microcomputer

Latest Industrial Control Articles
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号