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 which i used on the project:-
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.
#define dht_apin A1
DHT dht(dht_apin, DHT11);
lcd.print(” DHT 11 Testing “);
lcd.print(” over arduino “);
float temp, hum;
lcd.print(“Temp : “);
lcd.print(“Humi : “);
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…