Design and implementation of digital temperature sensor based on DS18B20

Publisher:annye_chengLatest update time:2016-11-12 Source: ofweekKeywords:DS18B20 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  At present, in many fields of industrial control , temperature monitoring generally uses a temperature measurement circuit composed of thermistors, and temperature measurement is achieved after A/D and D/A conversion. However, due to the instability of thermistors, temperature measurement is easily affected by external interference and has low accuracy.

  DS18B20 digital temperature sensor is a 1-Wire device produced by Dallas, which has the characteristics of simple circuit and small size. Therefore, it is very convenient to use it to form a temperature measurement system with simple circuit. Many such digital temperature sensors can be connected to one communication line.

  DS18B20 performance characteristics

  1 DS18B20 Features and Pinout

  The temperature measurement range of DS18B20 is -55~+125℃; the conversion accuracy is 9~12 digits, and the number of digits to be converted can be determined programmably; the temperature measurement resolution is 0.5℃ for 9-bit accuracy and 0.0625℃ for 12-bit accuracy; the conversion time is 93.75ms for 9-bit accuracy, 187.5ms for 10-bit accuracy and 750ms for 12-bit accuracy; there are internal upper and lower temperature limit alarm settings. DS18B20 adopts TO-92 packaging mode, and its pin function description is shown in Table 1.

  2 Internal structure of DS18B20

  The internal structure of DS18B20 is shown in the figure. It mainly includes temperature sensor, 64-bit laser ROM single-line single-port, high-speed register for storing intermediate data, upper and lower temperature limits set by the user, trigger storage and control logic, 8-bit cyclic redundancy check code generator, etc.

Design and implementation of digital temperature sensor based on DS18B20


  Single bus technology features

  A single bus has only one data line, and the data exchange and control of the system are completed by this line. The host or slave is connected to the data line through an open-drain or tri-state port to allow the device to release the bus when it is not sending data, and let other devices use the bus. All single-bus devices must follow a strict communication protocol to ensure data integrity. The basic communication process is as follows: The host generates a Tx reset pulse by pulling down the single bus for at least 480μs; ​​then the host releases the bus and enters the Rx receiving mode. When the host releases the bus, a rising edge from a low level to a high level will be generated; after the single-bus device detects the rising edge, it will delay 15 to 60μs; the single-bus device generates a response pulse by pulling down the bus for 60 to 240μs; after the host receives the response pulse from the slave, it indicates that a single-bus device is online, and then the host can start to perform ROM commands and function commands on the slave.

  Based on DS18B20 high-precision digital temperature sensor

  Based on the DS18B20 high-precision digital temperature sensor, the following functions can be completed:

  (1) Using AT89S52 single-chip microcomputer and DS18B20 temperature sensor to communicate, control the temperature collection process and perform data communication;

  (2) Provide the peripheral circuits for DS18B20, the temperature display LED circuit, and the communication interface circuit between DS18B20 and the microcontroller;

  (3) The light-emitting diode is used to indicate the working status of the system, and the DS18B20 temperature sensor has built-in upper and lower temperature limits;

  (4) Write a C51 program to complete the microcontroller's temperature data collection process and control the data transmission process with the DS18B20.

  system design

  1 System Analysis

  The basic structure diagram of the high-precision digital thermometer based on the single-chip microcomputer system is shown in Figure 2.

Design and implementation of digital temperature sensor based on DS18B20

  The main functional modules of high-precision digital thermometers are divided into three categories:

  Under certain requirements, input control adopts a certain form of control method to realize the conversion of different functions of the thermometer, and the control instructions are transmitted to the microcontroller in a certain way.

  The LED digital display microcontroller sends the digital temperature value to the LED display module and controls the LED display module to display in a certain format.

  The data acquisition microcontroller completes the storage and reading of data through the read and write operations on DS18B20, thereby realizing the data processing of the storage unit of the microcontroller.

  2 Hardware Circuit

  According to the control requirements of the system, Intel's 80C52 single-chip microcomputer is selected, which includes data acquisition, data processing, crystal oscillator reset and temperature display circuit of digital temperature sensor.

  3. Software Design

  The software design based on DS18B20 digital temperature sensor uses C51 to write the program, which mainly completes the measurement temperature value calculation and temperature value display function of DS18B20. It adopts modular design, and the program design includes system initialization, reset program, temperature reading program, temperature conversion program, digital tube display program and delay program. Its overall flow chart is shown in Figure 3.

