Druhi Chakraborty
Published © GPL3+

Temperature and Humidity sensor with LCD 1602 I2C display

Here I am going to display the temperature and humidity using the DHT11 sensor and LCD display 1602 with an I2C module and a relevant code.

BeginnerFull instructions provided30 minutes40,837
Temperature and Humidity sensor with LCD 1602 I2C display

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1

Software apps and online services

Arduino Web Editor
Arduino Web Editor

Hand tools and fabrication machines

Breadboard, 170 Pin
Breadboard, 170 Pin
Premium Male/Male Jumper Wires, 40 x 3" (75mm)
Premium Male/Male Jumper Wires, 40 x 3" (75mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)

Story

Read more

Schematics

Temperature and Humidity sensing with LCD 1602 I2C display

Please download it if required

Code

Temperature and Humidity sensing with LCD 1602 I2C display

C/C++
We are using the LCD display using the I2C module to display the temperature and humidity with the DHT 11 sensor.
//by Druhi Chakraborty
#include "DHT.h"
#define DHTPIN 4// you can use 
#define DHTTYPE DHT11//#define DHTTYPE DHT21
                     //#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);//you can also use pins 3, 4, 5, 12, 13 or 14
   // Pin 15 can work but DHT must be disconnected during program upload
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
 dht.begin();// initialize the sensor
 lcd.backlight();// turn on lcd backlight
 lcd.init();// initialize lcd
}
void loop() {
 lcd.clear();
   lcd.setCursor(0,0);// set the cursor on the first row and column
   lcd.print("Humidity=");
   lcd.print((float)dht.readHumidity());//print the humidity
   lcd.print("%");
   lcd.setCursor(0,1);//set the cursor on the second row and first column
   lcd.print("Temp=");
   lcd.print((float)dht.readTemperature());//print the temperature
   lcd.print("Celsius");
   delay(2000);
   lcd.clear();
}

Credits

Druhi Chakraborty

Druhi Chakraborty

1 project • 2 followers
I am student of class 10. But I want to go to MIT and I financially cannot so I think I have to try even harder. Am from India though, So...

Comments