DIY Arduino Thermometer With DS18B20




About: I am a dreamer, maker and an engineer making and sharing interesting projects here at Instructables. Follow me @ instagram: @the_gadget.boy

Hello, everyone ! Today I'm going to show you how to make LCD or Serial* thermometer with DS18B20 digitaltemperature sensor using Arduino, breadboard, jumpers. So you can measure temperature of the air, liquids like water and the temperature of the ground.

*prints the temperature data on the serial monitor of the arduino IDE.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: ​Information About the Sensor

DS18B20 is 1-Wire digital temperature sensor from Maxim IC. Reports degrees in Celsius with 9 to 12-bit precision, from -55 to 125 (+/-0.5). Each sensor has a unique 64-Bit Serial number etched into it - allows for a huge number of sensors to be used on one data bus.


  • Unique 1-Wire® interface requires only one port pin for communication
  • Each device has a unique 64-bit serial code stored in an onboard ROM
  • Multidrop capability simplifies distributed temperature sensing applications
  • Requires no external components
  • Can be powered from data line.
  • Power supply range is 3.0V to 5.5V
  • Measures temperatures from –55°C to +125°C (–67°F to +257°F)±0.5°C accuracy from –10°C to +85°C
  • Thermometer resolution is user-selectable from 9 to 12 bits
  • Converts temperature to 12-bit digital word in 750ms (max.)
  • User-definable nonvolatile (NV) alarm settings
  • Alarm search command identifies and addresses devices whose temperature is outside of programmed limits (temperature alarm condition)
  • Applications include thermostatic controls, industrial systems, consumer products, thermometers, or any thermally sensitive system

Step 2: Gathering the Parts

To make the thermometer you will need the following things:

  1. Arduino board (UNO,DUE,Micro, etc..).
  2. DS18B20 sensor a waterproof or not and one 4.7k resistor*
  3. 16x2 LCD display with I2C bus.
  4. Breadboard and some jumpers to connect everything together.

*Some stores sell the sensor with 4.7k resistor

Step 3: Libraries !!!

Before you start to make the thermometer, download and unzip the following libraries for arduino at - /Progam Files(x86)/Arduino/Libraries (default)

  1. 1- Wire bus
  2. Dallas Temperature, it does all the calculations and other stuff
  3. Liquid Crystal I2C

Step 4: Serial Thermometer

To print the data on the Serial monitor connect the DS18B20 sensor to the Arduino using the jumpers and the breadboard and don't forget to connect or solder the 4.7k resistor between pin 2 an 3 of the sensor.

Then download, open and upload the .ino file which is named - DS18B20_Serial.

If everything is ok you should see the temperature being measured and showed in the Serial monitor of the arduino IDE like on the screenshot above.

Step 5: LCD Thermometer

If you don't want to measure the temperature through the serial monitor then this step is for you !

Connect the I2C LCD to pins UNO,- A4 (SDA) , A5 (SCL) andthe sensor to digital pin 2. Then download and upload the .ino file which is named - DS18B20_I2C_LCD . If everything is OK you will see the temperature readings on the display.

Also visit my previous instructable Arduino Thermometer With LM35 - here

2 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

18 Discussions

Kim Erso

3 years ago

thanks!! we will use this for our thesis project :)

1 reply

1 year ago

Thnx, good, basic tutorial - while playing around with this i confirmed that the pullup R is required, it will NOT work without it.


3 years ago

temperature trough is a typographical error. The author was trying to say "measure temperature through the serial..."

2 replies

Reply 1 year ago

It's a "typo", not a technical error. I read, and was confused by the sentence "If you don't want to measure the temperature Trough the serial interface ..." (and judging by the comments, I wasn't the only one). Trough made me think of waterbath, and other experimental techniques.

The author intended to say (and has since corrected it to) say "Through", not "Trough". A minor issue in an awesome instructable.


3 years ago

hi.thanks very lot for this project.
I have a question:
how can i save the log for a month which data save per hour a day.
i mean save the log hour to hour for 1 month.and so i can draw the graph of these logs.
please help me.thanks a lot master.


3 years ago

Works like a charm.




3 years ago

Thanks for the tutorial! Was really useful ;)

I complemented this with another tutorial and finally got connected my DS18b20 with an ESP8266.

2 replies
espeesterKonstantin Dimitrov

Reply 3 years ago

Maybe the tutorial is not so complete, but I found that the SDK and platform provided work like a charm!


3 years ago

Thanks for this example.
I have successfully got as far as the serial thermometer but when i try to compile the i2c lcd sketch it says
'class LiquidCrystal_I2C' has no member name 'init'
I am completely new to Arduino and would really appreciate your help.
Thank you


3 years ago

great build I got a question about the sensor, is it possible to replace it with sensor capable of reading 1200°f and higher as I would like to read the temp of my aluminum forge thanks.

1 reply
Konstantin Dimitrovkmunnery

Reply 3 years ago

Hello, since you want to measure 1200° F (649° C) and above you gonna need a thermocouple type K 'cause DS18B20 will burn. The thermocouples are something different, they can withstand temps above 1000°F, they are analog.

I will be happy to help with it.


3 years ago

i get

Arduino: 1.6.6 (Windows 8), Board: "Arduino Nano, ATmega328"

C:\Users\aviles\Desktop\DS18B20_I2C_LCD\DS18B20_I2C_LCD.ino: In function 'void setup()':

DS18B20_I2C_LCD:17: error: 'class LiquidCrystal_I2C' has no member named 'init'



exit status 1

'class LiquidCrystal_I2C' has no member named 'init'

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.


4 years ago

I need a ds18b20 for a project of mine, but I need it to spit out a 1 decimal reading instead of 2... is that possible?

1 reply

4 years ago

Please tell me what a temperature trough is?