HOW TO SET UP THE DHT11 HUMIDITY SENSOR ON AN ARDUINO

Introduction:-

DHT11/22 is a temperature and humidity measuring sensor. This sensor is too perfect for DIY electronic projects for all kind of hobbyist. This sensor is suitable for applications like weather monitoring systems, Environmental control system, garden monitoring system.  In this article, i will show a step by step manner about the way to interface the dht11 sensor with arduino and the way to add libraries.

Download the DHT11 datasheet from here.

From the above image which i took from the specification, we can concluded that it can be measured only up to 50°C of temperature and the maximum of 90% of RH of the humidity.

 

 

Note:- 5K is pulled up from the data pins of the DHT11 sensor for better accuracy

 

Materials required:-

  1. Arduino uno
  2. 16×2 LCD
  3. LCD Breakout board
  4. DHT11 sensor
  5. jumper wire

Materials which i used on the project:-

Arduino uno

16×2 LCD

Breakout board

DHT11 Sensor

 

Circuit diagram:-

LCD connections:-

RS – D13

E – D12

D4 – 11

D5 – 10

D6 – 9

D7 – 8

DHT11 sensor is interfaced with A1 of the arduino. you can connect any of the pins which you have to mention on the arduino code.

Adding libraries on the Arduino IDE:-

Before working on the software coding, we need to add the respective libraries to the arduino IDE. We have to add two different libraries  on the arduino IDE. I have give the entire pictures to make easier for you. Follow my procedure which i given below. I also given the link below to download.

1. Google the dht 11 arduino library 

 

2. Open the adafruit based github web link to download the zip file

 

3. Add the zip file

 

 

4. Browse the corresponding zip file

 

5. Similarly you have to google the Adafruit sensor library

 

6.Download and add the zipfile

 

7. Library added conformation

 

8. Example codes appear on the examples

 

If you found the example codes on the example, view the DHT tester program for better understanding.

Basic Hardware construction:-

 LCD breakout board connection

VCC and GND connection for DHT11 Sensor

Data pin of DHT11 sensor connected to A1 of the arduino uno

 

NOTE:- i didn’t use 5K resistor across vcc and data pin of the sensor. But i recommended you to add the resistor for better accuracy.

Code:-

#include “DHT.h”
#define dht_apin A1
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
DHT dht(dht_apin, DHT11);

void setup()

{
lcd.begin(16, 2);
dht.begin();
lcd.print(” DHT 11 Testing “);
lcd.setCursor(0, 1);
lcd.print(” over arduino “);
delay(3000);
lcd.clear();
}

void loop()

{
float temp, hum;
temp=dht.readTemperature();
hum=dht.readHumidity();
lcd.setCursor(0,0);
lcd.print(“Temp : “);
lcd.print(temp);
lcd.setCursor(0,1);
lcd.print(“Humi : “);
lcd.print(hum);
}

 

Result and observation:-

Download the code on the arduino uno. If you found error during compiling the code, check weather you have add the correct library to the arduino IDE.

Now you can view the temperature and humidity values on the LCD display.

If you have any doubts, feel free to comment below… sharing your thoughts and comments will help us grow…

Leave a Reply

Your email address will not be published. Required fields are marked *