Introduction: DIY Arduino Thermometer With DS18B20

Picture of DIY Arduino Thermometer With DS18B20

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.

Step 1: ​Information About the Sensor

Picture of ​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

Picture of 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

Picture of 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

Picture of 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


Banjo1275 made it! (author)2016-02-14

This was a very useful tutorial. I used it primarily to get started, and then a few other resources to get a prototype going with three temperature sensors, on two busses that updates to create an on-line dashboard. It's not pretty, but it's working.

It's awesome what you have done. I made one device using ESP-8266 HUZZAH and 6 DS18B20 sensors to monitor my greenhouse and I was sending the whole data from them to Adafruit IO.

Interesting on your greenhouse project. I have a couple of those ESP-8266 boards too. One day want to get them going as a remote temperature sensor too. Would be much easier for outside temperature measurement to have it wireless. Could then put it on the north side of my house. The Adafruit IO looks interesting, I'm only marginally happy with the combo, but it's been doing the job now for a year. I like the long term temperature graph that you are able to display. Perhaps it's time to update my setup.

Thanks again for posting this version, it was very helpful getting mine going.

abolfazlmirashrafi (author)2016-10-15

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.

Kim Erso (author)2016-08-07

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

mortenlc (author)2016-05-09

Works like a charm.



espeester (author)2016-04-08

Thanks for the tutorial! Was really useful ;)

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

You're welcome ! But I think it need some retouching.

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

Sainsmartuno (author)2016-02-25

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

kmunnery (author)2016-02-17

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.

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.

aaviles5 (author)2015-12-19

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.

raindr (author)2015-12-11

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

EdwardTH (author)2015-10-13

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?

Yes, of course ! Its possible.

Cowdad62 (author)2015-10-12

Please tell me what a temperature trough is?

About This Instructable



Bio: I am a dreamer, maker and an engineer making and sharing interesting projects here at Instructables. Follow me @ instagram: @the_gadget.boy
More by Konstantin Dimitrov:Arduino/Genuino 101 BLE Thermometer With TMP102 and BlynkPixie: An Arduino Based NeoPixel WristwatchTurn Your Old 2.5'' Or 3.5'' Hard Drive Into Portable/External
Add instructable to: