learning Arduino for beginners EP#22 DHT11 temp and humidity on LCD display

In this tutorial we will take a look at how you can display the temperature and humidity readings from a dht11 or dht22 on an LCD display screen…

Check us out on Facebook!

Links for more INFO…

How to set up and use a 1602 I2C serial LCD with your ARDUINO.

learning Arduino for beginners EP#21 DHT11 and DHT22 temp and humidity sensor

Parts list:

affiliate links

Arduino board

I2C LCD screen

DHT11

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();
}

void loop() {
byte temperature = 0;
byte humidity = 0;
dht11.read(pinDHT11, &temperature, &humidity, NULL);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(“Temperature”);
lcd.setCursor(15, 0);
lcd.print(“C”);
lcd.setCursor(0, 1);
lcd.print(“Humidity”);
lcd.setCursor(12, 1);
lcd.print(“%”);
lcd.setCursor(12, 0);
lcd.print(temperature);
lcd.setCursor(9, 1);
lcd.print(humidity);
delay(30000);
}