← Back to Basic Projects

🌑️ Room Temperature Monitor

Arduino DHT11 temperature monitor tutorial: connect a DHT11 sensor and display live temperature/humidity readings using ready-to-use Arduino temperature sensor code.

πŸ“‹ Overview

The DHT11 is a remarkably accurate sensor that measures both temperature and humidity using a single digital pin. At under $2, it's one of the best value sensors in electronics.

Technical Insight: The DHT11 sensor utilizes a capacitive humidity sensor and a thermistor to measure the surrounding air, providing calibrated digital output signals on the data pin. It features a temperature range of 0 to 50Β°C (accuracy Β±2Β°C) and a humidity range of 20 to 90% (accuracy Β±5%), making it the most cost-effective choice for 95% of hobbyist environmental monitoring stations.

In simple terms: Instead of reading raw, complex analog voltage fluctuations from separate sensors, the DHT11 handles all the mathematics internally and transmits the final calibrated values directly to the Arduino using a single-wire digital protocol.

What you'll learn: Installing external libraries in the Arduino IDE, fetching calibrated sensor data, printing to the Serial Monitor, and basic digital communication principles.

Estimated time: 20-30 minutes. Difficulty: ⭐ Beginner-friendly.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R3ATmega328P, 5V1Any Uno-compatible board works
DHT11 Sensor3.3–5V, +/-2Β°C accuracy1DHT22 also works (more accurate)
Resistor10kOhm pull-up1Between data pin and VCC
Breadboard400 tie-points min1Half-size is fine
Jumper WiresMale-to-Male~5Various lengths
USB CableType A to B1For uploading code

πŸ—ΊοΈ Component Pin Mapping

Room Temperature Monitor Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Install DHT Library

Open Arduino IDE β†’ Sketch β†’ Include Library β†’ Manage Libraries. Search for DHT sensor library by Adafruit and install it along with Adafruit Unified Sensor.
2

Wire the DHT11

DHT11 has 3 useful pins: VCC β†’ Arduino 5V, GND β†’ Arduino GND, DATA β†’ Arduino digital pin 2.
3

Add Pull-up Resistor

Connect a 10kOhm resistor between the DATA pin and VCC (5V). This ensures reliable signal levels.
4

Upload the Code

Paste the code below, select your board, and click Upload.
5

Open Serial Monitor

Go to Tools β†’ Serial Monitor, set baud rate to 9600. Temperature and humidity readings will appear every 2 seconds.
πŸ’‘
The DHT11 needs at least 1–2 seconds between readings. Reading it faster can cause errors or incorrect values.

πŸ’» Arduino Code

temperature_monitor.ino
INO
// Room Temperature Monitor β€” Volt X
#include <DHT.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
  Serial.println("Volt X β€” Temperature Monitor");
}

void loop() {
  delay(2000);
  float humidity = dht.readHumidity();
  float tempC = dht.readTemperature();

  if (isnan(humidity) || isnan(tempC)) {
    Serial.println("Sensor read error!");
    return;
  }

  Serial.print("Temperature: ");

⭐ Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...