Phone

    00852-6915 1330

DS18B20 Temperature Sensor: Pinout, Principle, Circuit

  • Contents

Description

DS18B20 is a temperature sensor of Maxim. The single-chip microcomputer can communicate with DS18B20 through 1-Wire protocol and finally read the temperature. The hardware interface of the 1-Wire bus is very simple, just connect the data pin of DS18B20 to an IO port of the microcontroller.

This Video Introduces DS18B20 with Datasheet

Catalog

Description

Document and Media

DS18B20 Pinout

Parameters

Advantage

Features

Applications

DS18B20 Circuit Schematic

DS18B20 Temperature Sensor Data

DS18B20 Block Diagram

How to use the DS18B20 Sensor

Where to use DS18B20 Sensor

Product Manufacturer

FAQ

Ordering & Quantity


Document and Media

Component Datasheet 

DS18B20 Datasheet


DS18B20 Pinout

ds18b20 pinout

ds18b20 pinout

ds18b20 pinout

Pin

Name

Function

SO

μSOP

TO-92

1, 2, 6, 7, 8

2, 3, 5, 6, 7

-

N.C.

No Connection

3

8

3

VDD

Optional VDD. VDD must be grounded for operation in parasite power mode.

4

1

2

DQ

Data Input/Output. Open-drain 1-Wire interface pin. Also provides power to the

device when used in parasite power mode (see the Powering the DS18B20 section.)

5

4

1

GND

Ground


Parameters

Accuracy (±°C)

0.5

Channels

One

Interface

1-Wire

Multi Droppable

Yes

Oper. Temp. (°C)

-55 to +125

Package/Pins

SOIC (N)/8, TO92/3, UMAX/8

Parasite Pwr.

Yes

Part Number

DS18B20

Sensor Type

Local

Temp. Resolution (bits)

9, 10, 11, 12

Temp. Thresh.

Programmable (NV)


Advantage

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. In addition, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply.

Each DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to function on the same 1-Wire bus. Thus, it is simple to use one microprocessor to control many DS18B20s distributed over a large area. Applications that can benefit from this feature include HVAC environmental controls, temperature monitoring systems inside buildings, equipment, or machinery, and process monitoring and control systems.


Features

  • Unique 1-Wire® Interface Requires Only One Port Pin for Communication
  • Reduce Component Count with Integrated Temperature Sensor and EEPROM
    • Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
    • ±0.5°C Accuracy from -10°C to +85°C
    • Programmable Resolution from 9 Bits to 12 Bits
    • No External Components Required
  • Parasitic Power Mode Requires Only 2 Pins for Operation (DQ and GND)
  • Simplifies Distributed Temperature-Sensing Applications with Multidrop Capability
    • Each Device Has a Unique 64-Bit Serial Code Stored in On-Board ROM
  • Flexible User-Definable Nonvolatile (NV) Alarm Settings with Alarm Search Command Identifies Devices with Temperatures Outside Programmed Limits
  • Available in 8-Pin SO (150 mils), 8-Pin µSOP, and 3-Pin TO-92 Packages

Applications

  • Consumer Products
  • Industrial Systems
  • Thermally Sensitive Systems
  • Thermometers
  • Thermostatic Controls

DS18B20 Circuit Schematic

  ds18b20 circuit schematic


DS18B20 Temperature Sensor Data

DS18B20 can achieve the highest 12-bit temperature storage value through programming. The temperature storage value is stored in the register in a complement format.

temperature sensor

There are 2 bytes in total, LSB is the low byte and MSB is the high byte. Among them, MSb is the high bit of the byte, and LSb is the low bit of the byte. For binary numbers, the meaning of the temperature represented by each of them is expressed. Among them, S represents the sign bit, and the lower 11 bits are all powers of 2, which are used to represent the final temperature.

The temperature measurement range of DS18B20 is from -55 degrees to +125 degrees. The manifestation of temperature data has positive and negative temperatures. Each number in the register is distributed like the scale of a caliper.

 temperature sensor

The lowest bit of the binary number changes 1, which represents the mapping relationship of a temperature change of 0.0625 degrees.

  • When the temperature is 0 ℃, the corresponding hexadecimal number is 0x0000.
  • When the temperature is 125 ℃, the corresponding hexadecimal number is 0x07D0.
  • When the temperature is minus 55 ℃, the corresponding hexadecimal number is 0xFC90.

Conversely, when the number is 0x0001, the temperature is 0.0625 ℃.


DS18B20 Block Diagram

 ds18b20 block diagram


How to use the DS18B20 Sensor

The sensor works with the method of 1-Wire communication. It requires only the data pin connected to the microcontroller with a pull up resistor and the other two pins are used for power as shown below.ds18b20 microcontroller circuit diagram

