DS18B20 Temperature Sensor: Features, Pinout, Working, and Applications Explained

Sep 18, 2025
Sensors
Advertisement
Article Top Ad (728x90)
DS18B20 Temperature Sensor: Features, Pinout, Working, and Applications Explained

Overview

Introduction

The DS18B20 temperature sensor is a popular digital sensor used for accurate and stable temperature measurement. Unlike traditional analog sensors, it directly provides a digital output, which means there is no need for external conversion circuits. This makes it simple to connect with different microcontrollers such as Arduino, STM32, PIC, and many others.

It works on a 1-Wire communication protocol, meaning multiple DS18B20 sensors can be connected using just a single data pin. Each sensor has a unique 64-bit serial code, which allows you to easily identify them when using more than one sensor in the same system. Because of its reliability, cost-effectiveness, and wide temperature range, the DS18B20 is used in industries, laboratories, and hobby projects.

Features of DS18B20

Some of the key features of the DS18B20 are:
  • Digital thermometer with programmable resolution (9 to 12 bits).
  • Provides direct temperature readings in Celsius.
  • Wide temperature measurement range: –55°C to +125°C.
  • Accuracy of ±0.5°C in the range of –10°C to +85°C.
  • Requires only one data pin for communication.
  • Unique 64-bit serial code for each sensor.
  • Supports parasite power mode (can operate without a dedicated VDD pin).
  • Low standby current consumption (<1µA).
  • Available in different forms such as TO-92 package, waterproof probe, and module-based boards.

Pinout of DS18B20

The most common form of the DS18B20 is the TO-92 package, which looks like a small transistor. It has three pins:

  1. GND – Ground

  2. DQ – Data line (communication pin)

  3. VDD – Power supply (3.0V to 5.5V)

In parasite mode, the VDD pin can be connected to ground, and the sensor will draw power from the data line.

Electrical Characteristics

  • Supply Voltage: 3.0V to 5.5V

  • Operating Current: Less than 1mA during measurement

  • Standby Current: Less than 1µA

  • Temperature Resolution: 0.5°C at 9-bit, 0.0625°C at 12-bit

  • Conversion Time: 93.75 ms (9-bit) to 750 ms (12-bit)


How DS18B20 Works

The DS18B20 has an internal temperature sensor and an analog-to-digital converter (ADC). When the microcontroller sends a command, the DS18B20 measures the temperature and converts it into a digital value. This value is then stored in its internal registers. The microcontroller can request the temperature data at any time using the 1-Wire protocol. Because every DS18B20 has a unique address, you can connect many of them on the same bus and still read each one separately.

Advantages of DS18B20

  • Simple communication with just one pin.
  • High accuracy and stability.
  • Can be powered using only the data line (parasite mode).
  • Works with both 3.3V and 5V systems.
  • Waterproof versions available for outdoor and industrial use.
  • Supports multiple sensors on the same line.

Limitations of DS18B20

  • Response time is slower compared to analog temperature sensors.
  • Requires correct timing for 1-Wire protocol.
  • Works best within the range of –10°C to +85°C for high accuracy.

Types of DS18B20

The DS18B20 is available in different forms to suit various applications:
  1. TO-92 Package – Small, transistor-like package suitable for breadboards and compact circuits.

  2. Waterproof Probe – Encased in stainless steel with long cables, ideal for outdoor or liquid measurements.

  3. Breakout Module – Mounted on a small PCB with resistors, making it easy to connect directly to microcontrollers.

Applications of DS18B20

The DS18B20 is a versatile sensor and can be used in many areas, such as:
  • Weather monitoring systems
  • Food storage and refrigeration monitoring
  • Industrial process control
  • HVAC systems
  • Scientific experiments
  • Data loggers
  • Greenhouse and environmental monitoring
  • Consumer electronics requiring temperature control

Interfacing DS18B20 with Arduino (Example)

Here is a simple example of how to use the DS18B20 with Arduino. This program reads the temperature and displays it on the Serial Monitor.
#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire connected to pin 2 on Arduino
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup() {
    Serial.begin(9600);
    sensors.begin();
}

void loop() {
    sensors.requestTemperatures(); // Send command to get temperature
    float tempC = sensors.getTempCByIndex(0); // Get temperature in Celsius
    Serial.print("Current Temperature: ");
    Serial.print(tempC);
    Serial.println(" °C");
    delay(1000);
}

