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
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
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) |
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 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)
#!/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 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)