The KY-005 is a digital temperature and humidity sensor module manufactured by Arduino, with the part ID CINCO. It integrates the DHT11 sensor to provide accurate measurements of temperature and humidity. This module is widely used in environmental monitoring, home automation, weather stations, and other applications requiring reliable climate data.
The KY-005 is compact, easy to use, and compatible with microcontrollers like the Arduino UNO, making it an excellent choice for both beginners and experienced developers.
The KY-005 module has three pins, as detailed in the table below:
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5.5V) |
2 | DATA | Digital signal output |
3 | GND | Ground connection |
Connect the Pins:
Add a Pull-Up Resistor:
Upload the Code:
Below is an example code to read temperature and humidity data from the KY-005 module using the DHT library:
// Include the DHT library for sensor communication
#include <DHT.h>
// Define the pin connected to the DATA pin of the KY-005
#define DHTPIN 2
// Define the sensor type (DHT11)
#define DHTTYPE DHT11
// Initialize the DHT sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Start the serial communication for debugging
Serial.begin(9600);
Serial.println("KY-005 Temperature and Humidity Sensor Test");
// Initialize the DHT sensor
dht.begin();
}
void loop() {
// Wait a few seconds between measurements
delay(2000);
// Read the humidity value
float humidity = dht.readHumidity();
// Read the temperature value in Celsius
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 KY-005 be used with a 3.3V microcontroller?
A: Yes, the KY-005 operates within a voltage range of 3.3V to 5.5V, making it compatible with 3.3V microcontrollers.
Q: How often can I take readings from the KY-005?
A: The KY-005 has a sampling rate of 1 Hz, meaning it can provide one reading per second.
Q: Can I extend the cable length of the KY-005?
A: Yes, but keep the cable length as short as possible to avoid signal degradation. If longer cables are necessary, use shielded cables and ensure proper grounding.
Q: Is the KY-005 suitable for outdoor use?
A: The KY-005 is not waterproof and should be protected from direct exposure to rain or extreme environmental conditions. Use a protective enclosure if deploying outdoors.