Documentation

DHT11 Digital Temperature and Humidity Sensor Module with Cable
Documentation / DHT11 Digital Temperature and Humidity Sensor Module with Cable

DHT11 Digital Temperature and Humidity Sensor Module with Cable

Overview

The DHT11 is the entry-level digital temperature and humidity sensor — the one you almost certainly used in your first Arduino weather project. It combines a capacitive humidity sensor and a thermistor in a single 4-pin housing, then exposes a single-wire digital interface. No I2C, no SPI, no analog reading — just one GPIO and a pull-up resistor.

This pre-mounted module ships on a small black PCB with a 10kΩ pull-up resistor and decoupling capacitor already installed. Three solder-tinned pins (VCC, DATA, GND) make it breadboard-ready. Hook it up to any 3.3V or 5V GPIO, install the DHT library, and you're reading temperature and humidity in two lines of code.

It's a budget-class sensor — ±2°C temperature accuracy and ±5% RH humidity accuracy — but for indoor monitoring, plant watering reminders, greenhouse loops, and beginner Arduino projects, it's plenty. For more accuracy, step up to the DHT22 or BME280.

At a Glance

Temperature Range
0 to 50°C
Humidity Range
20 - 90% RH
Operating Voltage
3.3V - 5V
Interface
Single-wire digital
Pin Count
3 pins
Sample Rate
1 Hz max

Specifications

Parameter Value
Sensor Type DHT11 (capacitive humidity + thermistor)
Operating Voltage 3.3V - 5V DC
Operating Current 0.3 mA (measuring), 60 µA (idle)
Temperature Range 0°C to 50°C
Temperature Accuracy ±2°C
Temperature Resolution 1°C
Humidity Range 20 - 90% RH
Humidity Accuracy ±5% RH
Humidity Resolution 1% RH
Sample Rate 1 Hz maximum (one reading per second)
Communication Single-wire digital protocol
Pin Count 3 (VCC, DATA, GND)
Pull-up Resistor 10 kΩ on-board
Dimensions ~36 × 16 mm

Pinout Diagram

DHT11 digital temperature and humidity sensor module pinout diagram showing the three labeled pins: VCC (positive power), DATA (single-wire digital signal I/O), and GND (ground), with the blue plastic DHT11 sensor housing on the right

Wiring Guide

Arduino Wiring

Three wires — power, ground, and data. The 10kΩ pull-up is already on the module, so you don't need to add one.

DHT11 Pin Arduino Pin
VCC (+) 5V
DATA (I/O) Digital 2 (any GPIO works)
GND GND

ESP32 Wiring

The DHT11 works fine at 3.3V. Pick any free GPIO for the data line.

DHT11 Pin ESP32 Pin
VCC (+) 3.3V
DATA (I/O) GPIO 4
GND GND

Raspberry Pi Wiring

The DHT11's single-wire protocol is timing-sensitive — the Pi's Linux scheduler can interfere with reads. The Adafruit_DHT library handles this with retries.

DHT11 Pin Raspberry Pi Pin
VCC (+) Pin 1 (3.3V)
DATA (I/O) BCM 4 (Pin 7)
GND Pin 6 (GND)
Tip: If reads occasionally fail, that's normal for DHT11 on Linux — wrap the read in a try/except and retry. The library will handle most failures automatically.

Raspberry Pi Pico Wiring

The Pico is 3.3V and has plenty of GPIO. Any free pin works for DATA.

DHT11 Pin Pico Pin
VCC (+) 3V3 (Pin 36)
DATA (I/O) GP15
GND GND

Code Examples

Arduino — Simple Read

dht11_arduino.ino
// DHT11 - Arduino Example
// Library: DHT sensor library by Adafruit (Library Manager)

#include <DHT.h>

#define DHTPIN  2          // Digital pin 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
  delay(2000);   // DHT11 needs 1+ second between reads

  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT11!");
    return;
  }

  Serial.print("Humidity: "); Serial.print(h); Serial.print("%  ");
  Serial.print("Temp: ");     Serial.print(t); Serial.println(" C");
}

Raspberry Pi (Python)

dht11_rpi.py
#!/usr/bin/env python3
# DHT11 - Raspberry Pi Python Example
# Install: sudo pip3 install adafruit-circuitpython-dht
# Also need: sudo apt install libgpiod2

import time
import board
import adafruit_dht

dht = adafruit_dht.DHT11(board.D4)

while True:
    try:
        t = dht.temperature
        h = dht.humidity
        print(f"Temp: {t} C  Humidity: {h}%")
    except RuntimeError as e:
        print(f"Read error: {e}")
    time.sleep(2)

Raspberry Pi Pico (MicroPython)

dht11_pico.py
# DHT11 - Pico MicroPython
# Built-in dht module — no library install needed.

from machine import Pin
import dht
import time

sensor = dht.DHT11(Pin(15))

while True:
    try:
        sensor.measure()
        t = sensor.temperature()
        h = sensor.humidity()
        print("Temp: {} C  Humidity: {}%".format(t, h))
    except OSError as e:
        print("Read error:", e)
    time.sleep(2)

Frequently Asked Questions

Why is the DHT11 only 1 Hz?
The capacitive humidity sensor needs about a second to respond to a measurement request, so the chip enforces a minimum 1-second gap between reads. Calling read() faster will simply return the previous value or fail. For real-time logging, sample once per second and average over time.
My readings show NaN or fail. Why?
DHT11's single-wire protocol is timing-sensitive. Common causes: (1) reading too fast — wait at least 2 seconds between reads. (2) Long wires — keep the data line under 30 cm. (3) Missing pull-up resistor — make sure the on-board 10k pull-up is intact (it should be). (4) Bad power — add a 100 nF decoupling capacitor across VCC and GND.
DHT11 vs DHT22 — which should I get?
DHT22 is the upgraded version: ±0.5°C temperature accuracy (vs ±2°C), ±2-5% humidity accuracy (vs ±5%), -40 to 80°C range (vs 0 to 50°C), and 0.5 Hz max sample rate. The wiring is identical. If accuracy or wider temperature range matters, get the DHT22. The DHT11 is fine for indoor air monitoring at moderate temperatures.
Can I leave it outside?
The DHT11 is rated 0-50°C, so it can survive moderate outdoor temperatures. Humidity can damage it long-term — protect it with a vented enclosure or a small piece of sintered-metal cap to keep liquid water out while letting air through. For long-term outdoor use, the BME280 is better protected and more accurate.
What library should I use?
Arduino: Adafruit's DHT sensor library (most widely supported) or DHTesp (better for ESP boards). Raspberry Pi: adafruit-circuitpython-dht. MicroPython: built-in dht module. All are free.
Why does my reading drift over time?
DHT11 humidity sensors degrade slowly when exposed to high humidity (over 80% for hours) or air pollution. Drift of 1-2% RH per year is typical. To recover, store the sensor in a desiccated environment for a day, then re-calibrate against a known reference.
Can I use one DHT11 with multiple Arduinos?
Not at the same time — the single-wire protocol is master-slave with one master. If you need multiple readers, have one Arduino read the DHT11 and forward data to others over I2C, UART, or wireless.