Introduction: Interface DHT11 Using Arduino
In this Instructables you will learn how to set up the DHT11 Humidity and Temperature sensor on your Arduino UNO. And learn about how the Humidity sensor works, and how to check output readings from the Serial monitor
Description:
The DHT11 detects water vapor by measuring the electrical resistance between two electrodes. The humidity sensing component is a moisture holding substrate with electrodes applied to the surface. When water vapor is absorbed by the substrate, ions are released by the substrate which increases the conductivity between the electrodes. The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes.
Step 1: Components Required
Here is the list of components required to get started with the Instructable,
Hardware Components:
- Arduino UNO Buy From Flipkart
- DHT11 Humidity and Temperature sensor Buy From Flipkart
- Breadboard (Optional)
- Jumper Wires
- USB Cable
Software Components:
Arduino IDE
Step 2: Wiring the Circuit
Wiring the DHT11 to the Arduino UNO is really easy.
The wiring connections are made as follows :
VCC pin of the DHT11 goes into +3v of the Arduino.
DATA pin of the DHT11 goes into Analog Pin A0 of the UNO.
GND Pin of the DHT11 goes into Ground Pin (GND) of the UNO.
Step 3: Programming the Arduino
Download the Zip file
Extract the DHT Library and code.
Code:
#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to Arduino dht DHT;
The Above lines are initialization for dht library
Defining data pin of dht
and creating instatnce as DHT
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot Serial.println("DHT11 Humidity & temperature Sensor\n\n"); delay(1000);//Wait before accessing Sensor }
Above lines are the setup code
Starts serial communication at 9600 baud rate
print the name of project with delay of 1 sec
void loop(){
DHT.read11(dht_apin); Serial.print("Current humidity = "); Serial.print(DHT.humidity); Serial.print("% "); Serial.print("temperature = "); Serial.print(DHT.temperature); Serial.println("C "); delay(5000);//Wait 5 seconds before accessing sensor again. }
It reads data from DHT11 repeatedly every 5 Sec
Step 4: Result
Open Serial Monitor
set the baud rate to 9600
See the result on Serial Monitor....
First of all, I would like to thank you for reading this guide ! I hope it helps you. If You have any queries I am always happy to help you..... Drop a Comment. Your feedback is valuable for me.