Design and implementation of a multi-purpose intelligent temperature measuring instrument

Publisher:冰心独语uLatest update time:2011-06-14 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Temperature is one of the most basic physical quantities in science and technology. In industrial production, temperature is often one of the most important parameters to characterize the state of objects and processes. In the medical field, body temperature is also the medical parameter we pay most attention to.

With the development of modern science and technology, temperature measurement is increasingly used in various fields, and temperature measurement technology has also attracted great attention. Multifunctional temperature measuring instrument is a typical example, which uses single-chip microcomputer technology to develop in the direction of digitalization and intelligence. Here we introduce a multifunctional temperature measuring instrument, which can measure both ambient temperature and human body temperature, achieve fast response, digital display of temperature value, and has the purpose of high temperature alarm.

1 Hardware Circuit Design

1.1 Temperature sensor

The temperature sensor DS18B20 produced by DALLAS is used as the temperature acquisition device. The internal structure of DS18B20 mainly consists of 64-bit ROM, temperature sensitive element, internal memory and configuration register, as shown in Figure 1.

(1) 64-bit ROM. Its content is a 64-bit serial number, which can be regarded as the address sequence code of the DS18B20. Its function is to make each DS18B20 different, so that multiple DS18B20s can be connected to one bus.

(2) Temperature sensitive element. It measures the temperature and stores the measured results in two 8-bit temperature registers.

(3) Internal memory. The internal memory includes a high-speed temporary storage RAM and a non-volatile electrically erasable E2 PROM, which stores high temperature and low temperature triggers TH, TL and configuration registers.

Internal structure of DS18B20

Figure 1 Internal structure of DS18B20

DS18B20 has the following features:

(1) Unique single-wire interface mode, only one line is needed when connecting to the microcontroller; (2) The temperature measurement range is -55~+125℃, and the accuracy is ±0.5℃ in the range of -10~+85℃; (3) 9~12-bit digital reading mode can be realized through programming; (4) The user can set the non-volatile alarm upper and lower limits; (5) The peripheral circuit is simple and does not require peripheral components when in use. It can be powered by the data bus with a voltage range of 3.0~5.5V and does not require a backup power supply; (6) DS18B20 has TO92, SOIC and CSP packages. The appearance and pin arrangement of DS18B20 selected in this measuring instrument are shown in Figure 2, where VDD is the external power supply input terminal, GND is the common ground, and DQ is the digital signal output terminal.

DS18B20 appearance and pin arrangement

Figure 2 DS18B20 appearance and pin arrangement [page]

Based on the above characteristics, the use of DS18B2 makes hardware consumption less, system design more flexible and convenient, cheaper and smaller in size.

1.2 Hardware circuit design

The system hardware circuit is shown in Figure 3.

System hardware circuit diagram
Figure 3 System hardware circuit diagram

It includes four parts: signal acquisition, system control, digital display, and high temperature alarm. The temperature signal collected by the sensor DS18B20 is sent to the P3.2 port of the single-chip microcomputer from the DQ end of the sensor through internal processing. After calculation and processing by the single-chip microcomputer, the P0 port and the P1 port are used as the segment control signal and the bit control signal of the 4-bit common anode digital tube respectively, and the digital display of the measured temperature value is completed together. The highest bit is the sign display. If the negative sign "-" is displayed, it means that the current temperature is negative temperature, otherwise it is positive temperature; the buzzer is controlled by the P2.0 port. When the measured temperature exceeds the "preset alarm temperature", a prompt sound alarm is issued; the P2.1~P2.3 ​​ports control the yellow, green, and red light-emitting diodes to represent the three temperature states of low temperature, normal, and high temperature respectively. The quartz crystal JT and capacitors C2 and C3 together form a crystal oscillator circuit; the capacitor C1, resistor R13 and SB together form a reset circuit; resistor R13 is a pull-down resistor and SB is a manual reset button.

2 Software Design

In order to facilitate the calling of subroutines and the maintenance of the system, the program follows the principles of standardization and modularization, and mainly completes the design of modules including reading DS18B20 temperature data, data sorting and conversion, temperature display, alarm, etc. Since the program tasks are relatively few and the structure is relatively simple, this system consists of a main program and multiple subroutines, and adopts a sequential structure main program flow.

2.1 Key points of software design

Since DS18B20 uses a single-wire bus protocol, that is, bidirectional data transmission on one data line, and the microcontroller hardware does not support the single-bus protocol, a software method must be used to simulate the single-bus protocol sequence to complete the access to the DS18B20 chip.

Since DS18B20 reads and writes data on an I/O line, it has strict timing requirements for the data bits to be read and written. It has a strict communication protocol to ensure the correctness and integrity of each bit of data transmission. The protocol defines the timing of several signals: initialization timing, read timing, and write timing. All timings use the microcontroller as the master device and the DS18B20 as the slave device. Each command and data transmission starts with the host actively starting the write timing. If DS18B20 is required to send back data, the host needs to start the read timing to complete data reception after the write command.

2.2 Software Design

The innovation is to introduce the concept of "video memory" in the temperature display module, and use "video memory" to directly map it to the display subroutine, which is convenient for program transplantation and the future establishment of a multi-point temperature detection network, or embedding in other monitoring systems.

The program snippet is as follows:

[page]

2.3 Main program flow chart

The main program flow is shown in Figure 4.

Main program flow chart

Figure 4 Main program flow chart

3 Physical operation and testing

Test method: Use a mercury thermometer and a temperature measuring instrument to measure the same air environment, water, and human body at the same time, record each measurement data in detail, and compare the data. The test results are shown in Table 1, and the results show that the error is only ± 0.2 ℃.

Table 1 Physical operation test comparison table

Physical operation test comparison table

4 Conclusion

The temperature measuring instrument designed and manufactured using the temperature sensor DS18B20 and the single-chip computer 8051 can measure and display the temperature at a relatively low cost. The components used in this measuring instrument are inexpensive and easy to obtain, and have the advantages of simple hardware structure, fast response, and intuitive display. In addition, the single bus structure of the component DS18B20 has strong scalability. It can also form a multi-point temperature detection network. This solution designs a temperature monitoring system with broad application prospects.

Reference address:Design and implementation of a multi-purpose intelligent temperature measuring instrument

Previous article:Design of portable physiological parameter monitor based on C8051F330
Next article:Analysis of FAQs on Analyzer Purchase

Latest Test Measurement 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号