Menu Close

Arduino – Digital Thermometer

Robo India explains how to make digital thermometer using DHT Sensor.

1. Introduction 

Thermometer is very useful apparatus for measuring temperature. There are different ways to measure temperature and it is an important part of many applications.

In this tutorial, we have made a digital thermometer to display current temperature and humidity using DHT with Arduino.

The LCD connected, will display the current temperature and humidity of the room.

2. Hardware required

S.No.ItemQuantity
1.Arduino 1
2.Breadboard 1
3.I2C LCD Backpack 1
4.DHT 11 1
5.Male to Female Jumper Wires 7
6.Male to Male Jumper Wires 2

3. Connection

4. Programming

You may download this Arduino Sketch from here.

//Robo India tutorial on Digital Temperature & Humidity
//Required hardware: DHT & 16X2 LCD
//https://www.roboindia.com/tutorials

#include "DHT.h"
#define DHTTYPE DHT11
#define dhtPin 2                  // dht with D2 pin (Arduino)
DHT dht(dhtPin, DHTTYPE);
#include <Wire.h>  
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20, 4);  // SET I2C Address 
byte degreeSign[8] =                // code to create degree symbol
              {
                0b00111,
                0b00101,
                0b00111,
                0b00000,
                0b00000,
                0b00000,
                0b00000,
                0b00000
              };
void setup() 
{
  lcd.init();
  lcd.backlight();                  // makes Backligh ON. 
  lcd.clear();                      // Clears LCD
  lcd.createChar(1, degreeSign);
  lcd.setCursor(0,0);
  lcd.print("Robo India");
  lcd.setCursor(0,1);
  lcd.print("Thermometer");
  lcd.clear();
  dht.begin();
  delay(5000);
}


void loop()  
{
  float h = dht.readHumidity();    // read humidity 
  float t = dht.readTemperature(); // read temperature
  delay(100);
 
    lcd.clear();
    lcd.setCursor(0,0);             // display on LCD
    lcd.print("Temp.");
    lcd.setCursor(9,0);
    lcd.print(t);
    lcd.write(1);
    lcd.print("C");
    lcd.setCursor(0,1);
    lcd.print("Humidity");
    lcd.setCursor(9,1);
    lcd.print(h);
    lcd.print(" %");
    delay(1000);
}


5.Output

LCD displays the current and accurate temperature and Humidity of the room. The rate of changes can be programmed in the code.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply