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
- Arduino UNO
- DS18B20 Temperature sensor
- USB cable for uploading the code
- I2C LCD module
- 16×2 LCD
- Jumper wires
- Breadboard
- 10K-ohm resistor
- 10K Potentiometer
- With an I2C module
Circuit Diagram ds18b20 with arduino
Arduino UNO | I2C LCD Module | |
( +5V ) VCC | ( +5V ) VCC | |
GND ( Ground ) | GND ( Ground ) | |
A4 Pin ( SDA Pin ) | SDA Pin | |
A5 Pin ( SCL Pin ) | SCL Pin | |
16 * 2 LCD | I2C LCD Module | |
16 Pin Connect | 16 Pin Connect | |
Arduino UNO | 10k ohm Resistor | DS18B20 waterproof Temp. Sensor |
D5 Pin | Terminal 1 | Orange Colour Wire |
( +5V ) VCC | Terminal 2 | Red Colour Wire |
GND ( Ground ) | Black Colour Wire |
- Without an I2C module ds18b20 with arduino
Arduino UNO | 10k ohm Resistor | DS18B20 waterproof Temp. Sensor |
D5 Pin | Terminal 1 | Orange Colour Wire |
( +5V ) VCC | Terminal 2 | Red Colour Wire |
GND ( Ground ) | Black Colour Wire | |
Arduino UNO | 16*2 LCD | 10K 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 Pin | RS ( Register Select ) | |
GND | RW ( Read\Write ) | |
D11 Pin | E ( Enable ) | |
D10 Pin | D4 | |
D9 Pin | D5 | |
D8 Pin | D6 | |
D7 Pin | D7 |
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
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!
Can we get the project work
yes, connect us on instagram
The temperature is not changing