
Smart Temperature and Humidity Monitor using DHT11 & LCD Display
1. Introduction
This project is a Smart Temperature and Humidity Monitor using an Arduino Uno, a DHT11 sensor, and a 16×2 LCD display. It continuously measures temperature and humidity and displays the values in real time. This project is useful in weather monitoring, greenhouse automation, and indoor climate control.
Real-World Applications:
- Home automation – Automatic climate control in smart homes.
- Greenhouse monitoring – Ensuring optimal conditions for plant growth.
- Industrial monitoring – Maintaining ideal environmental conditions in storage facilities.
2. Learning Objectives
By completing this project, you will:
✅ Understand how the DHT11 temperature and humidity sensor works.
✅ Learn to interface an LCD (16×2) with an Arduino using the I2C module.
✅ Understand how to use the DHT sensor library for easy data acquisition.
✅ Learn to process and display real-time sensor data on an LCD.
✅ Implement basic coding and debugging techniques for sensor-based projects.
3. Tools and Components
✔ Arduino Uno (or compatible board)
✔ DHT11 Temperature & Humidity Sensor
✔ 16×2 LCD Display with I2C Module
✔ 10KΩ Resistor (if using LCD without I2C)
✔ Jumper Wires (Male-to-Male, Female-to-Male)
✔ Breadboard
✔ Power Supply (USB Cable or 9V battery with adapter)
✔ Arduino IDE (Software for coding & uploading)
4. Background & Definitions
What is the DHT11 Sensor?
The DHT11 is a digital temperature and humidity sensor that provides accurate measurements using a capacitive humidity sensor and a thermistor for temperature sensing.
- Humidity Range: 20% – 90% RH
- Temperature Range: 0°C – 50°C
- Accuracy: ±2% humidity, ±0.5°C temperature
- Operating Voltage: 3.3V – 5V
What is an I2C LCD Module?
The I2C module for an LCD allows us to reduce the number of connections needed between the LCD and the Arduino. Instead of using six or more wires, we only need two (SDA & SCL).
What is I2C Communication?
I2C (Inter-Integrated Circuit) is a serial communication protocol that allows multiple devices to communicate using only two wires:
- SDA (Serial Data Line) – Transmits data
- SCL (Serial Clock Line) – Synchronizes data transfer
5. Step-by-Step Guide
Step 1: Circuit Diagram & Wiring
Connect the components as follows:
DHT11 Sensor Wiring:
| DHT11 Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| Data | D2 |
| GND | GND |
I2C LCD Module Wiring:
| I2C LCD Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
Step 2: Install Required Libraries
Open Arduino IDE and install the necessary libraries:
- DHT Sensor Library (by Adafruit)
- Go to Sketch → Include Library → Manage Libraries
- Search for DHT sensor library and install it
- LiquidCrystal I2C Library
- Search for LiquidCrystal I2C and install it
Step 3: Write the Code
Now, upload the following code to your Arduino Uno:
cppCopyEdit#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
// Define DHT11 sensor pin & type
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address might be 0x3F or 0x27
void setup() {
lcd.begin(); // Initialize LCD
lcd.backlight(); // Turn on backlight
dht.begin(); // Start DHT sensor
}
void loop() {
float temp = dht.readTemperature(); // Read temperature
float hum = dht.readHumidity(); // Read humidity
if (isnan(temp) || isnan(hum)) {
lcd.setCursor(0, 0);
lcd.print("Sensor Error");
return;
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print("%");
delay(2000); // Update every 2 seconds
}
6. Testing & Debugging Tips
🔹 Check wiring carefully – Ensure SDA & SCL are correctly connected.
🔹 Use I2C Scanner Sketch – If LCD doesn’t display, check its I2C address with an I2C scanner.
🔹 Confirm library installation – Ensure both DHT11 and LiquidCrystal_I2C libraries are installed.
🔹 Check power supply – The DHT11 sensor requires stable 5V power.
🔹 Verify sensor readings – If displaying NaN (Not a Number), recheck the DHT11 wiring and library.
7. Extensions & Modifications
✨ Upgrade to DHT22 – A more accurate and wider-range sensor.
✨ Add an OLED display – Use a 0.96″ OLED instead of an LCD for compact design.
✨ Wi-Fi Connectivity (IoT) – Send data to a cloud platform using an ESP8266 or NodeMCU.
✨ Buzzer for Alerts – Add a buzzer to beep if temperature exceeds a threshold.
✨ SD Card Data Logging – Store temperature and humidity data for analysis.
8. Conclusion
Congratulations! 🎉 You have successfully built a Smart Temperature & Humidity Monitor using Arduino. This project introduces sensor interfacing, I2C communication, and real-time data display, which are essential for advanced IoT and automation systems.