DHT11 Temperature Sensor XH2.54 terminal 1602 I2C LCD with Arduino

What you need:
1 X DHT11 Temperature Sensor XH2.54mm terminal
1 X 1602 I2C LCD Display module
1 X Arduino UNOR3
1 X 7P Female to Male Jump Wire
1 X USB Cable

Materials for DHT11 Temperature Humidity Measurement and display

DHT11 to UNOR3:
S to D2
+ to 3V3
– to GND

1602 I2C LCD to UNOR3:
VCC to 5V
SDA to A4
SCL to A5

DHT11 sensor 1602 I2C LCD wiring with Arduino

Download below two libraries on your Arduino IDE:
DHT sensor library
LiquidCrystal I2C


#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

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

// check if any reads failed
if (isnan(humi) || isnan(tempC)) {
lcd.setCursor(0, 0);
} 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.setCursor(0, 1); // start to print at the second row
lcd.print(“Humi: “);
lcd.print(humi); // print the humidity

After upload the code, the measurement of the temperature and humidity results displayed in 1602 LCD like below picture:

Note: if the lcd displays not properly after powered on, pls adjust the blue potentiometer on the IIC Adapter board which is installed in the backside of the lcd module.


Purchase link:




Leave a Reply

Your email address will not be published. Required fields are marked *