Thursday, 10 November 2016

How to use Humidity and Temperature (DHT11) Sensor to Arduino and including DHT11 Library.

WHAT IS DHT11 SENSOR?

The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing to grab data.

THIS PROJECT FOLLOWING HARDWARE COMPONENTS:-

1)  DTH11 Humidity and Temperature Sensor
2)  Arduino UNO
3) JUMPER Wires

NOTE : YOU WILL ALSO NEET TO DOWNLOAD DHT LIBRARY AND IMPORT IN YOUR PROGRAM.

DOWNLOAD FROM   HERE


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.

CODE :

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

 

 Program and Results

Picture of Program and Results
humidity and temparature values.jpg
 
FEEL FREE TO POST ANY COMMENTS OR DOUBTS BELOW AND SUBSCRIBE FOR MORE TUTORIALS

No comments:

Post a Comment