Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Interfacing DHT11 Humdity & Temperature Sensor with Arduino & LCD
Arduino Projects

Interfacing DHT11 Humdity & Temperature Sensor with Arduino & LCD

Mamtaz AlamBy Mamtaz AlamUpdated:February 2, 20256 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
Interfacing DHT11 Humidity Temperature Sensor with Arduino LCD
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Introduction

In this tutorial, we will be interfacing DHT11 Humidity Temperature Sensor with Arduino and a 16×2 LCD Display.

Understanding and monitoring environmental conditions are crucial for various applications, ranging from ensuring comfort in living spaces to optimizing conditions in controlled environments. In this project, we introduce a digital humidity and temperature meter, which leverages the capabilities of the DHT11 Humidity & Temperature Sensor in conjunction with an Arduino microcontroller. Not only will you gain insights into the precise temperature and humidity levels of your surroundings, but you’ll also be presented with these metrics on a user-friendly LCD display.

The DHT11 Temperature and Humidity Sensor is an advanced piece of equipment that boasts a calibrated digital signal output, thanks to its integrated temperature and humidity sensor complex. Engineered for utmost reliability, it ensures commendable long-term stability. At the heart of this sensor lies an efficient 8-bit microcontroller. The DHT11 sensor is meticulously designed, featuring a resistive element and a wet NTC temperature measuring component. With attributes like rapid response, stellar anti-interference capabilities, and exceptional value for money, it’s a top choice for DIY enthusiasts and professionals alike.




Components Required

The following are the components required for this tutorial

S.N.ComponentsQuantityPurchase Link
1Arduino UNO Board1Amazon | AliExpress | SunFounder
2DHT11 Humidity Temperature Sensor1Amazon | AliExpress| SunFounder
316X2 I2C LCD Display1Amazon | AliExpress | SunFounder
4Breadboard1Amazon | AliExpress | SunFounder
5Jumper Wires7Amazon | AliExpress | SunFounder

DHT11 Humidity Temperature Sensor

DHT11 Humidity Temperature Sensor

The DHT11 is a commonly used and cost-effective sensor that provides readings of both temperature and humidity. Compact and cost-effective, it has become a popular choice in the electronics community for its relative accuracy and ease of integration. Operating on a simple one-wire communication protocol, the DHT11 can be seamlessly interfaced with a variety of microcontrollers, making it suitable for a wide range of applications.

Developed for digital systems, the DHT11 finds its applications in environments where there’s a need to monitor or control atmospheric conditions, such as in smart homes, weather stations, and agricultural monitoring systems.



Features/Specifications of DHT11 Sensor

  • Power Supply: Typically operates from 3.3 to 5V DC, making it suitable for interfacing with most microcontrollers.
  • Temperature Range: 0°C to 50°C with ±2°C accuracy.
  • Humidity Range: 20% to 90% RH (Relative Humidity) with ±5% accuracy.
  • Output: Calibrated digital signal. It employs a single-wire communication protocol which simplifies integration with microcontroller systems.
  • Sampling Period: Suggested minimum time of 1 second between readings to ensure sensor accuracy.
  • Dimensions: Compact size, often available in a 4-pin single-row package.
  • Longevity: Offers excellent long-term stability, thanks to its calibrated digital output.

Construction of DHT11 Sensor

  • Sensing Elements: The DHT11 integrates two primary components for its operations:
    1. A thermistor for temperature measurements.
    2. A capacitive humidity sensor for gauging atmospheric moisture.
  • IC Integration: An 8-bit microcontroller reads the outputs from the two sensors and translates them into a format suitable for digital systems.
  • Packaging: The sensor elements are often encased in a plastic casing, which ensures protection against environmental factors while still allowing for accurate readings.

Working of DHT11 Sensor

    • Temperature Measurement: The core of the temperature sensing capability is the thermistor, a type of resistor whose resistance changes with temperature. As the temperature fluctuates, so does the resistance of the thermistor. This variance is then read and converted into temperature values by the onboard microcontroller.

  • Humidity Measurement: The capacitive humidity sensor operates by having a dielectric material between two plates. As humidity changes, the dielectric constant of the material changes, leading to a variance in capacitance. This change in capacitance is then read and interpreted as a humidity percentage by the onboard microcontroller.
  • Signal Output: After the microcontroller processes the readings, the data is sent as a digital signal through a single-wire communication protocol. This digital output can then be easily read by microcontrollers such as Arduino, making integration and data interpretation straightforward.



Pinout of DHT11 Sensor

The DHT11 typically comes with a 4-pin package, although only three of them are functionally used:

