Temperature & Humidity Sensor & LCD Shield

Components Used:

  • 1x Breadboard
  • 1x Arduino Uno R3
  • 1x LCD Shield
  • 1x DHT11
  • 1X10K ohm resistor

dht11_pinout

Comparison of DHT11 and DHT22:DHT11-vs-DHT22-specifications-parameters

Connection:

DHT11.png

Program:

/* 
Program by: Ankit Modi

DHT11 Sensor Temperature and Humidity Tutorial*/
/*
 You can find the DHT Library from Arduino official website
 http://playground.arduino.cc/Main/DHTLib
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
#include <dht.h>
#define dataPin 11
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
dht DHT;
void setup() {
 lcd.begin(16, 2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
}
void loop() {
 int readData = DHT.read11(dataPin);
 float t = DHT.temperature;
 float h = DHT.humidity;
 lcd.setCursor(0, 0); // Sets the location at which subsequent text written to the LCD will be displayed
 lcd.print("Temp.: "); // Prints string "Temp." on the LCD
 lcd.print(t); // Prints the temperature value from the sensor
 lcd.print(" C");
 lcd.setCursor(0, 1);
 lcd.print("Humi.: ");
 lcd.print(h);
 lcd.print(" %");
 delay(1000);
}
Advertisements