Friday 31 March 2017

Arduino uno+Nokia 5110 lcd display+DHT22 Humidity and Temperature sensor


 Hardware required 

  1. Arduino uno.
  2. Nokia 5110 lcd display.
  3. DHT22 Humidity sensor.
  4. 10 k ohm resistor-6 nos
  5. 1 k ohm resistor- 1 nos.
  6.  Jumper wires(male to male)-10 nos.
  7. Breadboard-1pcs.

Project Description

this post is aims to sense and display Humidity and Temperature by using Arduino uno, Nokia 5110 LCD display and DHT22 Humidity sensor. These Hardwares are available in online markets like ebay,amazon and Ali Express.

Following video showing this project



PROGRAM


//To get DHT22 library go to menu option of IDE Sketch~Include library~Manage libraries and then //search like DHT sensor library. Then download DHT sensor library to your IDE.
//To get  nokia lcd 5110 library download PCD8544 lcd library same lake above.

#include <PCD8544.h>

#include "DHT.h"

#define DHTPIN 8
// Connect pin 2 of the sensor to arduino pin 8

#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

// DHT22 connection
// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to arduino pin 8
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor


// Nokia 5110 lcd connection
// Nokia 5110 lcd is working wit 3.3 VDC so need to reduce +5v of arduino to 3.3V
// connect 10 k ohm resistance with every connection except vcc, Gnd and BL
// RST connect to 10 k-Ohm resistance series and pin no 6 of Arduino
// CE connect to 10 k-Ohm resistance series and pin no 7 of Arduino
// DC connect to 10 k-Ohm resistance series and pin no 5 of arduino
// Din connect to 10 k-Ohm resistance series and  pin no 4 of arduino
// Clk connect to 10 k-Ohm resistance series and pin no 3 of arduino
// Vcc to +5v of arduino directly
// BL connect with 1k ohm  to arduino pin +5v
// Gnd to Gnd of arduino

static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };
static PCD8544 lcd;

void setup()
{
  lcd.begin(84, 48);
  lcd.createChar(0, glyph);
  
  dht.begin();

  Serial.begin(96000);
}
void loop() 
{
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();

    if (isnan(h) || isnan(t))
    {
      //if reading failed return to beginning of loop
      Serial.println("Failed to read from DHT sensor!");
      return;
    }

    //writing to Nokia 5110 lcd

      lcd.setCursor(0, 0);
      lcd.print("Humidity");
      lcd.setCursor(0,1);
      lcd.print("     "+String(h)+"%");
      lcd.setCursor(0,2);
      lcd.print(" ");
      lcd.setCursor(0,3);
      lcd.print("Temperature");
      lcd.setCursor(0,4);
      lcd.print("     "+String(t)+" *C");
}

Connection diagram









dssdsdsdsddsdsdsdd

2 comments:

  1. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Temperature Humidity Test Chamber

    ReplyDelete