The DHT11 is a digital temperature and humidity sensor manufactured by Keystudio (Part ID: KS0034). It provides accurate readings of temperature in Celsius and relative humidity in percentage. The DHT11 is widely used in applications such as weather stations, HVAC systems, and other projects requiring environmental monitoring. Its compact size, low power consumption, and ease of use make it a popular choice for hobbyists and professionals alike.
The DHT11 sensor is designed for simplicity and reliability. Below are its key technical details:
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5.5V |
Operating Current | 0.3mA (measuring), 60µA (standby) |
Temperature Range | 0°C to 50°C |
Temperature Accuracy | ±2°C |
Humidity Range | 20% to 90% RH |
Humidity Accuracy | ±5% RH |
Sampling Period | 1 second |
Communication Protocol | Single-wire digital signal |
The DHT11 sensor typically has 3 or 4 pins, depending on the module version. Below is the pinout description:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5.5V) |
2 | DATA | Digital data output (connect to microcontroller) |
3 | GND | Ground |
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5.5V) |
2 | DATA | Digital data output (connect to microcontroller) |
3 | NC | Not connected (leave unconnected) |
4 | GND | Ground |
The DHT11 sensor is easy to integrate into circuits and works seamlessly with microcontrollers like the Arduino UNO. Below are the steps to use the DHT11 in a circuit:
Below is an example Arduino sketch to read temperature and humidity data from the DHT11 sensor:
// Include the DHT library for communication with the sensor
#include <DHT.h>
// Define the pin where the DHT11 DATA pin is connected
#define DHTPIN 2
// Define the type of DHT sensor (DHT11 in this case)
#define DHTTYPE DHT11
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Start the serial communication for debugging
Serial.begin(9600);
Serial.println("DHT11 Sensor Initialization");
// Start the DHT sensor
dht.begin();
}
void loop() {
// Wait a second between readings (DHT11 has a 1-second sampling period)
delay(1000);
// Read temperature in Celsius
float temperature = dht.readTemperature();
// Read humidity in percentage
float humidity = dht.readHumidity();
// Check if the readings are valid
if (isnan(temperature) || isnan(humidity)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print the temperature and humidity values to the Serial Monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
}
No Data Output or Incorrect Readings
"Failed to read from DHT sensor!" Error
Inconsistent Readings
Temperature or Humidity Out of Range
Can the DHT11 measure negative temperatures?
What is the maximum cable length for the DHT11?
Can I use the DHT11 with a 3.3V power supply?
How accurate is the DHT11 compared to other sensors?
By following this documentation, you can effectively integrate and troubleshoot the DHT11 sensor in your projects.