Introduction to DS18B20, ds18b20 pinout, ds18b20 basics, ds18b20 pin diagram, basics of ds18b20, ds18b20 temperature sensorHello friends, I hope you all are doing great. In today’s tutorial, we are gonna have a look at detailed Introduction to DS18B20. DS18B20 is a temperature sensor which can measure temperature from -55oC to +125oC with an accuracy of +- 5%. It follows 1 wire protocol which has revolutionized the digital world. Because of it’s 1 wire protocol, you can control multiple sensors from single pin of Microcontroller.

DS18B20 is normally used in industrial projects where high accuracy is necessary. I will give you a detailed overview of this temperature sensor in today’s post where we will have a look at its Pinout, working, protocol etc. I will also share some links of projects where I have interfaced it with Arduino or other microcontrollers. If you have any questions, please ask in comments and I will try my best to resolve them all. So, let’s get started with basic Introduction to DS18B20:

Introduction to DS18B20

  • DS18B20 is a digital temperature sensor which follows 1-wire protocol and can measure temperature from -55oC to +125oC ( -67oF to +257oF ) with an accuracy of +-5%.
  • Data received from single wire is in the ranges of 9-bit to 12-bit.
  • As DS18B20 follows 1-wire protocol so we can control this sensor via single pin of Microcontroller. (We also have to provide GND)
  • 1-wire protocol is an advanced level protocol and each DS18B20 is equipped with a serial code of 64 bit which helps in controlling multiple sensors via single pin of of microcontroller.
  • In simple words, it assigns different addresses to all sensors attached and by calling the address, you can get that sensors’ value.
  • So, now let’s have a look at DS18B20 Pinout:

DS1820 Pinout

  • DS18B20 has 3 pins in total, which are:
    • Pin # 1: Vcc ( We have to provide +5V here ).
    • Pin # 2: Data Pin ( It’s the 1-wire from where we will get temperature readings ).
    • Pin # 3: GND ( We have to provide ground here ).
  • It is available in two packages, one is simple while the ot her one is waterproof DS18B20, both of their pinouts are shown in below figure:

Introduction to DS18B20, ds18b20 pinout, ds18b20 basics, ds18b20 pin diagram, basics of ds18b20, ds18b20 temperature sensor

  • Now let’s have a look at some of DS18B20 Characteristics & Features:

DS18B20 Features

  • I have assembled a table where I have added all the features and characteristics of DS18B20.
1.Supply VoltageVDD+3 to 5.5V
2.Pull-up Supply VoltageVPU+3 to 5.5V
3.Input Logic LowVIL-0.3 to +0.8V
4.Input Logic High
5.Sink CurrentIL4.0ma
6.Standby CurrentIDDS750 to 1000na
7.Active CurrentIDD1 to 1.5ma
8.DQ Input CurrentIDQ 5ua
10.NV Write Cycle TimetWR 2 to 10ms
12.EEPROM Data Retention
Temperature Conversion Time
14.Time to Strong Pullup On


Time Slot


16.Recovery TimeTREC1us
Write 0 Low Time


18.Write 1 Low Time
Read Data Valid


Reset Time High


21Reset Time Low


Presence-Detect High


Presence-Detect Low




  • Lets have a look at one wire Bus system:

 One Wire Bus System

  • As I told earlier that DS18B20 follows 1 wire protocol, so in order to understand its working, we must have a look at this protocol first.
  • Main advantage of 1 wire protocol is that we can control multiple 1-wire devices via single pin of Microcontroller.
  • You must have heard of master slave system, where 1 master device can control or communicate with all slave devices.
  • 1-wire protocol follows similar master slave system, where microcontroller acts as a master and all our 1-wire devices e.g. DS18B20 act as slaves.
  • If we have interfaced only one device with our microcontroller then such a system is called single drop but if we interface multiple 1-wire devices via single pin then it’s called multi drop system.
  • Now lets have a better understanding of One Wire System from figure given below:

