Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
abshah15
Published © GPL3+

DHT22 Sensor with 16x2 LCD Screen

Monitor Temperature & Humidity of a room on LCD Screen using Arduino Mega

BeginnerShowcase (no instructions)7,385
DHT22 Sensor with 16x2 LCD Screen

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
×1
RGB LCD Shield Kit, 16x2 Character Display
RGB LCD Shield Kit, 16x2 Character Display
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Temp Sensor With LCD and Arduino

Code

LED With DHT22 Temp. Sensor

Arduino
/* LCD Screen */
#include <LiquidCrystal.h
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

/* Temperature humidity sensor */
#include <DHT.h>
#define datapin 7     // Digital pin we're connected to
#define DHTTYPE DHT22
DHT dht(datapin, DHTTYPE);


void setup() {
  dht.begin(); 
  lcd.begin(16, 2);
}

void loop() {

  /* Find Temperature & Humidity */
  float air_temp = dht.readTemperature();
  float humidity = dht.readHumidity();
  
  /* Print Output on LCD Screen */
  lcd.setCursor(0,0);
  lcd.print(String("Temp. ") + String(air_temp));
  lcd.setCursor(0,1);
  lcd.print(String("Humidity ") + String(humidity));

  delay(2000);

}

Credits

abshah15

abshah15

1 project • 1 follower

Comments