Tutorial:Interface DHT11 with Arduino Uno

Hardware Connections

  1. Connect the DHT11 sensor to Arduino UNO as followingSoftware
  1. ​​​Open Arduino IDE and upload the following sketches into the Arduino IDE. 

#include <dht.h> //include dht11 library
#define DHT11_PIN 7 //Pin 7 is connected to pin OUT of DHT11
dht DHT;
void setup(){
delay(500); //Delay to let system boot
Serial.println("DHT11 Humidity & temperature Sensor\n");
delay(1000); //Wait before accessing Sensor
void loop()
DHT.read11(DHT11_PIN); //Read the signal from pin OUT of DHT11
Serial.print("Temp: ");
Serial.print (DHT.temperature); //show temperature
Serial.print ("C ");
Serial.print ("Humidity: ");
Serial.print (DHT.humidity); //show humidity
delay(2000); //delay 2s

  1. If there is an error because your Arduino IDE cannot detect the library of DHT11, you can go to Sketch >> Include Library >> Manage Library. 

  1. Wait until the library list is updated, search "DHT11" and install the DHT11 library. 
  2. Connect Arduino Uno to your PC with a USB cable, then upload the sketch
  3. Open the Serial Monitor, every two seconds Arduino Uno will send the temperature and humidity value every 2 seconds interval.