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.

Comments

author
gorav mengji (author)2017-03-13

hi

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

board at com1 is not avaliable...

author
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.

author
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

author
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.?

dht.PNG
author
EnaborO (author)2017-07-17

Hello

I keep getting zero for both readings.

problemdht11.PNG
author
Ajioz (author)2017-01-11

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?

author
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.

author
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.

IMG_4922.JPG
author
F3rnAS made it! (author)2016-02-03

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

2016-02-03 20.50.47.jpg2016-02-03 20.50.57.jpg