MyRoboPathOpen Robotics Lab
Arduino Uno #3 of 35
Est. 0.75 Hours
Budget: $3 - $6
Beginner

DHT11 Temperature & Humidity Climate Monitor

Sample digital ambient temperature and relative humidity over a single-wire bus and compute real-time heat index.

Interface the DHT11 digital climate sensor with your Arduino Uno R3. Explore single-wire timing handshakes, verify 40-bit checksum integrity, stream calibrated °C/°F and %RH telemetry to the Serial Monitor, and trigger comfort alerts.

Arduino Uno R3DHT11 SensorSingle-Wire ProtocolHeat Index MathSerial Telemetry
DHT11 Temperature & Humidity Climate Monitor Blueprint
DHT11 Temperature & Humidity Climate MonitorCAD Blueprint

Key Learning Objectives & Robotics Concepts

By building and programming this project, you will master the following core engineering skills:

1Understand the DHT11 single-wire 18ms start signal and 40-bit data frame (humidity, temperature, checksum).
2Install and configure the DHT Sensor Library cleanly in Arduino IDE.
3Validate sensor packets using isnan() guards before updating downstream displays or relays.
4Compute apparent Heat Index from paired temperature and relative humidity readings.

Power Architecture & Voltage Staging

5V / 3.3V Regulated Power

The DHT11 operates cleanly from the Arduino Uno 5V pin, drawing under 2.5mA during brief 18ms measurement bursts and 150µA in standby. A 10kΩ pull-up keeps the bidirectional DATA line idle HIGH. Module PCB includes a 10kΩ pull-up resistor on DATA and decoupling capacitor; sample no faster than once every 2 seconds.

DHT11 Temperature & Humidity Climate Monitor Power Architecture Schematic
Figure: Regulated Arduino Uno supply rails, current budget, and component protection.Power Schematic

Bill of Materials (BOM) & Hardware Components

Bill of Materials for DHT11 Temperature & Humidity Climate Monitor
ComponentSpecifications & AlternativeQtyApprox Cost
Arduino Uno R3ATmega328P @ 16MHz1$8.00
DHT11 Temperature & Humidity Module0–50°C (±2°C), 20–90% RH (±5%)1$2.00
10kΩ Pull-Up ResistorRequired only for bare 4-pin blue DHT11 sensor1$0.05
Breadboard & Jumper Wires3× Male-to-Female or Male-to-Male leads1$2.00

Electrical & System Architecture

DHT11 VCC connects to Uno 5V, GND to Uno GND, and DATA to digital pin D4. Bare 4-pin DHT11 sensors require an external 10kΩ pull-up resistor between DATA and 5V.

Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for DHT11 Temperature & Humidity Climate Monitor.
Figure: Complete Arduino Uno R3 pin-to-pin wiring schematic for DHT11 Temperature & Humidity Climate Monitor.Wiring Schematic

Autonomous Behavior & Finite State Machine (FSM)

Deterministic Arduino loop handling DHT11 3-Pin Digital Temp & Humidity Module acquisition, filtering, and real-time output updates.

Figure: Firmware execution flow and state transitions for DHT11 Temperature & Humidity Climate Monitor.
Figure: Firmware execution flow and state transitions for DHT11 Temperature & Humidity Climate Monitor.Control Algorithm

Step-by-Step Physical Assembly & Wiring Tutorial

Follow each of the 5 sequential milestone stages with technical photos, wiring checks, and pre-flight tests.

1

Verify DHT11 Pinout Order (3-Pin vs 4-Pin)

Duration: 5 Mins

Check PCB silkscreen markings (+, S, - or VCC, DATA, GND) since breakout boards vary by manufacturer.

DHT11 Temperature & Humidity Climate Monitor hardware layout diagram
Stage 1: DHT11 3-Pin Digital Temp & Humidity Module hardware inspection & pinout overview.Stage 1 Diagram
Step Action Checklist:
  • Inspect the three pins on the DHT11 module: +, OUT/S, and -.
  • If using a bare 4-pin blue housing (grid facing you), pins left-to-right are VCC, DATA, NC, GND.
  • Install a 10kΩ pull-up resistor between VCC and DATA if using a bare 4-pin element.
