Intermediate
3 hours
Arduino Temperature & Humidity Monitor with LCD
The DHT22 sensor measures both temperature and humidity with good accuracy (±0.5 °C, ±2–5% RH) and communicates over a single data wire. This project pairs it with a 16×2 I2C LCD display for a clean, self-contained desk monitor. You’ll learn about I2C communication, library usage, and managing multiple screens on a small display.
What You’ll Need
- Arduino Uno or Nano
- DHT22 sensor (or DHT11 for lower accuracy)
- 10 kΩ pull-up resistor
- 16×2 LCD with I2C backpack module
- Breadboard and jumper wires
- USB power or 9 V barrel supply
Step-by-Step Instructions
- Install libraries: Install “DHT sensor library” by Adafruit and “LiquidCrystal I2C” by Frank de Brabander via Library Manager.
- Wire the DHT22: Pin 1 (VCC) → 3.3 V or 5 V, Pin 2 (Data) → Arduino pin 2 with a 10 kΩ pull-up to 3.3/5 V, Pin 4 (GND) → GND.
- Wire the I2C LCD: SDA → Arduino A4, SCL → Arduino A5, VCC → 5 V, GND → GND. Most I2C backpacks have address 0x27 — run an I2C scanner sketch if yours doesn’t respond.
- Write the sketch: Initialise DHT and LCD in setup(). In loop(), read temperature and humidity every 2 seconds. Line 1 of LCD: “Temp: XX.X C”. Line 2: “Hum: XX.X %”. Every 10 seconds, switch line 2 to show heat index.
- Add min/max tracking: Store min/max temperature values in variables. Add a button on pin 7 to toggle between current readings and min/max display.
- Calibrate: Compare readings against a known thermometer and offset in code if needed using the DHT library’s temperature offset parameter.
Safety Notes
- DHT22 is rated for 3.3–5 V — both voltages work fine with Arduino Uno.
- Keep the sensor away from direct sunlight and airflow vents for accurate ambient readings.
Tips & Troubleshooting
- If the LCD shows all black blocks, adjust the contrast potentiometer on the I2C backpack with a small screwdriver.
- If DHT readings show NaN, check the pull-up resistor is connected between Data and VCC, not to GND.
- Mount in a 3D-printed case or laser-cut acrylic frame for a finished desktop gadget.