Design of Home Temperature Measuring Device Based on DS18B20 and AT89C2051

Publisher:Joyful222LifeLatest update time:2013-04-03 Source: 21IC Keywords:DS18B20  AT89C2051 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Design Overview

This design uses the USB port as the power supply port, uses the DS18B20 temperature sensor to collect temperature information, uses the AT89C2051 single-chip microcomputer for control, and uses a four-digit common anode digital tube display to achieve temperature measurement and display (the system block diagram is shown in Figure 1). This design can cultivate students' interest in learning single-chip microcomputers and improve their production and programming capabilities.

System Block Diagram

Figure 1 System Block Diagram

2. Circuit Principle

The PROteUS simulation software is used for schematic design and program simulation. The circuit is shown in Figure 2.

Circuit Diagram

Figure 2 Circuit diagram

1. Power supply

The USB port is used for power supply. The USB adapter can be connected to the USB port of the circuit board or directly to the USB port of the computer. In this way, resources can be saved and a more ideal working voltage can be obtained. The appearance of the USB port and the definition of the power port are shown in Figure 3.

USB port appearance and power port definition

Figure 3 USB port appearance and power port definition

2. Temperature signal acquisition

The DS18B20 (appearance see Figure 4) intelligent digital temperature sensor is used as the temperature signal acquisition device.

DS18B20 Appearance

Figure 4 DS18B20 appearance [page]

(1) Working principle of DS18B20

The read/write timing and temperature measurement principle of DS18B20 are the same as those of DS1820, except that the number of bits of the obtained temperature value is different, and the delay time of temperature conversion is reduced from 2s to 750ms. The temperature measurement principle of DS18B20 is shown in Figure 5. Among them, the oscillation frequency of the low temperature coefficient crystal oscillator is little affected by temperature, and is used to generate a fixed frequency pulse signal to counter 1. The oscillation frequency of the high temperature coefficient crystal oscillator changes significantly with temperature, and the generated signal is used as the pulse input of counter 2. Counter 1 and the temperature register are preset to a base value corresponding to -55℃. Counter 1 subtracts the pulse signal generated by the low temperature coefficient crystal oscillator. When the preset value of counter 1 is reduced to 0, the value of the temperature register will be increased by 1, counter 1 will be re-preset, and the pulse signal generated by the low temperature coefficient crystal oscillator will be counted again. This cycle continues until counter 2 counts to OH and stops accumulating the temperature register value. At this time, the value in the temperature register is the measured temperature. The slope accumulator in FIG5 is used to compensate and correct the nonlinearity in the temperature measurement process, and its output is used to correct the preset value of counter 1.

DS18B20 temperature measurement schematic diagram

Figure 5 DS18B20 temperature measurement schematic

(2) Main features of DS18B20

1) The adaptable voltage range is 3.0V~5.5V, and it can be powered by the data line in parasitic power supply mode.

2) Only one line is needed between DS18B20 and microprocessor for two-way communication.

3) Support multi-point networking function, multiple DS18B20 can be connected in parallel on only three lines to achieve multi-point temperature measurement in networking.

4) No peripheral components are required, and all sensor elements and conversion circuits are integrated in a circuit that looks like a transistor.

5) The temperature measurement range is -55℃~+125℃, and the accuracy is ±0.5℃ at -10℃~+85℃.

6) The programmable resolution is 9 to 12 bits, and the corresponding resolvable temperatures are 0.5°C, 0.25°C, 0.125°C and 0.0625°C, respectively, which can achieve high-precision temperature measurement.

7) At 9-bit resolution, it takes a maximum of 93.75ms to convert the temperature to digital, and at 12-bit resolution, it takes a maximum of 750ms to convert the temperature value to digital.

8) Directly output digital temperature signal and transmit it serially to CPU via a one-wire bus. CRC check code can also be transmitted at the same time, which has strong anti-interference and error correction capabilities.

9) When the power polarity is reversed, the chip will not burn out due to heat, but it will not work normally.

DS18B20 follows the single bus protocol. Each temperature measurement must go through four processes: initialization, transmission of ROM commands, transmission of RAM commands, and data exchange.

3. AT89C2051 microcontroller

The AT89C2051 single-chip microcomputer is used as the main control component (see Figure 2).

4. Digital tube display

A four-digit common anode digital tube is used for dynamic display, and the temperature display is retained to one decimal place. When programming, P3.2~P3.5 is used as the bit selection end of the dynamic display of the digital tube, and Pl.0~Pl.7 is used as the segment selection bit of the dynamic display of the digital tube. When P3.2 outputs a high level, the "1" digital tube is selected, and when P3.3 outputs a high level, the "2" digital tube is selected, and so on. In the circuit, P3.2~P3.5 are connected to 4 NPN transistors as drivers. Pl.0~Pl.7 are connected to 8 resistors for current limiting.