Engineering & Tuning Tip: Reversing VCC and GND on a DHT11 heats the sensor rapidly—double-check silkscreen labels before applying USB power.
2

Wire DHT11 to Arduino Uno D4

Duration: 10 Mins

Connect power, ground, and signal lines cleanly using short jumper leads.

DHT11 Temperature & Humidity Climate Monitor breadboard wiring check diagram
Stage 2: Breadboard layout & Arduino Uno pin-to-pin wiring audit.Stage 2 Diagram
Step Action Checklist:
  • Connect DHT11 VCC (+) to Arduino Uno 5V.
  • Connect DHT11 GND (-) to Arduino Uno GND.
  • Connect DHT11 DATA (S) to Arduino Uno Digital Pin D4.
Engineering & Tuning Tip: Keep cable lengths under 1 meter when using 10kΩ pull-ups to preserve crisp digital pulse edges.
3

Install Required Arduino Library

Duration: 5 Mins

Add the Adafruit DHT Sensor Library and Adafruit Unified Sensor dependency via Library Manager.

DHT11 Temperature & Humidity Climate Monitor power rail protection diagram
Stage 3: Supply rail check (USB 5.0V Regulated Rail (≈2.5mA sampling)) and circuit protection verification.Stage 3 Diagram
Step Action Checklist:
  • Open Arduino IDE → Sketch → Include Library → Manage Libraries.
  • Search for "DHT sensor library" by Adafruit and install it with all dependencies.
  • Verify compilation succeeds before uploading.
Engineering & Tuning Tip: Always keep polling intervals at or above 2000ms—polling faster returns stale data or NaN errors.
4

Upload Climate Telemetry Firmware

Duration: 10 Mins

Flash the DHT11 climate monitor sketch and inspect live readings on the Serial Monitor.

DHT11 Temperature & Humidity Climate Monitor serial telemetry verification diagram
Stage 4: Firmware upload & 115200 baud Serial Monitor verification.Stage 4 Diagram
Step Action Checklist:
  • Flash the code below to the Arduino Uno.
  • Open Serial Monitor at 115200 baud.
  • Observe temperature (°C / °F), relative humidity (%), and Heat Index updating every 2 seconds.
Engineering & Tuning Tip: Wait 10–15 seconds after power-on for the resistive humidity element to equilibrate with room air.
5

Dynamic Response Bench Test

Duration: 10 Mins

Exhale gently near the blue sensing grille to verify rapid humidity and temperature climb.

DHT11 Temperature & Humidity Climate Monitor live operational logic diagram
Stage 5: Live operational logic flow & calibration verification.Stage 5 Diagram
Step Action Checklist:
  • Record baseline ambient room temperature and humidity.
  • Gently breathe across the sensor vents and watch %RH spike by 15–30%.
  • Confirm readings return cleanly toward ambient baseline within 60 seconds.
Engineering & Tuning Tip: Never submerge the DHT11 or expose it to direct condensation—moisture droplets ruin the sensing polymer.

Subsystem Benchtop Verification Scripts

Test each hardware subsystem independently before deploying the full autonomous firmware.

1Bench Diagnostic: DHT11 3-Pin Digital Temp & Humidity Module Hardware Check

Subsystem Diagnostic

Minimal standalone sketch to verify pin wiring and signal response for DHT11 3-Pin Digital Temp & Humidity Module before running the full project firmware.

