Project: Smart Temperature and Humidity Monitor with LCD Display
Project: Smart Temperature and Humidity Monitor with LCD Display file DtMmptTNBvnvW6sBNbCQvM

Project: Smart Temperature and Humidity Monitor with LCD Display

1. Introduction

In this project, we will build a Smart Temperature and Humidity Monitor using an Arduino Uno, a DHT11 sensor, and a 16×2 LCD display. This system continuously measures and displays real-time temperature and humidity, making it useful for indoor climate monitoring, greenhouses, or weather stations.

2. Learning Objectives

By the end of this project, you will:

  • Understand how DHT11 sensors measure temperature and humidity.
  • Learn how to interface an LCD with Arduino using the I2C protocol.
  • Write Arduino code to collect sensor data and display it on an LCD.
  • Gain experience in sensor-based electronics projects.

3. Tools and Components

  • Arduino Uno
  • DHT11 Temperature and Humidity Sensor
  • 16×2 LCD Display with I2C Module
  • 10KΩ Resistor (for pull-up on DHT11)
  • Jumper Wires
  • Breadboard
  • Arduino IDE (for coding and uploading the program)

4. Background and Definitions

DHT11 Sensor

The DHT11 is a digital temperature and humidity sensor that provides precise measurements. It uses a capacitive humidity sensor and a thermistor to detect ambient conditions. The sensor communicates using a one-wire digital protocol.

  • Temperature Range: 0°C to 50°C (±2°C accuracy)
  • Humidity Range: 20% to 90% RH (±5% accuracy)
  • Operating Voltage: 3.3V – 5V

16×2 LCD with I2C

The 16×2 LCD is a common display module that shows 16 characters per line on two lines. Instead of using many Arduino pins, we will use an I2C adapter to reduce the wiring complexity.

  • I2C Communication: Uses only SDA (A4) and SCL (A5) pins on Arduino.
  • 4-bit mode operation reduces wiring requirements.

I2C Protocol

I2C (Inter-Integrated Circuit) is a communication protocol that allows multiple devices to communicate using just two wires:

  • SDA (Serial Data Line)
  • SCL (Serial Clock Line)

The LCD and Arduino communicate through this protocol, making our setup simpler.


5. Step-by-Step Guide

Step 1: Wiring the Components

  • Connect the DHT11 VCC pin to 5V on the Arduino.
  • Connect the DHT11 GND pin to GND on the Arduino.
  • Connect the DHT11 Data pin to Digital Pin 2 on the Arduino.
  • Place a 10KΩ pull-up resistor between the DHT11 Data pin and 5V.
  • Connect the LCD SDA pin to A4 on the Arduino.
  • Connect the LCD SCL pin to A5 on the Arduino.

Step 2: Installing Required Libraries

To make coding easier, install the following libraries in the Arduino IDE:

  • DHT Sensor Library (DHT sensor library by Adafruit)
  • LiquidCrystal I2C Library (LiquidCrystal_I2C by Frank de Brabander)

Step 3: Writing the Code

Upload this code to your Arduino Uno:

include

include

include

// Define DHT11 pin and type

define DHTPIN 2

define DHTTYPE DHT11

// Initialize LCD (0x27 is the common I2C address for LCDs)
LiquidCrystal_I2C lcd(0x27, 16, 2);
DHT dht(DHTPIN, DHTTYPE);

void setup() {
lcd.begin();
lcd.backlight(); // Turn on LCD backlight
dht.begin();

lcd.setCursor(0, 0);  
lcd.print(" Temp & Humidity ");  
delay(2000);  

}

void loop() {
float temp = dht.readTemperature(); // Read temperature
float humidity = dht.readHumidity(); // Read humidity

lcd.clear();  
lcd.setCursor(0, 0);  
lcd.print("Temp: ");  
lcd.print(temp);  
lcd.print(" C");  

lcd.setCursor(0, 1);  
lcd.print("Humidity: ");  
lcd.print(humidity);  
lcd.print(" %");  

delay(2000);  // Update every 2 seconds  

}

6. Testing and Debugging Tips

No Display on LCD?

  • Check the I2C address of your LCD. Some models use 0x3F instead of 0x27.
  • Run an I2C scanner sketch to detect the correct address.

DHT11 Not Reading?

  • Ensure you connected the data pin properly.
  • Add a 10KΩ pull-up resistor to the DHT11 data pin.

Slow Response?

  • The DHT11 has a sampling rate of 1Hz, meaning it updates once per second.

7. Extensions and Enhancements

  • Improve Display with OLED: Use an OLED screen for a more modern display.
  • Add a Buzzer Alert: Trigger a buzzer when the temperature exceeds a limit.
  • Data Logging: Store temperature/humidity readings on an SD card for analysis.
  • IoT Upgrade: Send data to the cloud using an ESP8266 Wi-Fi module.

Conclusion

You have successfully built a Smart Temperature and Humidity Monitor using Arduino! 🚀 This project teaches sensor interfacing, LCD display control, and I2C communication. You can enhance it further by adding alerts, remote monitoring, or advanced displays.