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

67,251

52

30

Posted

Introduction: 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.

3 People Made This Project!

Recommendations

  • Space Challenge

    Space Challenge
  • Microcontroller Contest

    Microcontroller Contest
  • Spotless Contest

    Spotless Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

0

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

14 Comments

hi

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

board at com1 is not avaliable...

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.

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

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

Greetings!!

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

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?

Hello

I keep getting zero for both readings.

problemdht11.PNG

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

i didn't used resistor, still getting zero.

suggest something else