DS18B20 pin pint,DS18b20 introduction, ds18b20 working. DS18B20 one wire Bus system

  • Now let’s have a look at DS18B20 Power Supply:

Power Supply of DS18B20

  • There are two ways to power up this temperature sensor DS18B20, which are:
    • External Power Supply.
    • Parasite Power Supply.
  • Let’s discuss both of these power supplies in detail:                                    
External Power supply of DS18B20
  • In this method, we provide power to DS18B20 by conventional method i.e. battery or adapter.
  • This method is applicable for temperature below +100 degree Celsius.
  • Main benefit of this method is, there is no extra load on resistor which use in this method and it perform work correctly. 
  •  Lets, have a look at the connections in below figure:

External power supply of ds18b20, power supply of ds18b20. pinout of ds18b20

Parasite Power Mode of DS18B20
  • In this method we do not need special power supply.
  • This method is used for temperature greater then +100 Celsius.
  • In normal situation this method provide efficient current and voltage to DS18B20 
  • But, in special work when DS18B20 convert  temperature value into digital then current value increase to such value which can damage resister.
  • To limit current in save value and good working of DS18B20 it is necessary to use pull up mosfet.
  • As, it  is use only for specific temperature value there we use external power supply.

Parasite power mode ds18b20 Introduction, DS18B20 pin out,Now ,lets have a look at picture of this method

Working of DS18B20

  • It works on the principle of direct conversion of temperature into digital value.
  • Its main features is  change its bit numbers according to change in temperature 
  • Like, it changes bit in 9. 10 ,11,and 12  bits as temperature  changes in values 0.5 °C . 0.25°C,1.25 and  0.0625°C respectively.
  • Its default bits value is 12 but it changes values according to temperature Change
  • It has alarm and lcd as  temperature changes alarms work and temperature value changes which we can get from lcd.
  • Now lets have a look at DS18B20 memory map 

DS18B20 Memory Map

  • There are are two types of memories which have DS18B20
  •  One SRAM  and other is EEPROM.
  • Sram is volatile memory it has data only in on condition 
  • EEPROM is Non-volatile memory it stores data in off condition
  • EEPROM also have low and high alarm trigger 
  • To have better under standing of Memory Map of DS18B20 look at picture which give better idea of memory map of ds18b20 

Memory Map ds18b20, pin pint of ds18b20, introduction to ds18b20,

  • Now lets have a look at Function Commands of DS18B20

DS18B20 Function Commands

These are function Commands of DS18B20. These commands allow some to read and write data on DS18B20 scratched memory. Lets discuss them

  • Convert T[44h] : This command starts the single temperature conversion.
  • Write scratched Pad [4Eh]: In this command we can write data on memory of DS18B20 to three bytes. Data is transferred in least multiple bit first.
  • Read Scratched Pad[BEh]: In this command we can read data on scratched pad memory of DS18B20.
  • Copy Scratchpad [48h]: This commonds data from scratched pad and send data to EEPROM in 2 , 3 and 4 bytes.
  • Read Power Supply [B4h]: This command tells about power supply mode of DS18B20.

Now lets have a look at Applications of DS18B20:

Applications of DS18B20

DS18B20 is used for temperature measurement. There are some applications of DS18B20:

  • We can use it in thermostat controls system.
  • It can be used in industries as temperature measuring device.
  • It can be used as thermometer.
  • We can use it in thermally sensitive devices .   
  • It can also use in HVAC systems.

So, that was all about temperature sensor DS18B20. I hope you have enjoyed today’s tutorial. IF you have any questions then ask in comments and we will resolve them all. Thanks for reading. Take care !!! 🙂


  1. The DS18B20 has a unique 64-bit serial code and allows to function on the same 1-wire bus. Only one microcontroller is needed to control multiple DS18B20 over a large area. It also provides benefits to machinery, process monitoring, and control systems.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.