

The DHT11-2 is a digital temperature and humidity sensor designed to provide accurate and reliable readings of environmental conditions. It features a single-wire communication interface, making it simple to integrate with microcontrollers and other digital systems. The DHT11-2 is widely used in applications such as weather stations, HVAC systems, greenhouses, and other projects requiring temperature and humidity monitoring.
Key features of the DHT11-2 include:








The DHT11-2 sensor has the following technical specifications:
| 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 |
| Humidity Accuracy | ±5% RH |
| Communication Protocol | Single-wire (digital) |
| Sampling Period | 1 second (minimum) |
| Dimensions | 15mm x 12mm x 5mm |
The DHT11-2 has four pins, as described in the table below:
| 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 |
Below is an example of how to use the DHT11-2 with an Arduino UNO. This code requires the DHT library, which can be installed via the Arduino Library Manager.
#include <DHT.h>
// Define the pin connected to the DHT11-2 sensor
#define DHTPIN 2 // Connect DATA pin of DHT11-2 to digital pin 2
// Define the type of DHT sensor
#define DHTTYPE DHT11 // DHT11-2 is compatible with the DHT11 library
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
Serial.println("DHT11-2 Sensor Test");
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 Output:
Incorrect Readings:
"Failed to Read from DHT Sensor" Error:
Q: Can the DHT11-2 measure negative temperatures?
A: No, the DHT11-2 can only measure temperatures in the range of 0°C to 50°C.
Q: How long does the sensor take to provide a reading?
A: The DHT11-2 requires a minimum sampling period of 1 second between readings.
Q: Can I use the DHT11-2 with a 3.3V microcontroller?
A: Yes, the DHT11-2 operates within a voltage range of 3.3V to 5.5V, making it compatible with 3.3V systems.
Q: Is the DHT11-2 waterproof?
A: No, the DHT11-2 is not waterproof and should not be exposed to water or condensation.