What you need:
1 X DHT11 Temperature Sensor
1 X 1602 IIC LCD Display Module
1 X Arduino UNO
1 X 7P Female to Male Jump Wire
1 X USB Cable
Connection:
DHT 11 to UNO R3:
S to D2
+ to 3V3
– to GND
1602 LCD to UNO R3:
GND to GND
VCC to 5V
SDA to A4
SCL to A5
Download below two libraries on your Arduino IDE:
DHT sensor library
LiquidCrystal I2C
Code example:
#include <LiquidCrystal_I2C.h>
#include “DHT.h”
#define DHTPIN 2
#define DHTTYPE DHT11
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x3F, 16 column and 2 rows
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin(); // initialize the sensor
lcd.init(); // initialize the lcd
lcd.backlight(); // open the backlight
}
void loop()
{
delay(2000); // wait a few seconds between measurements
float humi = dht.readHumidity(); // read humidity
float tempC = dht.readTemperature(); // read temperature
lcd.clear();
// check if any reads failed
if (isnan(humi) || isnan(tempC)) {
lcd.setCursor(0, 0);
lcd.print(“Failed”);
} else {
lcd.setCursor(0, 0); // start to print at the first row
lcd.print(“Temp: “);
lcd.print(tempC); // print the temperature
lcd.print((char)223); // print ° character
lcd.print(“C”);
lcd.setCursor(0, 1); // start to print at the second row
lcd.print(“Humi: “);
lcd.print(humi); // print the humidity
lcd.print(“%”);
}
}
After upload the code, the measurement of the temperature and humidity results displayed in 1602 LCD like below picture:
Purchase link:
https://www.diymalls.com/DHT11-Digital-Temperature-Humidity-Sensor-with-LCD1602-I2C-Display-Module
***********************************************************************************
***********************************************************************************