The pull-up resistor is used to keep the line in high state when the bus is not in use. The temperature value measured by the sensor will be stored in a 2-byte register inside the sensor. This data can be read by the using the 1- wire method by sending in a sequence of data. There are two types of commands that are to be sent to read the values, one is a ROM command and the other is function command. The address value of each ROM memory along with the sequence is given in the datasheet below. You have to read through it to understand how to communicate with the sensor.

If you are planning to interface it with Arduino, then you need not worry about all these. You can develop the readily available library and use the in-built functions to access the data.


Where to use DS18B20 Sensor

The DS18B20 is a 1-wire programmable Temperature sensor from maxim integrated. It is widely used to measure temperature in hard environments like in chemical solutions, mines or soil etc. The constriction of the sensor is rugged and also can be purchased with a waterproof option making the mounting process easy. It can measure a wide range of temperature from -55°C to +125° with a decent accuracy of ±5°C. Each sensor has a unique address and requires only one pin of the MCU to transfer data so it a very good choice for measuring temperature at multiple points without compromising much of your digital pins on the microcontroller.


Product Manufacturer

Maxim Integrated provides ease of design, and speeds time to market, through analog integration. The company's analog ICs offer extra features and functionality carefully designed to streamline circuit and simplify design. Look to Maxim for solutions for consumer electronics, personal computers and peripherals, mobile devices, wireless and fiber communications, test equipment, instrumentation, video displays, and automotive applications. Maxim’s analog and mixed-signal solutions include data converters, interface circuits, power, RF wireless circuits, clocks and oscillators, microcontrollers (MCUs), operational amplifiers (op amps), and sensors.


FAQ

  • What is DS18B20 temperature sensor?

The DS18B20 is a 1-wire programmable temperature sensor from maxim integrated. It is widely used to measure temperature in hard environments like in chemical solutions, mines or soil etc. The constriction of the sensor is rugged and also can be purchased with a waterproof option making the mounting process easy.

  • How does the DS18B20 work?

It works on the principle of direct conversion of temperature into a digital value. 

  • Is DS18B20 a thermistor?

A thermistor is a thermal resistor - a resistor that changes its resistance with temperature. ... Thermistors have some benefits over other kinds of temperature sensors such as analog output chips (LM35/TMP36 ) or digital temperature sensor chips (DS18B20) or thermocouples.

  • How accurate is DS18B20?

The DS18B20 reads with an accuracy of ±0.5°C from -10°C to +85°C and ±2°C accuracy from -55°C to +125°C.

  • What is ds1820?

The DS18B20 is one type of temperature sensor and it supplies 9-bit to 12-bit readings of temperature. ... The communication of this sensor can be done through a one-wire bus protocol which uses one data line to communicate with an inner microprocessor.

  • How do I connect my DS18B20 to my Raspberry Pi?

Once you've connected the DS18B20, power up your Pi and log in, then follow these steps to enable the One-Wire interface:
1.At the command prompt, enter sudo nano /boot/config.txt , then add this to the bottom of the file:
2.dtoverlay=w1-gpio.
3.Exit Nano, and reboot the Pi with sudo reboot.

  • What is the working principle of DS18B20?

The DS18B20 Digital Thermometer provides 9 to 12-bit (configurable) temperature readings which indicate the temperature of the device. It communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. In addition it can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply.
The core functionality of the DS18B20 is its direct-to-digital temperature sensor. The resolution of the temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively. The default resolution at power-up is 12-bit.

  • Where to use DS18B20 Sensor?

The DS18B20 is a 1-wire programmable Temperature sensor from maxim integrated. It is widely used to measure temperature in hard environments like in chemical solutions, mines or soil etc. The constriction of the sensor is rugged and also can be purchased with a waterproof option making the mounting process easy. It can measure a wide range of temperature from -55°C to +125° with a decent accuracy of ±5°C. Each sensor has a unique address and requires only one pin of the MCU to transfer data so it a very good choice for measuring temperature at multiple points without compromising much of your digital pins on the microcontroller.

  • How connect DS18B20 to Arduino?

First plug the sensor on the breadboard the connect its pins to the Arduino using the jumpers in the following order: pin 1 to GND; pin 2 to any digital pin (pin 2 in our case); pin 3 to +5V or +3.3V, at the end put the pull-up resistor.

  • On an ATMega328P, why is a DS18B20 temperature sensor returning incorrect temperature values?

Several possibilities:
1. If it is just reading a little high, it might be caused by “self heating”. Add a heat sink and/or make measurements less frequently.
2. Especially if the values are really whacky, it might be code with errors or mis-wiring. Use a published sketch to check operation.
3. The DS18B20 might be defective. Try another.
4. It’s accurate to 0.5ºC.

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.