Hi, Hello Electronics Lovers welcome to this tutorial, in this tutorial I will show you how to Interface DHT11 a very popular temperature and humidity sensor with Arduino. Unlike LM35 this is a digital sensor which has only a single pin output and easily displayed humidity and temperature. We have our regular setup our 16×2 LCD and our DHT 11 sensor. DHT 11 sensor has four pins the third pin which is NC means not connected, the first pin goes to VCC mean 5 Volts the second pin is a digital output and the fourth pin is for ground.
We will make this circuit by using the Digital pin D7 of the Arduino Nano as an input pin, of course, you can use any available digital input-output pins also. Before move further so let’s see the documentation data sheet for DHT11, you people can easily check and read the datasheet of DHT 11 humidity and temperature sensor in google or an Arduino official website| Temperature and Humidity Sensor.
Library up-gradation in Arduino is very valuable for the case of interfacing new sensors or components with Arduino microcontroller. In this case, we will need the library of DHT 11 sensor, you can download library of this sensor from our website under the section of Arduino tab. Kindly, make sure that library is updated After extracting or copying DHT 11 library into Arduino library folder. The next step is to write the code for this project, further details of the project and code are available in below video.
*Arduino added simplicity and beauty to the embedded world.
Components Required:
- Arduino Nano ( You can use other boards such as Arduino Uno, Mega ….)
- DHT11 ( Temperature and Humidity Sensor)
- 16×2 LCD
- Resistor 220 Ohms
- Jumper wires
- Bread Board
LCD Pins Configuration :
- LCD Enable pin to digital pin 11
- LCD RS pin to digital pin 12
- LCD D4 pin to digital pin 5
- LCD D5 pin to digital pin 4
- LCD D6 pin to digital pin 3
- LCD D7 pin to digital pin 2
- LCD R/W pin to ground
- LCD VDD to 5V
- LCD VSS to Ground
- LCD Vee or Vo to Ground
Schematic Diagram :
I have designed this graphical Schematic diagram by using a free simulation tool known as Fritzing. I really like this tool, if you are new and haven’t heard about this wonderful tool, must visit the official website of Fritizing and download this user-friendly tool for yourself now.
Code :
#include <dht.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
#define DHT11_PIN 7
void setup(){
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print(“www.Electronics”);
delay(1000);
lcd.setCursor(0,1);
lcd.print(“Lovers.com”);
delay(7000);
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Temp: “);
lcd.print(DHT.temperature);
lcd.print((char)223);
lcd.print(“C”);
lcd.setCursor(0,1);
lcd.print(“Humidity: “);
lcd.print(DHT.humidity);
lcd.print(“%”);
delay(1000);
}
Watch Video:
Must try this project at school or university lab, it,s an easy project. Don’t hesitate to ask any question related to this project If you found any difficulty while making this project | Temperature and Humidity Sensor .
1 comment
Hi Abid,
NIce post! Surely this type of articles really helps to beginner .
Thanks!