A small weather station for your desk. The DHT11 measures temperature and humidity, and the 1602 LCD shows both on its two lines, updating every two seconds. Once it's programmed, you can power it from any USB charger.
What you need
- UNO R3 board and USB cable
- 1602 LCD display
- DHT11 temperature and humidity sensor
- 10 kΩ potentiometer (for the screen contrast)
- 1 resistor, 220 Ω
- Breadboard and jumper wires (all from the UNO R3 Starter Kit)
Before you start
The LCD has 16 connections in a row. If yours has no pins, solder 16 pins from the 40-pin male header in the kit first, so it plugs into the breadboard. Ask an adult to help if you're new to soldering.
Wiring

| From | To |
|---|---|
| LCD VSS | GND |
| LCD VDD | 5V |
| LCD V0 | Middle pin (W) of the potentiometer |
| LCD RS | UNO pin 12 |
| LCD RW | GND |
| LCD E | UNO pin 11 |
| LCD D0 to D3 | Not connected |
| LCD D4, D5, D6, D7 | UNO pins 5, 4, 3, 2 |
| LCD A (backlight +) | 220 Ω resistor, then 5V |
| LCD K (backlight −) | GND |
| Potentiometer outer pins | 5V and GND |
| DHT11 S (signal) | UNO pin 7 |
| DHT11 + and − | 5V and GND |
Use the breadboard's + and − rails for every 5V and GND connection. If your DHT11 has four pins instead of three, connect pin 1 to 5V, pin 2 to UNO pin 7 (with a 10 kΩ resistor from pin 2 to 5V), leave pin 3 empty, and connect pin 4 to GND.
Build it step by step
- Install the DHT sensor library by Adafruit (and Adafruit Unified Sensor when asked). The LiquidCrystal library is already built in.
- Place the LCD, the potentiometer and the DHT11 on the breadboard as in the diagram.
- Wire 5V and GND to the rails, then add the LCD, sensor and potentiometer connections.
- Upload the code.
- Slowly turn the potentiometer until the text is sharp and clear.
The code
#include <LiquidCrystal.h>
#include <DHT.h>
// LCD pins: RS, E, D4, D5, D6, D7
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
DHT dht(7, DHT11);
// A small degree symbol for the screen
byte degreeSymbol[8] = {
0b00110, 0b01001, 0b01001, 0b00110,
0b00000, 0b00000, 0b00000, 0b00000
};
void setup() {
lcd.begin(16, 2);
lcd.createChar(0, degreeSymbol);
dht.begin();
lcd.print("Room monitor");
lcd.setCursor(0, 1);
lcd.print("Starting...");
}
void loop() {
delay(2000); // the DHT11 needs about 2 seconds between readings
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
lcd.clear();
if (isnan(temperature) || isnan(humidity)) {
lcd.print("Sensor error");
lcd.setCursor(0, 1);
lcd.print("Check wiring");
return;
}
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temperature, 1);
lcd.write(byte(0));
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(humidity, 0);
lcd.print("%");
}
How it works
The LCD uses 4-bit mode: instead of eight data wires, the UNO sends each character in two halves over D4 to D7, which saves four pins. RS tells the screen whether it's getting a command or text, and E tells it when to read. The potentiometer sets a voltage on V0 that controls the contrast. createChar() draws a custom degree symbol from 8 rows of 5 pixels.
Make it your own
- Show a smiley when the room is comfortable (for example 20–24 °C and 40–60 % humidity).
- Keep track of the lowest and highest temperature and show them when you press a button.
- Switch the backlight off at night using a transistor from the kit.
Troubleshooting
- The screen lights up but shows only blocks or nothing: turn the potentiometer slowly from one end to the other.
- Strange characters: check D4 to D7 and the RS and E wires.
- "Sensor error": check the DHT11 signal wire on pin 7 and its power pins.
Learn the basics first
New to these parts? These lessons explain them step by step: Read temperature and humidity with the DHT11 and Set up the Arduino IDE and blink an LED.
0 comments