

The DHT11 Temperature & Humidity Sensor (Manufacturer: Duinotech, Part ID: XC4520) is a digital sensor designed to measure temperature and humidity with high accuracy. It is widely used in environmental monitoring and control applications due to its simplicity, reliability, and low cost. The DHT11 outputs calibrated digital signals, making it easy to integrate into microcontroller-based systems.








| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5.5V |
| Operating Current | 0.3mA (measuring), 60µA (idle) |
| 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 |
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | VCC | Power supply pin (3.3V to 5.5V) |
| 2 | DATA | Digital data output pin for temperature and humidity readings |
| 3 | NC | Not connected (leave unconnected) |
| 4 | GND | Ground pin |
Below is an example of how to use the DHT11 sensor with an Arduino UNO. This code uses the popular DHT library.
#include <DHT.h>
// Define the DHT11 pin and type
#define DHTPIN 2 // Pin connected to the DATA pin of DHT11
#define DHTTYPE DHT11 // Specify the sensor type (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 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");
}
DHT library from the Arduino Library Manager before uploading the code.No Data Output:
Invalid Readings (e.g., NaN):
Inconsistent Readings:
Q1: Can I use the DHT11 with a 3.3V microcontroller?
A1: Yes, the DHT11 operates within a voltage range of 3.3V to 5.5V.
Q2: What is the maximum cable length for the DHT11?
A2: The recommended maximum cable length is 20 meters, but shorter lengths are preferred for better signal integrity.
Q3: How do I know if my DHT11 is faulty?
A3: If the sensor consistently outputs invalid readings (e.g., NaN) despite correct wiring and code, it may be damaged and require replacement.