The DHT11 is a basic, low-cost digital temperature and humidity sensor that’s perfect for beginners and hobbyists. It’s widely used in weather stations, greenhouse monitors, and home automation systems.

In this guide, you’ll learn how to set up and use the DHT11 sensor with an Arduino Uno to read temperature and humidity data.

What is the DHT11 Sensor?

The DHT11 is a digital sensor that provides calibrated temperature and humidity readings. It has a sampling rate of 1Hz (one reading per second) and is capable of sensing:

  • Temperature Range: 0 to 50 °C with ±2°C accuracy
  • Humidity Range: 20 to 90% RH with ±5% accuracy

What You’ll Need

  • Arduino Uno R3
  • DHT11 Sensor Module
  • 10kΩ pull-up resistor (if using raw sensor)
  • Breadboard and jumper wires
  • Arduino IDE

Wiring the DHT11 Sensor

Typical DHT11 modules have three pins:

  • VCC → Arduino 5V
  • GND → Arduino GND
  • DATA → Arduino pin 2

If you’re using a DHT11 sensor without a PCB, connect a 10kΩ resistor between VCC and DATA as a pull-up resistor.

Installing the DHT Library

  • Open Arduino IDE
  • Go to Sketch > Include Library > Manage Libraries
  • Search for “DHT sensor library” by Adafruit and install it
  • Also install “Adafruit Unified Sensor” if prompted

Sample Code

#include “DHT.h”

#define DHTPIN 2 // Pin connected to DATA
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

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

void loop() {
delay(2000); // Wait a few seconds between readings

float temp = dht.readTemperature();
float humid = dht.readHumidity();

if (isnan(temp) || isnan(humid)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}

Serial.print(“Temperature: “);
Serial.print(temp);
Serial.print(” °C Humidity: “);
Serial.print(humid);
Serial.println(” %”);
}

Applications of DHT11

  • Indoor air quality monitoring
  • DIY weather stations
  • Smart thermostat systems
  • Humidity control for storage rooms

Conclusion

The DHT11 sensor is a beginner-friendly way to add environmental sensing capabilities to your projects. With a simple wiring setup and easy-to-use code, it’s a great component to learn with.

Grab your own DHT11 module and more Arduino-compatible sensors at Rdxlectronics.com and start building smart projects today!

Leave a comment

Your email address will not be published. Required fields are marked *