Description
DHT11 Temperature And Humidity Sensor Module with LED
The DHT11 Temperature and Humidity Sensor Module is an electronic device used to measure the temperature and humidity of the surrounding environment. It is popular in DIY electronics, especially for home automation and weather monitoring projects, due to its affordability and ease of use.
Technical Specifications:
-
Temperature Range: 0°C to 50°C with ±2°C accuracy.
-
Humidity Range: 20% to 90% RH with ±5% accuracy.
-
Operating Voltage: 3.3V to 5.5V.
-
Output: Digital signal (single-bus interface).
-
Sampling Rate: Once every second (1 Hz).
- Pin Configuration: Typically has 3 or 4 pins (VCC, GND, Data, and sometimes NC or an additional pin for support).
Pinouts:
Connection with Arduino:
Module |
Arduino UNO |
VCC |
5V |
Data |
Pin 9 |
GND |
GND |
Sample code:
#include <DHT.h>
#define DHTPIN 9 // Pin where the DHT11 is connected
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
if (isnan(temperature) || isnan(humidity)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
delay(1000);
}