
DHT11 Temperature and Humidity Meter
Beginner20 minA starter project that measures the room's temperature and humidity with a DHT11 sensor and writes the values to the Arduino IDE's Serial Monitor once a second. Before uploading the code, install the DHTlib library in the Arduino IDE.

What you need
Wiring steps
- 1
Power the sensor

Plug a red jumper wire into the 5V pin on the Arduino's POWER header. Connect its other end to the top pin of the DHT11 module, marked + (VCC).
- Arduino 5V → DHT11 + (red wire)
- 2
Connect the data line

Plug a blue jumper wire into the Arduino's digital pin 2. Connect its other end to the middle data (DATA) pin of the DHT11 module. The code reads the sensor on this pin.
- Arduino pin 2 → DHT11 DATA (blue wire)
- 3
Ground (GND) connection

Plug a black jumper wire into the GND pin on the Arduino's digital header, next to pin 13. Connect its other end to the bottom pin of the DHT11 module, marked −. That completes all three of the sensor's connections.
- Arduino GND → DHT11 − (black wire)
Arduino sketch
#include <dht.h>
dht DHT;
void setup() {
Serial.begin(9600);
}
void loop() {
// read the
// DHT11 on pin 2
int chk = DHT.read11(2);
// write the temperature
// to the Serial Monitor
Serial.print("Temp: ");
Serial.print(DHT.temperature);
// '\t' puts a tab
// between the values
Serial.print(" °C\t");
// write the humidity
// to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(DHT.humidity);
// println ends the line
// and moves to the next one
Serial.println(" %");
delay(1000);
}
What the Serial Monitor shows
Temp: 24.00 °C Humidity: 45.00 % Temp: 24.00 °C Humidity: 45.00 %
Similar projects
LCD ThermometerBeginner30 minA small device that shows temperature and humidity on a 16x2 LCD instead of the Serial Monitor, so it can sit on a desk without a computer. The DHT11 is read every two seconds; the top line of the screen shows the temperature and the bottom line the humidity. It teaches driving a screen over I2C with just two data wires, using two libraries together, and updating a line on the screen without clearing it. Install the "LiquidCrystal I2C" and "DHTlib" libraries from the Library Manager.Open project
Night Light (LDR)Beginner20 minA night light that turns itself on as the room gets dark. An LDR (light sensor) and a 100 kΩ resistor form a voltage divider; the Arduino reads the light level on pin A0 and, in the dark, dims the LED on pin 9 with PWM. It teaches analog reading, thresholds and PWM. No extra library needed.Open project
DHT22 Temperature and Humidity MeterBeginner20 minA project that measures humidity and temperature, in both Celsius and Fahrenheit, with a DHT22 sensor and writes them to the Serial Monitor every two seconds. It is more precise than the DHT11 and has a wider measuring range. Before uploading the code, install Adafruit's "DHT sensor library" in the Arduino IDE (and the "Adafruit Unified Sensor" library it asks for).Open project
In the app, tick off every wire, match the parts to your inventory and pick up where you left off.
