

The DHT11 Temperature & Humidity Sensor (Manufacturer: Duinotech, Part ID: XC4520) is a low-cost, digital sensor designed to measure both temperature and humidity. It provides reliable and accurate readings, making it a popular choice for a wide range of applications. The DHT11 is easy to interface with microcontrollers and is widely used in projects such as weather monitoring, HVAC systems, and home automation.








The DHT11 sensor is designed for simplicity and efficiency. 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 Rate | 1 Hz (1 reading per second) |
| Communication Protocol | Single-wire digital signal |
| Dimensions | 15.5mm x 12mm x 5.5mm |
The DHT11 sensor has four pins, as shown in the table below. Note that some modules may have only three pins, with the fourth pin (NC) omitted.
| 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 (leave unconnected) |
| 4 | GND | Ground (0V reference) |
The DHT11 sensor is straightforward to use in a circuit. Below are the steps and best practices for integrating it into your project.
Below is an example of how to connect the DHT11 to an Arduino UNO:
The following code demonstrates how to read temperature and humidity data from the DHT11 sensor using an Arduino UNO. This example uses the popular DHT library.
// Include the DHT library
#include <DHT.h>
// Define the DHT sensor type and the pin it's connected to
#define DHTPIN 2 // DHT11 data pin connected to Arduino digital pin 2
#define DHTTYPE DHT11 // Specify the sensor type (DHT11)
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Start the 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 results 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
"Failed to Read from DHT Sensor" Error
DHT11) is specified in the code.Inconsistent or Fluctuating 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: What is the difference between the DHT11 and DHT22 sensors?
A: The DHT22 offers a wider temperature and humidity range, higher accuracy, and faster response times compared to the DHT11. However, it is more expensive.
Q: Can I use the DHT11 with a 3.3V microcontroller?
A: Yes, the DHT11 operates within a voltage range of 3.3V to 5.5V, making it compatible with 3.3V microcontrollers.
Q: How long is the cable length supported by the DHT11?
A: The DHT11 can support cable lengths of up to 20 meters, but longer cables may require a lower pull-up resistor value (e.g., 4.7kΩ) to maintain signal integrity.