Ardumotive Arduino Greek Playground
  • Home
    • About us
    • Contact
    • License
  • Arduino
    • Tutorials
    • Workshop
  • Raspberry Pi
  • DIY 3D Printer
  • News
    • Events >
      • Unboxing & Review
    • Blog
The 1st Arduino Playground in Greece - Open Source Hardware

Temperature Humidity and Brightness

23/3/2018

Comments

 

Introduction

Read and print to the LCD the room temperature, humidity and brightness percentage.

What you will need - Hardware

We will use:
  • DHT-22
  • Photocell
  • Nokia 5110 LCD

Connections

DHT-22 sensor and photocell
  • Arduino UNO pin 2--> DHT-22 Sensor
  • Arduino UNO pin A0 --> Photocell

Nokia 5110 LCD (Blue PCB)
  • Arduino UNO pin 3 --> CLK
  • Arduino UNO pin 4 --> Din
  • Arduino UNO pin 5 --> DC
  • Arduino UNO pin 6 --> CE
  • Arduino UNO pin 7 --> RST

Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * === Ardumotive Shield for Arduino UNO Board ===
 * Arduino Tutorial: Blink LEDs - Control the changing interval with buttons 
 * Dev Michalis Vasilakis/Date 24/3/2018/http://ardumotive.com
 */
 
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <dht.h>

#define DHTPIN 2   
Adafruit_PCD8544 display = Adafruit_PCD8544(3,4,5,6,7);
dht DHT;


void setup() {
  // put your setup code here, to run once:
  display.begin();
  display.setContrast(50);
  display.clearDisplay();   // clears the screen and buffer

}

void loop() {
  int chk = DHT.read22(DHTPIN);
  // put your main code here, to run repeatedly:
  int h = DHT.humidity;
  // Read temperature as Celsius (the default)
  float t = DHT.temperature;
  display.setTextSize(1);
  display.println("Temperature:");
  display.println("");
  display.setTextSize(3);
  display.println(t,1);
  display.display();
  delay(2000);
  
  display.setTextSize(1);
  display.clearDisplay();   // clears the screen and buffer
  display.println("Humidity:\n");
  display.setTextSize(3);
  display.print(" ");  
  display.print(h);
  display.println("%");
  display.display();
  delay(2000);
  
  display.clearDisplay();   // clears the screen and buffer
  display.setTextSize(1);
  display.clearDisplay();   // clears the screen and buffer
  display.println("PhotoCell:\n");
  display.setTextSize(3);
  display.print(" ");  
  display.print((float(analogRead(A0))/1024)*100,0);
  display.println("%");
  display.display();
  delay(2000);
  
  display.clearDisplay();   // clears the screen and buffer

}
Download the code from here and open it with Arduino IDE. Inside you will also find the library files.
ardumotive_shield_temperature_humidity_brightness.zip
File Size: 30 kb
File Type: zip
Download File

Comments
comments powered by Disqus
    Picture
    Picture

    License of this project:

    Picture
    Attribution-NonCommercial-ShareAlike

    Categories

    All
    1: Introduction
    2: Fade LEDs
    3: Blink LEDs
    4: Park Assist
    5: Temp-Hum-Brightness

    Help us to grow up!

    Picture




Donate us
About us
License
Cookies policy

Visit the biggest Arduino Shop in Greece!

Picture
find us on dwrean.net
find us on Codebender
find us on Instructables
Developed and designed by Vasilakis Michalis Copyright © 2013 Ardumotive All Rights Reserved
All trademarks referenced herein are properties of their
Powered by Create your own unique website with customizable templates.
Design by DivTag Templates