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

http://www.micro4you.com/files/sensor/DHT11.pdf

Hardware Connections

DTH11 To Arduino

Vcc --- 5v

GND --- GND

Data Pin --- 3rd Pin of Arduino

Step 1: How to Include DHT Library

Please download the DHT library from the below link.

https://drive.google.com/file/d/0B1paTI5fzcHodno5azFOSVVDT0E/view?usp=sharing

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

Program

#include<dht.h>
dht DHT;

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

#define DHT11_PIN 3

void setup() {

Serial.begin(9600);

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);

delay(2000);

}

Results are shown in above screen shots..

Thanks,

TechPonder.

5 People Made This Project!

Recommendations

  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • Plastics Contest

    Plastics Contest
  • Optics Contest

    Optics Contest

17 Discussions

0
None
gorav mengji

1 year ago

hi

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

board at com1 is not avaliable...

1 reply
0
None
TechPondergorav mengji

Reply 1 year ago

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.

0
None
PoojaS41

1 year ago

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

2 replies
0
None
JaronF2PoojaS41

Reply 4 months ago

Did you maybe also fry your sensor like did?

0
None
KwadwoA4PoojaS41

Reply 9 months ago

I had the same problem till I increased the delay.
delay(2000) seems ideal, but you can increase it in case your board needs more time to process the data

0
None
JaronF2

4 months ago

Uhhm. I don't think I will try the project again. Good that I smellled how burned it suddenly smelled because your schematics without resistor fried my sensor.

That is no curvature from the camera. That is actually how close I came to burning my house down.

WIN_20180712_12_35_49_Pro.jpg
0
None
SravanP3

Question 9 months ago

FOR ME COMPILING IS DONE BUT IN SERIAL MONITOR OUTPUT IS NOT SHOWING .PLZ REPLAY FAST.THANKING YOU

0
None
AnujJ9

10 months ago

Greetings!!

You can also check it out here, https://github.com/ianuj03/DHT11

0
None
danielsan01

10 months ago

how can I display time and date without using anything else, but the internal PC clock. and how could I save the data and open it on excel?

0
None
danielsan01

10 months ago

it worked nice... thanks

0
None
mugendi__EnaborO

Reply 1 year ago

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

0
None
PoojaS41mugendi__

Reply 1 year ago

i didn't used resistor, still getting zero.

suggest something else

0
None
kavya1697

1 year ago

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

0
None
Ajioz

1 year ago

Hi,

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?

0
None
MichaelL350

1 year ago

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.