🐹 Tutorial 30 - DHT11 Humidity

The DHT11 is a low-cost digital humidity and temperature sensor module that uses a thermistor and a capacitive humidity sensor to measure the surrounding air’s humidity and temperature. The module has a single-wire serial interface, making it easy to interface with microcontrollers such as the Raspberry Pi Pico.

The DHT11 has a range of 20-90% relative humidity with an accuracy of +/- 5% RH and a temperature range of 0-50°C with an accuracy of +/- 2°C. The module operates at 3.3V to 5V DC, consumes low power, and has a response time of less than 5 seconds.

The DHT11 Humidity Sensor is commonly used in various applications, including indoor climate control, weather stations, and greenhouse monitoring. With its low cost, ease of use, and compact size, it is a popular choice for hobbyists and professionals alike.

Overall, the DHT11 Humidity Sensor is a simple and effective way to measure the temperature and humidity of the surrounding air. Its low cost and ease of use make it an ideal choice for various applications where humidity and temperature monitoring is necessary.

Components Needed

ComponentQuantity
Raspberry Pi Pico W1
Micro USB Cable1
Breadboard1
WiresSeveral
Resistor1
DHT11 Humidity Sensor1

Fritzing Diagram

Code

from machine import Pin, I2C
import utime as time
from dht import DHT11

pin = Pin(16, Pin.OUT, Pin.PULL_DOWN)
sensor = DHT11(pin)

while True:
    sensor.measure()
    print("Temperature: {}, Humidity: {}".format(sensor.temperature, sensor.humidity))
    time.sleep(1)

Code Explanation