Digital Thermometer Using Arduino & DS18B20 Temperature Sensor

Digital Thermometer Using Arduino & DS18B20 Temperature Sensor (Last Updated On: December 27, 2018)

Digital Thermometer Using Arduino & DS18B20 Temperature Sensor:

In this project we will learn how to design Digital Thermometer Using Arduino & DS18B20 Temperature Sensor. Simply we will interface Arduino with DS18B20 Digital Waterproof Temperature Sensor and display the temperature values in degree celsius.

The DS18B20 temperature sensor is a 1-wire digital temperature sensor. This comes with sealed package lets precisely measure temperatures in wet environments with a simple 1-Wire interface. It communicates on common bus. It means it can connect several devices and read their values using just one digital pin of the Arduino.


DS18B20 Waterproof Digital Temperature Sensor:

This is a pre-wired and waterproofed version of the DS18B20 sensor. Handy for when you need to measure something far away, or in wet conditions. The Sensor can measure the temperature between -55 to 125°C (-67°F to +257°F). The cable is jacketed in PVC.



Because it is digital, there is no any signal degradation even over long distances. These 1-wire digital temperature sensors are fairly precise, i.e ±0.5°C over much of the range. It can give up to 12 bits of precision from the onboard digital-to-analog converter. They work great with any microcontroller using a single digital pin.

Digital Thermometer Using Arduino & DS18B20 Temperature Sensor

The only downside is they use the Dallas 1-Wire protocol, which is somewhat complex, and requires a bunch of code to parse out the communication. We toss in a 4.7k resistor, which is required as a pullup from the DATA to VCC line when using the sensor.


LM35 vs DS18B20:

A DS18B20 is factory calibrated to output the right temperature. An LM35 is factory calibrated for voltage (not temperature), and the Arduino has to convert this to temperature.

LM35 is an analog temperature sensor, so any distortion in input can rapidly affect the reading. But DS18B20 is a digital temperature sensor, so input doesn’t affect the output reading.

If long wire is used for measuring temperature at certain distance, wire length can deviate the value in analog LM35 Sensor. But DS18B20 is a digital sensor, there is no affect in any output value.




LM35 can measure the temperature between −55°C to 150°C but DS18B20 can measure between −50°C to 125°C.

1 digital output pin of Arduino can be used to connect multiple DS18B20 but it doesn’t happen with LM35.


Components Required for Digital Thermometer:

1. Arduino UNO Board
2. DS18B20 Waterproof Temperature Sensor (Buy Online from Amazon)
3. 16*2 LCD Display
4. 4.7K Resistor
5. Breadboard
6. Connecting Jumper Wires

Circuit Diagram & Connections:

Digital Thermometer Using Arduino & DS18B20 Temperature Sensor

Connect pin 7,6,5,4,3,2 of Arduino to pin 4,6,11,12,13,14 of LCD.

Connect VDD pin of DS18B20 to 5V and GND Pin to Ground. Connect its data pin to digital pin 8 of Arduino and also to 4.7K Resistor (Connect other end of 4.7K Resistor to 5V) as shown in the figure below.


Working of the Project:

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.




Source Code/Program:

To design Digital Thermometer Using Arduino & DS18B20 Temperature Sensor you need two different library
1. Download 1 Wire Library
2. Download Dallas Temperature Library

Add these to library file to Arduino IDE and then simply compile and upload the code.


Video Tutorial & Explanation:

Recommended For You

Ask A Question .......

Close