Introduction: How to Interface Humidity and Temperature (DHT11) Sensor to Arduino and Including DHT11 Library.

Picture of How to  Interface Humidity and  Temperature (DHT11) Sensor to Arduino and Including DHT11 Library.

DTH11 includes both Humidity and Temperature sensor.

Hardware Components required:-

1) DTH11 Humidity and Temperature Sensor

2) Arduino UNO

3)Connecting Wires

4) DTH library

You can get the sensor DTH11 Data Sheet from the below link

Hardware Connections

DTH11 To Arduino

Vcc --- 5v


Data Pin --- 3rd Pin of Arduino

Step 1: How to Include DHT Library

Picture of How to Include DHT Library

Please download the DHT library from the below link.

Go to Sketch--> Include Library --> Add Zip File

As shown in the above screen shot please browse the ZIP file and include the library after including the library.

Close the Arduino IDE and open it again then you will find the library included.

Step 2: Program and Results

Picture of Program and Results


dht DHT;

// if you require to change the pin number, Edit the pin with your arduino pin.

#define DHT11_PIN 3

void setup() {


Serial.println("welcome to TechPonder Humidity and temperature Detector"); }

void loop() { // READ DATA

int chk = DHT.read11(DHT11_PIN);

Serial.println(" Humidity " );

Serial.println(DHT.humidity, 1);

Serial.println(" Temparature ");

Serial.println(DHT.temperature, 1);



Results are shown in above screen shots..




gorav mengji (author)2017-03-13


i have a issue while running the program its giving me a error saying

board at com1 is not avaliable...

TechPonder (author)gorav mengji2017-03-13

In Arduino IDE. Go to Tools-> Port Select the COM port on which your Arduino is connected to the System. In order to check the COM port in Computer go to Control Panel->Hardware-> Device Manger-> Ports You will find the Exact COM Port. Please select the port and upload.

EnaborO (author)2017-07-17


I keep getting zero for both readings.

mugendi__ (author)EnaborO2017-09-05

I was having a similar problem some few minutes ago, and I just revisited how I had set-up my circuit. Unlike how they put it in Google pictures, try using the 5V without a a resistor.

Now it works perfectly fine

PoojaS41 (author)mugendi__2017-11-03

i didn't used resistor, still getting zero.

suggest something else

mugendi__ (author)EnaborO2017-09-05

Me too

PoojaS41 (author)2017-11-03

getting zero as output for both temperature and humidity..!! suggestions please.

kavya1697 (author)2017-07-29

Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Kavya\Desktop\sketch_jul27a\sketch_jul27a.ino:34:19: fatal error: dht11.h: No such file or directory

#include <dht11.h>


compilation terminated.

exit status 1

Error compiling.

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

i have downloaded the dht library

this is error message i get could u please help me correct them

M.R8 made it! (author)2017-07-26

thanks, but how can i combine two sketch.?

i want make "when the temp higher than 36, then some servo will tick once, then another servo will tick OK button.

can someone help me.?

Ajioz (author)2017-01-11


I Have issues with the Arduino recognizing the file dht.h. Was told no such file exist, meanwhile I have uploaded the zip file into the Arduino IDE, which showed in the file directory.

How do I solve this?

MichaelL350 (author)2017-01-10

Thanks for this. Built mine using a Duinotech XC-4432 sensor module from Jaycar. Downloaded the library - like the instructions, nice and easy to follow. Started it up, monitored the serial output. Got values of 1.0 and 1.0 for humidity and temp. Hhhmmm. Read you library, realised that read11 really is a 1 or 0 collection for humidity and temp (at least with the Duinotech module it is). Tried read22. Worked a charm.

SanL3 made it! (author)2016-10-12

works perfect, thank you , I have also got ESP8266 Wifi module, can you show me how can I broadcast from my arduino uno to raspberry pi which has another DHT11 hooked into monitoring room temperature.

F3rnAS made it! (author)2016-02-03

It is a project easy to make and very fun!!!

About This Instructable




More by TechPonder:how to interface LCD (16X2) to arduinoHow to Interface Ultrasonic Sensor (HCSR04) to arduino unoFire  detection  using Arduino and flame sensor
Add instructable to: