The KY-015 DHT11 is a sensor module designed to measure temperature and humidity. It provides a digital output, making it easy to interface with microcontrollers such as the Arduino UNO. This sensor is widely used in applications such as weather stations, environmental monitoring, and home automation systems due to its reliability and ease of use.
Parameter | Value |
---|---|
Operating Voltage | 3.3V to 5.5V |
Temperature Range | 0°C to 50°C |
Humidity Range | 20% to 90% RH |
Temperature Accuracy | ±2°C |
Humidity Accuracy | ±5% RH |
Signal Output | Digital |
Response Time | 1 second |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5.5V) |
2 | Data | Digital signal output |
3 | NC | Not connected |
4 | GND | Ground |
#include <DHT.h>
#define DHTPIN 2 // Pin where the data pin of the DHT11 is connected
#define DHTTYPE DHT11 // Define the type of sensor used
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(2000); // Wait a few seconds between measurements
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" *C");
}
By following this documentation, users can effectively integrate the KY-015 DHT11 Temperature-Humidity Sensor Module into their projects, ensuring accurate and reliable measurements.