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.