Arduino IDE Diagnostic ScriptC++ / Arduino
// Diagnostic: Raw DHT11 Single-Wire Connection Test
#include <DHT.h>
DHT dht(4, DHT11);
void setup() {
  Serial.begin(115200);
  dht.begin();
}
void loop() {
  delay(2000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  if (isnan(h) || isnan(t)) Serial.println("ERR: Check DHT11 wiring!");
  else { Serial.print("RH: "); Serial.print(h); Serial.print("%  T: "); Serial.print(t); Serial.println("C"); }
}
Expected Output: RH: 48.00% T: 24.50C updating cleanly every 2 seconds.

Complete Production Firmware

Full working C++ source code with pin mappings, non-blocking timers, and FSM avoidance routines.

arduino_uno_dht11_climate_monitor.ino
arduino_uno_dht11_climate_monitor.inoArduino C++
/**
 * Project 3: DHT11 Digital Climate & Heat-Index Monitor
 * Board: Arduino Uno R3 | Pin: D4 (DHT11 DATA)
 * Library: Adafruit DHT sensor library
 */
#include <DHT.h>

const uint8_t DHT_PIN = 4;
const uint8_t DHT_TYPE = DHT11;
const unsigned long SAMPLE_MS = 2000;

DHT dht(DHT_PIN, DHT_TYPE);
unsigned long lastSample = 0;

void setup() {
  Serial.begin(115200);
  dht.begin();
  Serial.println(F("DHT11 Climate Monitor Started (2s sample interval)"));
}

void loop() {
  if (millis() - lastSample < SAMPLE_MS) return;
  lastSample = millis();

  float humidity = dht.readHumidity();
  float tempC = dht.readTemperature();

  if (isnan(humidity) || isnan(tempC)) {
    Serial.println(F("[WARN] DHT11 read timeout - verify D4 & pull-up resistor."));
    return;
  }

  float tempF = dht.readTemperature(true);
  float heatIndexC = dht.computeHeatIndex(tempC, humidity, false);

  Serial.print(F("Humidity: ")); Serial.print(humidity, 1); Serial.print(F("% | "));
  Serial.print(F("Temp: ")); Serial.print(tempC, 1); Serial.print(F("C ("));
  Serial.print(tempF, 1); Serial.print(F("F) | Heat Index: "));
  Serial.print(heatIndexC, 1); Serial.println(F("C"));
}

Firmware Architecture Explanation:

  • Enforces a strict 2000ms non-blocking sampling cadence matching the DHT11 hardware conversion spec.
  • Guards against bus noise using isnan() before calculating Heat Index or transmitting telemetry.
  • Outputs both Celsius and Fahrenheit alongside perceived Heat Index.

Operational Verification & Pin State Matrix

1Double-check all 3 Arduino Uno pin connections against the wiring schematic before plugging in USB.
2Upload the Bench Diagnostic sketch first and confirm Serial Monitor at 115200 baud matches: RH: 48.00% T: 24.50C updating cleanly every 2 seconds.
3Upload the complete production sketch and verify every condition in the operational truth table below.

Input Signal vs. System Output Truth Table:

Operational truth table for DHT11 Temperature & Humidity Climate Monitor
Input / StatePin / SignalDetected ConditionExpected Output
20–60% RH18–27°CComfortable Indoor BandStatus: NOMINAL
> 75% RH> 30°CHigh Heat/Humidity StressStatus: VENTILATE ALERT
NaNNaNBus Timeout / Bad WiringEmit Diagnostic Warning

Engineering Troubleshooting Matrix

Engineering troubleshooting matrix for DHT11 Temperature & Humidity Climate Monitor
ProblemLikely CauseDiagnostic CheckEngineering Solution
Serial outputs NaN or read timeout continuouslyDATA connected to wrong pin or missing 10kΩ pull-up on bare 4-pin sensorVerify D4 continuity and check 5V at sensor VCCMatch DHT_PIN to wiring and add a 10kΩ pull-up between DATA and 5V.
Sensor feels warm and reports inflated temperaturesVCC and GND pins reversedUnplug immediately and inspect silkscreen markingsCorrect polarity; replace sensor if internally damaged.
Readings freeze after first measurementPolling interval shorter than 2 secondsInspect SAMPLE_MS constant in loop()Keep polling interval at 2000ms or higher.

Engineering Challenges & Upgrades

Take your build to the next level with these progressive engineering upgrades:

Level 1High-Humidity LED Warning

Add a red LED on D8 that illuminates automatically whenever relative humidity exceeds 70%.

Level 2Mini Weather Station with OLED

Combine with Project 4 (SSD1306 OLED) to render live temperature, humidity, and a comfort bar graph on screen.

Level 3Min/Max Session Tracker

Track and display the highest and lowest temperature recorded since Arduino boot.