jjvideo
Published © GPL3+

LC displays temp & humidity

Using 2 lines LCD to diplay temperature et humidity rate provided by DHT11 simple componant

IntermediateFull instructions provided551
LC displays temp & humidity

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Trimmer Potentiometer, 10 kohm
Trimmer Potentiometer, 10 kohm
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
9V Battery Clip
9V Battery Clip
×1
9V battery (generic)
9V battery (generic)
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×3
Male/Male Jumper Wires
×16

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Wiring

Using fritzing program

Schematics

Breadboarding

Fritzing image of project

Code

My LC displays temp & humidity rate

Arduino
code for displaying temperature and humidity from DHT-11
#include <SimpleDHT.h>

// for DHT11, 
//      VCC: 5V or 3V
//      GND: GND
//      DATA: 2
int pinDHT11 = 2;
SimpleDHT11 dht11;

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
}

void loop() {  
      
  // read with raw sample data.
  byte temperature = 0;
  byte humidity = 0;
  byte data[40] = {0};
  if (dht11.read(pinDHT11, &temperature, &humidity, data)) {
    lcd.print("Read DHT11 failed");
    return;
  }
   
  for (int i = 0; i < 40; i++) {
    if (i > 0 && ((i + 1) % 4) == 0) {
      
    }
  }
  
  lcd.print("temp.: ");lcd.print((int)temperature); lcd.print(" *C ");
  lcd.setCursor(0,2);lcd.print("humidite: ");lcd.print((int)humidity); lcd.println(" %  ");
  
  // DHT11 sampling rate is 1*10-² HZ.
  delay(100000);lcd.clear();
}

Credits

jjvideo
0 projects • 0 followers

Comments