3. Reference Program

This design uses the microcontroller C language for programming. Due to space limitations, the reference programs are not listed here one by one.

4. Production and debugging

The design is relatively simple to debug. As long as the installation and welding are correct and the program is written accurately and completely, it is generally easy to realize the function.

The debugged object is shown in Figure 6.

Physical picture

Figure 6 Actual picture

Keywords:DS18B20  AT89C2051 Reference address:Design of Home Temperature Measuring Device Based on DS18B20 and AT89C2051

Previous article:Design of small remote control turntable system
Next article:Design and implementation of CAN bus node circuit

Recommended ReadingLatest update time:2024-11-17 01:26

DS18B20+PIC temperature measurement using 1602 to display temperature C program
//Be familiar with using the MCU to test the temperature using the DS18B20 temperature sensor and display the temperature using the 1602 display //1. The first line displays: Temperature //2. The second line displays: the measured temperature value //************************************************** //***********
[Microcontroller]
STM8L controls the temperature sensor DS18B20
#define DS18B20_GPIO_PORT (GPIOC) #define DS18B20_GPIO_PIN (GPIO_Pin_2) #define DS18B20_PIN_SET_OUT() GPIO_Init(DS18B20_GPIO_PORT, (GPIO_Pin_TypeDef)DS18B20_GPIO_PIN, GPIO_Mode_Out_PP_High_Fast) #define DS18B20_PIN_SET_IN() GPIO_Init(DS18B20_GPIO_PORT, (GPIO_Pin_TypeDef)DS18B20_GPIO_PIN, GPIO_Mode_In_PU_No_IT) #def
[Microcontroller]
Design of networked intelligent temperature sensor based on ARM and DS18B20
1 Introduction to Networked Intelligent Sensors Networked intelligent sensors enable sensors to develop from single function and single detection to multi-function and multi-point detection; from passive detection to active information processing; from on-site measurement to long-distance real-time online measurement
[Microcontroller]
Design of networked intelligent temperature sensor based on ARM and DS18B20
Digital Temperature Sensor DS18B20 Program
   ORG 0000H START: MOV SP,#60H ; power on initialization     MOV P0,#0FFH     MOV P1,#0FEH     MOV P2,#0FFH     MOV P3,#0FFH  MAIN: LCALL GET_TEMPER ; call the temperature reading subroutine     LCALL DISP ; call the digital tube display subroutine     AJMP MAIN ; Repeat loop ;----- Read the temperature v
[Microcontroller]
51 MCU ~ DS18B20 temperature sensor
1. Introduction: (ii) Wiring: 1. Internal structure: The first five digits of positive temperature are 0. The first five digits of negative temperature are 1. A four-digit hexadecimal number consisting of LS and MS, and a 16-digit binary number. (MS first, then LS) Combine the above and below graphs to get
[Microcontroller]
51 MCU ~ DS18B20 temperature sensor
Design of electronic clock based on single chip microcomputer AT89C2051
  The circuit is shown in Figure 1.   A 20-pin MCU AT89C2051 is the main body of the electronic clock. Its display data is output from the P1 port in time-sharing, and P3.0~3.3 outputs the corresponding bit selection signal. Since the LED digital tube consumes a lot of power when it is lit, four PNP transistors V
[Microcontroller]
Design of electronic clock based on single chip microcomputer AT89C2051
Application of digital temperature sensor DS18B20 in satellite power supply system
  0 Preface    The satellite power supply system is mainly used to provide a stable power supply for the normal operation of the entire satellite. It is an important subsystem for satellite power generation, storage, conversion, regulation, transmission, distribution and management. Its basic function is to conver
[Microcontroller]
Application of digital temperature sensor DS18B20 in satellite power supply system
DS18B20 source program based on WinAVR
#ifndef _DS18B20_C_ #define _DS18B20_C_ #define DQ_18B20 (1 3) // PD3 #define DQ_TO_0() (DDRD |= DQ_18B20) // PD3=’0′ #define DQ_TO_1() (DDRD &= ~DQ_18B20) // PD3=’float’ #define DQ_status() (PIND & DQ_18B20) // read PD3 pin #ifndef CPU_CRYSTAL #define CPU_CRYSTAL (11.0592) #endif #define wait_us(us) _d
[Microcontroller]
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号