Skip to content

Interfacing DS18b20 Temperature sensor with Arduino + LCD to measure in Celsius and Fahrenheit



 

Hello, and welcome to this quick tutorial where I use the digital temperature sensor DS18B20 with an Arduino Board, I’m using the UNO board. The DS18b20 can output the temperature in 9 bit up to 12 bit signal, the DS18B20 communicates over a 1-Wire bus and has a unique 64bits serial code, you can use a lot to create a network using the same wire.

Sensor features (Datasheet):

  • Unique 1-Wire® Interface Requires Only One Port Pin for Communication
  • Reduce Component Count with Integrated Temperature Sensor and EEPROM
  • Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
  • ±0.5°C Accuracy from -10°C to +85°C
  • Programmable Resolution from 9 Bits to 12 Bits
  • No External Components Required
  • Parasitic Power Mode Requires Only 2 Pins for  Operation (DQ and GND)
  • Simplifies Distributed Temperature-Sensing Applications with Multidrop Capability
  • Each Device Has a Unique 64-Bit Serial Code Stored in On-Board ROM
  • Flexible User-Definable Nonvolatile (NV) Alarm Settings with Alarm Search Command Identifies Devices with Temperatures Outside Programmed Limits

Make sure to check the tutorial video above for more information.

Wiring:

The wiring is pretty simple Vdd/Gnd with 3.3V/Gnd (you can use 5v) and then one wire with a digital pin, LCD uses the i²c bus, therefore the SDA/SCL are wired with A4/A5. And of course the LCD is optional and can be replaced with anything from your choice.

DS18b20_bb.png
DS18b20 Wired with Arduino Uno board and LCD i2c




Libraries:

The libraries I’ve used are:

Codes:

The codes I’ve used are 3, Download codes here or check below:

Code 1:

the first one is just a simple test to show the temperature in Celsius or Fahrenheit on the Serial monitor, just comment or uncomment the necessary lines.

 

Code 2:

the second one shows the temperature on the serial monitor but this time using different sensor format 9-12 bits.

 



Code 3:

and the last one concerns the LCD i²c screen, and here you have your thermometer easy peasy as always.

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

One thought on “Interfacing DS18b20 Temperature sensor with Arduino + LCD to measure in Celsius and Fahrenheit Leave a comment

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading