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

Arduino Temperature and Humidity Center

A simple way to measure your temprature and humidity in your home.

IntermediateFull instructions provided2,274
Arduino Temperature and Humidity Center

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Arduino UNO
Arduino UNO
×1
USB-A to B Cable
USB-A to B Cable
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The schematic

This will help you to connect all the parts together as it wasn't obvious what went where in the cover picture.

Code

t

Arduino
/*


  The circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 8
 * LCD D4 pin to digital pin 9
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 11
 * LCD D7 pin to digital pin 12
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)



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

int pinDHT11 = 2;
SimpleDHT11 dht11;

// 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);
  // Print a message to the LCD.
  //lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  //lcd.print(millis() / 1000);
  lcd.print("Sample DHT11...");
  lcd.clear();
  // 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");
    delay(1000);
    lcd.clear();
    return;
  }
  //lcd.print("Sample OK: ");
  lcd.print("TEMP = "); lcd.print((int)temperature); lcd.print(" *C");
  lcd.setCursor(0,2);
  lcd.print("HUMD = "); lcd.print((int)humidity); lcd.print(" % ");
  
  // DHT11 sampling rate is 1HZ.
  delay(1000);
    
    
}

Credits

tylerpeppy
2 projects • 42 followers
Love Arduino and IoT projects!

Comments