Code Explanation

  • The OneWire library handles communication using the 1-Wire protocol.

  • The DallasTemperature library makes it easier to read temperature values.

  • The function getTempCByIndex(0) returns the temperature of the first connected DS18B20.

  • The result is displayed every second on the Serial Monitor.

Example Output

When uploaded to Arduino, the Serial Monitor will display:
Current Temperature: 28.50 °C
Current Temperature: 28.56 °C
Current Temperature: 28.62 °C
This shows live temperature readings in Celsius.

Datasheet and Technical Reference

For detailed electrical parameters, timing diagrams, and command set, you can check the official DS18B20 datasheet by Maxim Integrated (now part of Analog Devices). It explains the communication protocol and other design considerations.


Conclusion

The DS18B20 digital temperature sensor is one of the most reliable and easy-to-use sensors for temperature measurement. With its 1-Wire interface, unique ID system, and programmable resolution, it provides flexibility for a wide range of applications. Whether you are working on industrial monitoring, a weather station, or a simple home project, the DS18B20 is a trusted choice for precise temperature measurement.

Its affordable cost, wide availability, and durable design make it suitable for both beginners and professionals. By combining accuracy, simplicity, and versatility, the DS18B20 continues to be one of the most widely used digital temperature sensors in the field of electronics.

Sponsored Content
In-Content Ad (300x250)

Where to Buy

Amazon
₹299

Prices may vary. Click on "Buy Now" to check current availability and pricing.

Sensors IoT Blog Verified
Written by

Administrator

IoT Expert
Verified Author
Advertisement
Ad Banner
(300x250)
Advertisement
Ad Banner (728x90)

Frequently Asked Questions

Common questions about DS18B20 Temperature Sensor: Features, Pinout, Working, and Applications Explained. Find answers to the most frequently asked questions.

The DS18B20 is mainly used for measuring temperature in electronic circuits, industrial systems, and scientific applications. It provides accurate digital readings and can be easily connected with microcontrollers for real-time monitoring.
The DS18B20 offers an accuracy of about ±0.5°C within the range of –10°C to +85°C, which makes it suitable for most general-purpose applications where stable and precise temperature readings are required.
Yes, multiple DS18B20 sensors can share the same data line because each one has a unique 64-bit serial code, allowing a microcontroller to identify and read data from each sensor individually.
The DS18B20 works on a supply voltage of 3.0V to 5.5V, which means it is compatible with most commonly used microcontrollers. It can also work in parasite power mode where it operates without a dedicated power pin.
The DS18B20 can measure temperatures from –55°C to +125°C, covering a wide range that is suitable for both low-temperature and high-temperature monitoring applications.
The DS18B20 is preferred because it provides a direct digital output, reducing the need for additional conversion circuits. It is also highly accurate, easy to interface, and available in waterproof versions for more demanding environments.

User Reviews & Comments

Share your experience with this IoT Blog. Your feedback helps our community make informed decisions!

0 reviews

Share Your Experience

Help others by sharing your thoughts about this IoT Blog.

0/1000 characters

No Reviews Yet

Be the first to share your experience with this IoT Blog!

Related Blogs

Explore more IoT Blogs in the same category

Ultrasonic Sensor HC-SR04 for IoT: Working, Applications, Circuit, and Integration Guide

Ultrasonic Sensor HC-SR04 for IoT: Working, Applications, Circuit, and Integration Guide

Sensors

Discover how the Ultrasonic Sensor HC-SR04 works and how to use it in IoT projects. This detailed guide covers its working principle, pin configuration, interfacing with Arduino, applications in smart systems, and complete circuit setup. Ideal for beginners and IoT developers looking to integrate distance sensing in real-time projects.

Vibration Sensor: Working, Types, Applications, and Complete Guide

Vibration Sensor: Working, Types, Applications, and Complete Guide

Sensors

A vibration sensor is a crucial device used to detect and measure vibrations in machines, structures, and environments. This complete guide covers how vibration sensors work, their different types, applications across industries, and factors to consider before selection. Learn how these sensors improve safety, enhance performance, and prevent costly equipment failures.

Best IR Sensor for IoT Projects – Types, Working, Interfacing, and Applications Explained

Best IR Sensor for IoT Projects – Types, Working, Interfacing, and Applications Explained

Sensors

Discover everything about IR sensors used in modern IoT applications. Learn their types, working principles, interfacing methods, and real-world uses. This complete guide helps developers and engineers choose the best IR sensor for smart electronics and automation projects with reliable performance.

Advertisement
Ad Banner (728x90)
Advertisement
Footer Ad (728x90)