The DHT11 Sensor Module is a digital temperature and humidity sensor designed to provide accurate readings of environmental conditions. It features a calibrated digital signal output and uses a single-wire communication protocol, making it easy to interface with microcontrollers. The DHT11 is widely used in applications such as weather monitoring systems, home automation, and HVAC control.
The DHT11 Sensor Module is designed for low-cost, low-power applications. 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) |
The DHT11 Sensor Module typically has three or four pins. Below is the pinout for the module:
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 (or GND) | Not connected (on some modules) or Ground pin (connect to GND of the circuit) |
4 | GND | Ground pin (if present, connect to GND of the circuit) |
Note: Some DHT11 modules include a pull-up resistor on the DATA pin. If your module does not, you may need to add an external 10kΩ pull-up resistor between the DATA pin and VCC.
Below is an example of how to use the DHT11 Sensor Module with an Arduino UNO:
#include "DHT.h" // Include the DHT library
#define DHTPIN 2 // Pin connected to the DATA pin of the DHT11
#define DHTTYPE DHT11 // Define the sensor type (DHT11)
DHT dht(DHTPIN, DHTTYPE); // Initialize the DHT sensor
void setup() {
Serial.begin(9600); // Start the serial communication
dht.begin(); // Initialize the DHT sensor
Serial.println("DHT11 Sensor Initialized");
}
void loop() {
delay(2000); // Wait 2 seconds between readings
float temperature = dht.readTemperature(); // Read temperature in Celsius
float humidity = dht.readHumidity(); // Read humidity percentage
// Check if the readings are valid
if (isnan(temperature) || isnan(humidity)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Print the readings to the Serial Monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
}
Note: Ensure the DHT library is installed in your Arduino IDE before uploading the code.
No Data or Incorrect Readings
"Failed to read from DHT sensor!" Error
Inconsistent Readings
High Cable Length
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 outdoors?
A: The DHT11 is not designed for outdoor use. For outdoor applications, consider using a sensor with a wider operating range and better environmental protection, such as the DHT22.
Q: What is the difference between the DHT11 and DHT22?
A: The DHT22 offers a wider temperature and humidity range, higher accuracy, and faster response time compared to the DHT11, but it is more expensive.
Q: Do I need an external library to use the DHT11 with Arduino?
A: Yes, it is recommended to use the Adafruit DHT library for easier implementation and reliable performance.