Temperature Monitoring System With DS18B20 And Arduino

Hey guys, welcome back to Techatronic. In this article, we are going to make a Temperature Monitoring System with a DS18B20 waterproof temperature sensor and Arduino. If you like this project you can check out more cool projects on Arduino.

This system is capable of displaying the real-time readings of the temperature. We use an Arduino UNO microcontroller and I2C module with the 16×2 LCD here. The DS18B20 is a temperature sensor that generates its output according to the temperature it senses.

You can check the interfacing of the DS18B20 Temperature sensor with Arduino. Also, check out our E-book on Arduino which contains amazing projects with well-explained procedures.

Working on the Temperature Monitoring System

The LCD displays the real values captured by the sensor in degrees and also in Fahrenheit. As the temperature sensor which we use is waterproof you can dip it into the water to capture the temperature.  

You can also read the IoT weather monitoring system which is also made by us. You can check the value of the measured temperature on the LCD screen as well as on the serial monitor.

Use the image given below to locate the serial monitor on your Arduino IDE.

Components Required

Circuit Diagram ds18b20 with arduino

Arduino UNOI2C LCD Module
( +5V ) VCC( +5V ) VCC
GND ( Ground )GND ( Ground )
A4 Pin ( SDA Pin ) SDA Pin
A5 Pin ( SCL Pin ) SCL Pin
16 * 2 LCDI2C LCD Module
16 Pin Connect16 Pin Connect
Arduino UNO10k ohm ResistorDS18B20 waterproof Temp. Sensor
D5 PinTerminal 1Orange Colour Wire
( +5V ) VCCTerminal 2Red Colour Wire
GND ( Ground ) Black Colour Wire
  • Without an I2C module ds18b20 with arduino
Temperature Monitoring System circuit
Arduino UNO10k ohm ResistorDS18B20 waterproof Temp. Sensor
D5 PinTerminal 1Orange Colour Wire
( +5V ) VCCTerminal 2Red Colour Wire
GND ( Ground ) Black Colour Wire
Arduino UNO16*2 LCD10K Potentiometer
GND ( Ground )VSS, K 
+5 Volt (VCC)VDD, A 
GND ( Ground )VSS (Ground)Terminal 1
 VEE ( Contrast )Terminal 2
+5 Volt (VCC)VDD ( +5V )Terminal 3
D12 PinRS ( Register Select ) 
GNDRW ( Read\Write ) 
D11 PinE ( Enable ) 
D10 PinD4 
D9 PinD5 
D8 PinD6 
D7 PinD7 

There are two circuit diagrams given here, you can make the project with or without using an I2C module.

We provide you both the circuits and code. You have to make the connections according to the circuit you want to make. Connect the 5-volt pin of the Arduino to the VCC of the I2C module and the positive wire of the DS18B20 Temperature sensor.

Attach the GND pin of the Arduino to the GND of the I2C module and the negative wire of the DS18B20 Temperature sensor.

Join the SDA pin of the I2C module to the analogue-4 pin of the Arduino. Connect the SCL pin of the I2C module to the analogue-5 pin of the Arduino.

If you don’t know how to use the I2C module with 16×2 LCD then check it out first. If you are not using the I2C module then make the connections between LCD and Arduino as shown in the diagram.

Earlier we discussed the interfacing of 16×2 LCD with Arduino, so you can take a reference from it.

Code for the Project

Note: Please upload the given code to the Arduino as it is. You have to install <OneWire.h>, <DallasTemperature.h>, <LiquidCrystal.h>, <wire.h>, <liquidcrystal_i2c.h> libraries to your Arduino IDE before compiling the sketch.

  • Code for using the I2C module
 //TECHATRONIC.COM  
  // OneWire LIBRARY   
  // https://github.com/PaulStoffregen/OneWire   
  // DallasTemperature LIBRARY   
  // https://github.com/milesburton/Arduino-Temperature-Control-Library   
  // I2C LIBRARY  
  //https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library  
 #include <OneWire.h>  
 #include <DallasTemperature.h>  
 #include <Wire.h>   
 #include <LiquidCrystal_I2C.h>  
 LiquidCrystal_I2C lcd(0x27,16,2);   
 #define ONE_WIRE_BUS 5  
 OneWire oneWire(ONE_WIRE_BUS);  
 DallasTemperature sensors(&oneWire);  
  float Celcius=0;  
  float Fahrenheit=0;  
 void setup(void)  
 {  
  Serial.begin(9600);  
  sensors.begin();  
  lcd.init();             
  lcd.backlight();  
  lcd.print("Temp Monitoring");  
 }  
 void loop(void)  
 {   
  sensors.requestTemperatures();   
  Celcius=sensors.getTempCByIndex(0);  
  Fahrenheit=sensors.toFahrenheit(Celcius);  
  Serial.print(" C ");  
  Serial.print(Celcius);  
  Serial.print(" F ");  
  Serial.println(Fahrenheit);  
   lcd.setCursor(0, 1);  
   lcd.print(Celcius);  
   lcd.setCursor(6, 1);  
   lcd.print("C");  
   lcd.setCursor(9, 1);  
   lcd.print(Fahrenheit);  
   lcd.setCursor(15, 1);  
   lcd.print("F");  
  delay(1000);  
 }  
  • Code for without I2C module
 //TECHATRONIC.COM  
  // OneWire LIBRARY   
  // https://github.com/PaulStoffregen/OneWire   
  // DallasTemperature LIBRARY   
  // https://github.com/milesburton/Arduino-Temperature-Control-Library   
 #include <OneWire.h>  
 #include <DallasTemperature.h>  
 #include "LiquidCrystal.h"  
 LiquidCrystal lcd(5,6,7,8,9,10);  
 #define ONE_WIRE_BUS 5  
 OneWire oneWire(ONE_WIRE_BUS);  
 DallasTemperature sensors(&oneWire);  
  float Celcius=0;  
  float Fahrenheit=0;  
 void setup(void)  
 {  
  Serial.begin(9600);  
  sensors.begin();  
  lcd.begin(16,2);  
  lcd.print("Temp Monitoring");  
 }  
 void loop(void)  
 {   
  sensors.requestTemperatures();   
  Celcius=sensors.getTempCByIndex(0);  
  Fahrenheit=sensors.toFahrenheit(Celcius);  
  Serial.print(" C ");  
  Serial.print(Celcius);  
  Serial.print(" F ");  
  Serial.println(Fahrenheit);  
   lcd.setCursor(0, 1);  
   lcd.print(Celcius);  
   lcd.setCursor(6, 1);  
   lcd.print("C");  
   lcd.setCursor(9, 1);  
   lcd.print(Fahrenheit);  
   lcd.setCursor(15, 1);  
   lcd.print("F");  
  delay(1000);  
 }  

The Temperature Monitoring System Look Like

Temperature Monitoring System

We hope that you understand the project properly and please try to make it once. If you are facing any errors do inform us in the comments section below. Please read more Tutorials on Arduino and Raspberry Pi.

DS18B20 Temperature Sensor Working, construction and Applications

Using Temperature Sensor DS18B20 With Arduino

DHT11 Temperature and Humidity Sensor | DHT11 sensor

dht11 Sensor With SSD1306 OLED | dht11 with Arduino

HAPPY LEARNING!

3 thoughts on “Temperature Monitoring System With DS18B20 And Arduino”

Leave a Comment