

The DHT11 is a digital temperature and humidity sensor manufactured by Temperature, Humidity with the part ID DHT11. It is designed to provide accurate readings of environmental conditions, including temperature and relative humidity. The sensor features a single-wire digital interface, making it simple to integrate with microcontrollers and other digital systems. Its compact size and low power consumption make it ideal for a wide range of applications.








The DHT11 sensor is a reliable and cost-effective solution for temperature and humidity measurement. Below are its key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5.5V |
| Temperature Range | 0°C to 50°C |
| Temperature Accuracy | ±2°C |
| Humidity Range | 20% to 90% RH (Relative Humidity) |
| Humidity Accuracy | ±5% RH |
| Sampling Rate | 1 Hz (1 reading per second) |
| Interface | Single-wire digital |
| Dimensions | 15.5mm x 12mm x 5.5mm |
The DHT11 sensor has four pins, but only three are typically used in most applications. Below is the pin configuration:
| Pin Number | Name | Description |
|---|---|---|
| 1 | VCC | Power supply (3.3V to 5.5V) |
| 2 | DATA | Digital data output (connect to microcontroller) |
| 3 | NC (Not Connected) | No connection (leave unconnected) |
| 4 | GND | Ground (0V reference) |
The DHT11 sensor is straightforward to use in a circuit. Follow the steps below to integrate it into your project:
Below is an example of how to use the DHT11 sensor with an Arduino UNO. This code uses the popular DHT library, which simplifies communication with the sensor.
#include <DHT.h>
// Define the pin connected to the DHT11 sensor
#define DHTPIN 2 // Digital pin 2
// Define the type of DHT sensor
#define DHTTYPE DHT11
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Start serial communication
Serial.println("DHT11 Sensor Initialization");
dht.begin(); // Initialize the DHT sensor
}
void loop() {
delay(2000); // Wait 2 seconds between readings
// Read temperature and humidity
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if the readings are valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print the readings to the Serial Monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
}
No Data or Incorrect Readings
Sensor Not Responding
Frequent Communication Errors
Inaccurate Readings
Q: Can the DHT11 measure negative temperatures?
A: No, the DHT11 can only measure temperatures in the range of 0°C to 50°C.
Q: Can I use the DHT11 with a 3.3V microcontroller?
A: Yes, the DHT11 operates with a voltage range of 3.3V to 5.5V, making it compatible with 3.3V systems.
Q: How does the DHT11 compare to the DHT22?
A: The DHT22 offers a wider temperature and humidity range with higher accuracy but is more expensive. The DHT11 is a cost-effective option for basic applications.
Q: What is the maximum cable length for the DHT11?
A: The recommended maximum cable length is approximately 20 meters, but shorter cables are preferred for better signal integrity.