How to set up and use a DHT11 or DHT22 with a ARDUINO board & LCD screen

This tutorial will show you how to set up and use a DHT11 or DHT22 temp and humidity sensor with a ARDUINO board & LCD screen.

Click on video below for full tutorial…..

Check us out on Facebook!

 LCD library for ARDUINO and more info on the I2C LCD screen can be found here

PARTS LIST:

#affiliate links#

ARDUINO Board

I2C 1602 LCD SCREEN

DHT11 or DHT22 Temp & humidity Sensor

Bread Board

Jumper Wires

THE SCHEMATIC:

lcd_shit_schem_final

ARDUINO CODE:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#include <SimpleDHT.h>
#define pinDHT11 6 //data pin
SimpleDHT11 dht11;

void setup() {
lcd.begin(16, 2); // initialize the lcd for 16 chars 2 lines
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Temperature”);
lcd.setCursor(14, 0);
lcd.print(“C”);
lcd.setCursor(0, 1);
lcd.print(“Humidity”);
lcd.setCursor(11, 1);
lcd.print(“%”);
}

void loop() {
byte temperature = 0;
byte humidity = 0;
if (dht11.read(pinDHT11, &temperature, &humidity, NULL)) {
Serial.print(“Read DHT11 failed.”);
return;
}
lcd.setCursor(12, 0);
lcd.print((int)temperature);
lcd.setCursor(9, 1);
lcd.print((int)humidity);

delay(1000);
}