Reference
DHT11
Basic temperature and humidity.
- Connects over
- GPIO pins
- Made by
- Aosong
- Datasheet
- mouser.com
Use it
hardware {
device dht: DHT11(pin: 16)
}
every 1s {
let value: float = dht.humidity()
log("dht", "humidity={value}")
}
The DHT11 is wired to ordinary GPIOs: give each of its pins (pin) as a named argument. The compiler checks every pin can do its job.
Methods
-
dht.humidity() -> float
Humidity %
-
dht.temperature() -> float
Temperature in °C
Wiring
| Pin | Connect to |
|---|---|
VCC | 3.3V or 5V |
DATA | Pull-up 4.7kΩ–10kΩ to VCC |
NC | Not connected on 3-pin modules; tie to GND on bare-chip 4-pin |
GND | Ground |
Specifications
- Current
- 0.3 mA measuring, 60 μA standby
- Humidity
- 20 – 80% RH ±5%
- Sample rate
- Once per second (max)
- Temp
- 0°C to +50°C ±2°C
- Voltage
- 3.3V – 5.5V
Tips
- DHT11 is the cheap variant — wide tolerance, integer resolution.
- Single-wire protocol is timing-critical; can be unreliable on FreeRTOS without disabling interrupts during read.
- If you need accuracy, use DHT22 instead.
Alternatives worth knowing:
- DHT22: Same sensor family, ±0.5°C / ±2% RH — usually worth the small price difference.
- AHT20: I²C, smaller, more accurate, cheaper — recommended for new designs.