This wiki article covers the KY-015 / DHT11 combination temperature and humidity sensor. Included are wiring diagrams, code examples, pinouts, and technical data. This sensor is commonly used in weather-station projects and for keeping tabs on internal device environmentals in larger projects.
Content
- Sensor/Module Image Gallery
- Description and Technical Data
- Device Pinout
- Projects that use this Sensor/Module
- Code Examples
- Code example for Arduino
- Code example for
Raspberry Pi

Description and Technical Data
The KY-015 / DHT11 temperature and humidity sensor module comprises a DHT11 digital humidity and temperature sensor with an integrated 1k ohm resistor. The onboard DHT11 uses an internal capacitive humidity sensor and thermistor to determine environment conditions, and digital I/O integrated circuit for creating the serialized digital output.
Due to its small size, the combination sensor is great for many projects, however it does come with one fairly serious drawback for use in some applications. It offers a sampling rate of a painfully slow 2 seconds. Applications that need more timely measurements should use a separate thermistor that can be sampled on a faster refresh interval.
Tech Specs for the KY-015 / DHT11 temperature and humidity sensor:
- Operating Voltage: 3.3V to 5V
- Current Consumption: 1.5mA
- Temperature Measurement Range: 32ºF to 122ºF( 0ºC to 50ºC)
- Temperature Measurement Accuracy: ±2ºC
- Temperature Measurement Resolution: 1ºC
- Humidity Measurement Range: 20% to 90% RH
- Humidity Measurement Resolution: ±5% RH
- Digital Out Signal Transmission Range:
- Dimensions: .75in X 1.77in (2cm x 4.5cm)
Our Projects that Use this Sensor
The following Geek Pub projects use the KY-015 / DHT sensor module:
Code Examples
You’ll find below code examples of using the KY-015 / DHT11 combination temperature and humidity sensor with both the Arduino and the
KY-015 / DHT11 Temperature and Humidity Sensor Code Example for Arduino
The following code example is for the Arduino. This code will read the current temperature and print the values out on the serial console every 3 seconds.
Arduino Wiring:
- KY-015 / DHT11 Sensor GND to Arduino GND
- KY-015 / DHT11 Sensor Vcc+ to Arduino +5V
- KY-015 / DHT11 Sensor Signal to Arduino PIN 2
#include "DHT.h" #define DHTPIN 2 // we're using pin 2 #define DHTTYPE DHT11 // we're using the DHT11 // define our DHT object using the pin and type from above DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); void loop() { // create a float and read the temperature sensor float myTemperature = dht.readTemperature(true); // print the temperature on the screen in Celsius Serial.print(myTemperature); Serial.print((char)223); // degree symbol Serial.println("C"); delay(3000); // wait 3 seconds before updating again }
KY-015 / DHT11 Temperature and Humidity Sensor Code Example for Raspberry Pi
The following code example is for the
Raspberry Pi Wiring:
- KY-015 / DHT11 Sensor GND to Raspbery Pi GND
- KY-015 / DHT11 Sensor Vcc+ to
Raspberry Pi PIN 2 - KY-015 / DHT11 Sensor Signal to
Raspberry Pi PIN 33 (GPIO 23)
import RPi.GPIO as GPIO import Adafruit_DHT import time # Adafruit_DHT.DHT22, or Adafruit_DHT.AM2302. DHTSensor = Adafruit_DHT.DHT11 # The pin which is connected with the sensor will be declared here GPIO_Pin = 23 while True: humid, temper = Adafruit_DHT.read_retry(DHTSensor, GPIO_Pin) print("Temperature: " + temper + "\n") time.sleep(3)
We hope this wiki article has been helpful to you. Please leave a comment below if you have any questions or comments, as we try to keep these articles constantly up to date.