🌡️ Arduino Project: Temperature & Humidity Monitor with LCD
🌡️ Arduino Project: Temperature & Humidity Monitor with LCD

🌡️ Arduino Project: Temperature & Humidity Monitor with LCD


1. 🚀 Introduction

This project creates a real-time temperature and humidity monitor using an Arduino, a DHT11 sensor, and a 16×2 LCD display. It’s perfect for applications like:

  • Indoor air quality monitoring
  • Greenhouse climate control
  • Server room environmental tracking
  • DIY weather stations

The system will continuously read data from the sensor and display the results on an LCD screen. You’ll learn how to wire, code, and troubleshoot the entire setup.


2. 🎯 Learning Objectives

By completing this project, you’ll gain skills in:

  • Interfacing digital sensors with Arduino
  • Reading and interpreting temperature and humidity data
  • Using an LCD screen to show real-time outputs
  • Writing modular, readable Arduino code
  • Expanding projects with alerts or IoT features

3. 🧰 Tools and Components

You’ll need the following:

  • 1x Arduino Uno board
  • 1x DHT11 temperature & humidity sensor
  • 1x 16×2 LCD (optionally with I2C adapter)
  • 1x Breadboard
  • Jumper wires
  • 1x USB cable to upload code
  • Arduino IDE installed on your computer

4. 📚 Background & Key Definitions

DHT11 Sensor
A basic digital sensor that measures both temperature (0–50°C) and relative humidity (20–90%). It communicates with the Arduino via a digital pin, sending pre-calculated values.

16×2 LCD Display
An LCD that shows 16 characters per row and has 2 rows. You can connect it in standard 8-pin mode or simplify the wiring using an I2C backpack.

I2C Protocol (Optional for LCD)
A communication protocol using just two wires (SDA and SCL). This allows easier connection and saves Arduino I/O pins.


5. 🛠️ Step-by-Step Guide

🧩 Circuit Wiring

Option A: With I2C LCD

  • DHT11 sensor
    • VCC → Arduino 5V
    • GND → Arduino GND
    • DATA → Arduino digital pin 2
  • I2C LCD connections
    • VCC → Arduino 5V
    • GND → Arduino GND
    • SDA → Arduino A4
    • SCL → Arduino A5

Option B: Without I2C (standard LCD)

You’ll need more wires and a potentiometer for contrast. Let me know if you want this version detailed.


💻 Arduino Code

Before uploading the code, install the following libraries in the Arduino IDE:

  • DHT sensor library by Adafruit
  • LiquidCrystal_I2C by Frank de Brabander
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2); // Common I2C address is 0x27

void setup() {
  lcd.init();           
  lcd.backlight();       
  dht.begin();           

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

void loop() {
  float temp = dht.readTemperature();
  float hum = dht.readHumidity();

  if (isnan(temp) || isnan(hum)) {
    lcd.setCursor(0, 0);
    lcd.print("Sensor Error");
    return;
  }

  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 and Debugging Tips

  • If the DHT11 gives an error:
    • Double-check the data pin and wiring.
    • Try adding a 10k pull-up resistor on the data line (optional but helpful).
  • If the LCD is blank or scrambled:
    • Adjust the contrast screw (on the I2C module if present).
    • Check the I2C address using an I2C scanner sketch.
  • If values are unstable:
    • Ensure the sensor is away from heat sources or strong air currents during testing.

7. 🔧 Project Extensions

Here are ways to expand or customize your monitor:

  • Add a buzzer or RGB LED to indicate when temperature exceeds limits.
  • Use an RTC (Real-Time Clock) module to log data with time stamps.
  • Connect an ESP8266 or ESP32 to upload readings to the cloud.
  • Store data on an SD card for offline logging.
  • Build a graphical interface using Processing or Python to plot data in real time.