DHT11 Pinout

  1. VCC (Pin 1): This is the power supply pin, which can accept voltages from 3.3V to 5V, making it compatible with most microcontroller systems.
  2. Data (Pin 2): This is the pin through which the DHT11 communicates. It uses a proprietary single-wire protocol to transmit temperature and humidity data to the connected microcontroller.
  3. NC (Pin 3): Not connected or used.
  4. GND (Pin 4): Ground pin, used to complete the circuit.

Interfacing DHT11 Sensor with Arduino

Let us interface the DHT11 Humidity Temperature Sensor with Arduino UNO.

Hardware Connection

The connection diagram is pretty simple as shown in the image below.

DHT11 Arduino Connection

Connect the VCC & GND Pin of DHT11 Sensor Module to 3.3V & GND pin of Arduino respectively. Similarly connect the DHT11 Data pin to Arduino Digital Pin 2.

DHT11 Humidity Temperature Sensor Arduino

You can use a jumper wire & connect the sensor with Arduino Board.


Source Code/Program

After hardware connection is done, you can move to the coding part of this project. First we need to install the DHT11 Sensor library. Download the DHT11 Sensor library from following link and add it to the Arduino Library Folder.

Download: DHT11 Sensor Library

Here is a complete code for interfacing DHT11 Sensor with Arduino. Copy the following code and paste it on your Arduino IDE editor window.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "DHT.h"
 
#define DHTPIN 2     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT 11
 
DHT dht(DHTPIN, DHTTYPE);
 
void setup() {
  Serial.begin(9600);
  dht.begin();
}
 
void loop()
{
  // Wait a few seconds between measurements.
  delay(2000);
 
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);
 
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
 
  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
 
  Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  Serial.print(f);
  Serial.print(F("°F  Heat index: "));
  Serial.print(hic);
  Serial.print(F("°C "));
  Serial.print(hif);
  Serial.println(F("°F"));
}

To upload this code, Select Arduino UNO from Board Manager and the COM port. Then you can click on upload button to upload the code.

After uploading the code, open the Serial Monitor.

The Serial Monitor will display the temperature readings in degree Celcius as well as Fahrenheit. It will also show the value of Humidity and Heat Index.



Interfacing DHT11 Sensor with Arduino & LCD Display

Using the above code, we can display the temperature and humidity on Serial Monitor. Now lets modify the hardware as well as code to display the temperature and humidity value on 16×2 I2C LCD Display.

Hardware Connection

The hardware connection is very simple as shown in the schematic below.

Arduino DHT11 16x2 LCD Display

Connect the SDA & SCL pin of LCD Display to Arduino A4 & A5 Pin respectively. Similarly connect the VCC & GND of LCD Display to 5V & GND of Arduino.

Arduino DHT11 LCD Connection

You may use the jumper wires again.

Source Code/Program

After LCD connection is done, you can move to the coding part of this project. We need to add LCD I2C Library to the Arduino library folder again

Download: I2C LCD Library

Here is a complete code for interfacing DHT11 Sensor with Arduino & 16×2 I2C LCD Display. Copy the following code and paste it on your Arduino IDE editor window.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"
 
LiquidCrystal_I2C lcd(0x27, 16, 2);
 
#define DHTPIN 2     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT 11
 
DHT dht(DHTPIN, DHTTYPE);
 
void setup()
{
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  dht.begin();
}
 
void loop()
{
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);
 
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
 
  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
 
  Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  Serial.print(f);
  Serial.print(F("°F  Heat index: "));
  Serial.print(hic);
  Serial.print(F("°C "));
  Serial.print(hif);
  Serial.println(F("°F"));
 
  lcd.setCursor(0, 0);
  lcd.print("Temp: ");
  lcd.print(t);
  lcd.print("*C");
  lcd.setCursor(0, 1);
  lcd.print("Humi: ");
  lcd.print(h);
  lcd.print("%");
  delay(2000);
  lcd.clear();
}

Upload the code to your Arduino Board. After the code is uploaded, the LCD Display will show the value of Temperature and Humidity. The reading changes after every 2 seconds.

You may heat the sensor to observe the change in readings on the LCD Display.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleDigital Tachometer using IR Sensor with Arduino for measuring RPM
Next Article Zero-Cross Detector Circuit using Transistor with waveform

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
Add A Comment

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • LD2410 Sensor with ESP32 - Human Presence Detection
    LD2410 Sensor with ESP32 - Human Presence Detection
  • Silicon Controlled Rectifier (SCR): Construction, Working & Applications
    Silicon Controlled Rectifier (SCR): Construction, Working & Applications
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.