DHT11 Temperature and Humidity Sensor Module

DHT11 Temperature & Humidity Sensor
Basic Environmental Sensing with Status LED for Arduino Projects
Introduction
The DHT11 is a basic, low-cost digital temperature and humidity sensor with a built-in status LED. It provides adequate accuracy for most hobbyist projects and includes visual feedback through its indicator LED.
Key Features
Status LED
Built-in indicator for power/activity
Low Cost
Affordable solution for basic projects
Low Power
3-5V operation with minimal current draw
Plug & Play
Pre-calibrated digital output
Technical Specifications
Temperature Range | 0°C to 50°C (±2°C accuracy) |
---|---|
Humidity Range | 20-90% RH (±5% accuracy) |
LED Indicator | Red power/activity light |
Sampling Rate | 1Hz (1 reading per second) |
Operating Voltage | 3.3V – 5.5V DC |
Dimensions | 23mm × 12mm × 5mm |
Pin Configuration
Pin | Function | Connection |
---|---|---|
1 | VCC | 3.3V-5V (Red LED connected here) |
2 | DATA | Digital Pin (with pull-up resistor) |
3 | NC | Not Connected |
4 | GND | Ground |
LED Behavior: The red LED will light when powered and blink during data transmission
Wiring with Arduino
1 2 3 4 |
// Basic Connections: // VCC → 5V (LED will light up) // DATA → D2 (with 4.7KΩ pull-up to VCC) // GND → GND |
Tip: The LED provides visual confirmation of power and data transmission activity
Library Setup
- Install the DHT sensor library by Adafruit
- Include the library in your sketch:
1#include <DHT.h> - Initialize the sensor (note DHT11 type):
1 2 3 4 5 6 7 8 9 |
#define DHTPIN 2 // Digital pin #define DHTTYPE DHT11 // DHT 11 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); dht.begin(); } |
Basic Example with LED Monitoring
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#include <DHT.h> #define DHTPIN 2 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); dht.begin(); pinMode(LED_BUILTIN, OUTPUT); // Arduino's onboard LED } void loop() { // Blink Arduino LED when reading sensor digitalWrite(LED_BUILTIN, HIGH); float h = dht.readHumidity(); float t = dht.readTemperature(); digitalWrite(LED_BUILTIN, LOW); if (isnan(h) || isnan(t)) { Serial.println("Sensor error!"); delay(500); // Rapid blink on error digitalWrite(LED_BUILTIN, HIGH); delay(500); return; } Serial.print("Humidity: "); Serial.print(h); Serial.print("%\tTemperature: "); Serial.print(t); Serial.println("°C"); delay(2000); // Match DHT11's 1Hz sampling rate } |
LED Status Guide
LED State | Meaning |
---|---|
Steady On | Power connected properly |
Brief Flicker | Data transmission occurring |
Off | No power or wiring issue |
Irregular Blinking | Communication problems |
Troubleshooting
LED Not Lighting
- Check VCC and GND connections
- Verify power supply voltage (3.3V-5V)
- Test with different power source
LED On But No Data
- Confirm DATA pin connection
- Add/check 4.7KΩ pull-up resistor
- Try different digital pin
Inconsistent Readings
- Ensure 2-second delay between readings
- Keep sensor away from heat sources
- Check for condensation on sensor