Design and implementation of digital temperature sensor based on DS18B20

  Conclusion

  The digital temperature sensor based on DS18B20 single bus technology has an incomparable application prospect due to its simple circuit, low hardware overhead, low cost and simple software design. It can better solve the shortcomings of traditional temperature measurement devices such as inconvenience in carrying, easy damage and susceptibility to interference, and can be widely used in industrial control.

Keywords:DS18B20 Reference address:Design and implementation of digital temperature sensor based on DS18B20

Previous article:Dormitory intelligent fire and theft alarm system designed with 51 single chip microcomputer
Next article:Design of a portable colorimeter based on a dual-mode USB interface

Recommended ReadingLatest update time:2024-11-15 10:41

DS18B20 temperature measurement and display program
#include #include intrins.h sbit TSOR=P2^0; #define Busy 0x80; #define uchar unsigned char #define uint unsigned int #define reset() {WDT=0x1e;WDT=0xe1;} sfr WDT=0xa6; bit ON_OFF; bit outflag; sbit en =P1^7; /*DTLED-6 display chip enable terminal*/  sbit dout=P1^6; /*DTLED-6 display chip data reading termi
[Microcontroller]
MCU - ds18b20 - Code
#include      #include "../delay/delay.h"     #include "lcd.h"          /*====================================================                     Determine write command/data function    =====================================================*/     void lcd_write(unsigned char byte, unsigned char flag)     {  
[Microcontroller]
PIC microcontroller controls DS18B20 source program
PIC microcontroller   controls  DS18B20 source program ORG   PIC54     GOTO  MAIN     ORG   0  ;----------------------  ;----------------------------  DELAY22             MOV LW  D"200"        ; DELAY 2*250=500mS      MOV WF  COUNT1  DE32   MOV LW  D"250"        ; 8*250=2mS     MOV WF  COUNT2  DE42  NOP             ;
[Microcontroller]
STC89C52MCU -- DS18B20 temperature sensor
DS18B20 temperature sensor uses "single bus" serial transmission mode At present, the serial buses for microcontroller data transmission are mainly Inter IC Bus, SPI and SCI. Among them, the IIC bus communicates in a synchronous serial two-wire mode (one data line and one clock line), the SPI bus communicates in a syn
[Microcontroller]
Detailed explanation of 51 single chip microcomputer DS18B20 temperature sensor
DS18B20 is a single bus digital temperature sensor with a test temperature range of -55℃-125℃. It has the characteristics of small size, low hardware cost, strong anti-interference ability and high precision. Single bus means no clock line, only one communication line. Single bus reading and writing data is completed
[Microcontroller]
Detailed explanation of 51 single chip microcomputer DS18B20 temperature sensor
51 single chip microcomputer controls eight DS18B20 temperature sensors to display
  The microcontroller source program is as follows: #include reg51.h #include Intrins.h #define DATA P1 //1602 driver port //ROM operation command #define READ_ROM 0x33 //Read ROM  #define SKIP_ROM 0xCC //Skip ROM  #define MATCH_ROM 0x55 //Match ROM  #define SEARCH_ROM 0xF0 //Search ROM  #define ALARM_SEARCH 0
[Microcontroller]
51 single chip microcomputer controls eight DS18B20 temperature sensors to display
MCU temperature detection alarm program (ds18b20)
The program uses the digital temperature acquisition chip ds18b20 to obtain a temperature resolution of 12 bits. The program can obtain a lower resolution temperature. ds18b20 has only three i/o interfaces, two of which are power pins and one is a data bus. Only one line is needed for communication. Distributed temper
[Microcontroller]
Latest Microcontroller 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号