DS18B20 Waterproof Temperature Sensor with Maker UNO

Introduction

Are you trying to read liquid💧 temperature and don’t know how🧐? Here is one of the ways on how to get the liquid temperature using DS1820B waterproof temperature sensor on Maker UNO.. And the reading will be displayed on the I2C LCD. It’s so easy!

Video

Watch this video for more info on how to use DS18B20 Waterproof Temperature Sensor with Maker UNO.

This is the hardware connection and the components needed.

Sample Code

// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#define ONE_WIRE_BUS 9
float Celsius = 0;
float Fahrenheit = 0;
LiquidCrystal_I2C lcd(0x27, 20, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
void setup() {
lcd.init();
lcd.backlight();
sensors.begin();
Serial.begin(9600);
}
void loop() {
sensors.requestTemperatures();
Celsius = sensors.getTempCByIndex(0);
Fahrenheit = sensors.toFahrenheit(Celsius);
Serial.print(Celsius);
Serial.print(" C ");
Serial.print(Fahrenheit);
Serial.println(" F");
lcd.setCursor(2, 0);
lcd.print("TEMPERATURE");
lcd.setCursor(0, 1);
lcd.print((char)223);
lcd.setCursor(1, 1);
lcd.print("C:");
lcd.setCursor(3, 1);
lcd.print(Celsius, 1); //display the temperature in 1 decimal place
lcd.setCursor(8, 1);
lcd.print((char)223);
lcd.setCursor(9, 1);
lcd.print("F:");
lcd.setCursor(11, 1);
lcd.print(Fahrenheit, 1); //display the temperature in 1 decimal place
delay(1000);
}

view raw
DS18B20.ino
hosted with ❤ by GitHub

Reference

Arduino DS18b20 Temperature Sensor Tutorial

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiries, please post at Cytron Technical Forum.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Send Data to Firebase Using Arduino Uno WiFi Rev2
Simple Alarm System Using Maker Nano
Program Cucumber ESP32-S2 Using CircuitPython
Face Recognition Using OpenCV on Raspberry Pi 400
Turned Your Tablet as a Display for the Raspberry Pi 400
Scroll to Top