Project showcase
Simple Weather Station with a 20x4 LCD UPDATED

Simple Weather Station with a 20x4 LCD UPDATED © GPL3+

Basic weather system, in/out temp and humidity with heat index, dew point, pressure and weather prediction and time and date.

  • 4,998 views
  • 12 comments
  • 25 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
4x 20 LCD
With I2C interface
×1
10167 01
DHT22 Temperature Sensor
Mine is built on a pcb with resistors already in place
×1
20120702130508859
DHT11 Temperature & Humidity Sensor (4 pins)
Mine is built on a pcb with resistors already in place
×1
Adafruit industries ada64 image 75px
Solderless Breadboard Half Size
×1
RTC DS3231
I2c interface
×1
7 Segment display (TM 1637)
the 4 pin tm1637 version. VCC, gnd, clk and dio.
×1
BMP280 Pressure
×1
266 04
Female/Female Jumper Wires
×1
826 04
Male/Female Jumper Wires
×1
Led technology l03r5000q1 image
5 mm LED: Yellow
×7
5mm LED: Blue
×1

Apps and online services

About this project

I have an outside shed where I wanted a clock, so I made a simply clock with date on a 20x4 LCD. I then decided it looked a bit boring so I added inside temperature and humidity. Updated it agian to show outside temp and humidity. Then just kept adding things like pressure and predictions.

My sketch shows a 20x4 lcd that rotates through the screens to show date and time, inside and outside temperature, pressure and weather prediction (like a barometer). As an extra I added the outside heat index and dew point as well using the DHT22 for the readings. I also added a 4 digit display to constantly show the time as this was the main idea for the project.

The BMP280, LCD and Ds3231 (ZS-042) are connected by I2C.

Remember the BMP280 uses 3.3v and not 5v

I used a DHT22 for outside temp and humidity and a DHT11 for inside temp and humidity. It was what I had in my spares box but any sensor could be used (with a little tweak to the code). The DHT11 is less accurate, showing only whole numbers but is good enough for a indication of my shed temp.

Just added sunrise, sunset and moon information with a lunar phase indicator.

To make the lunar indicator i used 8 LED's 7 yellow and 1 blue (for new moon). I took the lid of a air rifle pellet tin and drilled 8 holes in an array. Pushed the LED's into the holes and wired them up. I then printed and laminated a moon phase diagram and screwed it to the tin, not perfect alignment but good enough until I build an enclosure.

The moon age is not 100% accurate and it only works out full days but thats good enough for me. And the illumination % is an estimate so don't take it as gospel.

UPDATED AGAIN just added an LDR to turn off the LCD backlight when the shed lights go out, as the lights are only on when im in there.

Code

Updated CodeC/C++
// use example DS1307RTC SetTime to set RTC time to PC
// 4, 7 segment display shows time (TM1637) 4 pin connection
// LCD 20x4, DS3231 RTC and BMP uses I2C interface
// DHT11 measures inside temp and hum (less acurate) can use 2 dht22 but slight code change
// DHT22 measures outside temp and hum and calculates Dew Point and Heat Index
// BMP280 measures pressure (mb) and does a basic prediction of what the weather is meant to be doing (same as a barometer)
// added milli instead of delay to rotate through the 4 screens
// Sunrise and Sunset times added
// Moon age and % illumination added
// Moon phase display added
// 16/11/18

#include <RTClib.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DS1307RTC.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <DHT.h>
#include <Time.h>
#include <TimeLib.h>
#include <TM1637.h>
#include <sunMoon.h>

#define DHT1PIN 12       // DHT11 TO PIN 7
#define DHT2PIN 13       // DHT22 to PIN 13
#define DHT2TYPE DHT22   // DHT22  
#define DHT1TYPE DHT11   // DHT11
#define CLK 11           // 7 segment display PIN CLK
#define DIO 10           // 7 segment display PIN DIO
#define OUR_latitude    50.770854       // Sidlesham cordinates
#define OUR_longtitude  -0.784057
#define OUR_timezone 0   // localtime with UTC difference in minutes

float V = 7.2;    //version

sunMoon  sm;

TM1637 Display1(CLK, DIO);
int8_t Digits[] = {0, 1, 2, 3};
int hours;
int minutes;

const int led1  = 2;   //New Moon (Blue LED)
const int led2  = 3;   //Waxing Cresent (White LED)
const int led3  = 4;   //First Quarter (White LED)
const int led4  = 5;   //Waxing Gibbon (White LED)
const int led5  = 6;   //Full Moon (White LED)
const int led6  = 7;   //Wanning Gibbon (White LED)
const int led7  = 8;   //Last Quarter (White LED)
const int led8  = 9;   //Waning Cresent (White LED)

byte mDay = sm.moonDay();

boolean alterna;

DHT dht2 (DHT2PIN, DHT2TYPE);   //outside temp,hum
DHT dht1 (DHT1PIN, DHT1TYPE);   //inside temp,hum
Adafruit_BMP280 bme;

LiquidCrystal_I2C lcd(0x27, 20, 4); // Set the LCD I2C address

int chk;
int LDR = A0;
int Light = 0;

float temp1;      //Inside Temperature
float hum1;       //Inside Humidity
float temp2;      //Outside Temperature
float hum2;       //Outside Humidity
float Pressure;   //Pressure!
float dp;         //Dew Point Outside
float temp2f;     //temp outside in F
float hif;        //Heat index in F
float hic;        //Heat Index in C
float sRise;      //Sun Rise Calculation
float sSet;       //Sun Set Calculation

unsigned long switchMillis = 0;
unsigned long interval = 5000;       // 5 seconds for each lcd screen
byte count = 0;

boolean firstScreenFlag = false;
boolean secondScreenFlag = false;
boolean thirdScreenFlag = false;
boolean fouthScreenFlag = false;
boolean fifthScreenFlag = false;

void setup()
{

  tmElements_t  tm;                             // specific time
  time_t s_date = makeTime(tm);

  Serial.begin(9600);
  setSyncProvider(RTC.get);                     // the function to get the time from the RTC
  if (timeStatus() != timeSet)
    Serial.println("Unable to sync with the RTC");
  else
    Serial.println("RTC has set the system time");

  sm.init(OUR_timezone, OUR_latitude, OUR_longtitude);

  time_t sRise = sm.sunRise();
  time_t sSet  = sm.sunSet();

  sRise = sm.sunRise(s_date);
  sSet  = sm.sunSet(s_date);

  Serial.begin(9600);

  Display1.set();
  Display1.init();

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(led8, OUTPUT);
  pinMode(LDR, INPUT);
  
  lcd.init();
  lcd.clear();
  lcd.backlight();
  dht1.begin();
  dht2.begin();
  Wire.begin();

  lcd.setCursor(0, 0);
  lcd.print(F("  Weather Station"));
  lcd.setCursor(3, 2);
  lcd.print(F("Version : "));
  lcd.print(V, 1);
  delay(3000);
  lcd.clear();

  if (!bme.begin())
  {
    while (1);
  }

}

void loop()
{

  Light = analogRead(LDR);
  
  if (Light > 900) {
    lcd.noBacklight();    //Turns off LCD Backlight when dark

  }  else   {

    lcd.backlight();      //Turns on LCD Backlight when light
  }

  tmElements_t tm;
  time_t s_date = makeTime(tm);

  if (RTC.read(tm)) {

    print2digits(tm.Hour);
    print2digits(tm.Minute);

    hours = tm.Hour;
    minutes = tm.Minute;
    CalculaDigits(hours, minutes);
    if (alterna)
    {
      Display1.point(POINT_OFF);
      alterna = false;
    }
    else
    {
      Display1.point(POINT_ON);
      alterna = true;
    }

  } else {
    if (RTC.chipPresent()) {

    } else {

    }
    delay(9000);
  }
  delay(1000);

  if (millis() - switchMillis > interval)
  {
    count++;

    if (count == 1)
    {
      firstScreenFlag = true;
      count = 1;
    }
    if (count == 2)
    {
      secondScreenFlag = true;
      count = 2;
    }
    if (count == 3)
    {
      thirdScreenFlag = true;
      count = 3;
    }
    if (count == 4)
    {
      fouthScreenFlag = true;
      count = 4;
    }
    if (count == 5)
    {
      fifthScreenFlag = true;
      count = 0;
    }
    switchMillis += interval;
  }

  if (firstScreenFlag)
  {
    printTime(1, 0, tm);
    firstScreenFlag = false;
  }

  if (secondScreenFlag)
  {
    printTemp();
    secondScreenFlag = false;
  }

  if (thirdScreenFlag)
  {
    printIndex();
    thirdScreenFlag = false;
  }

  if (fouthScreenFlag)
  {
    printPressure();
    fouthScreenFlag = false;
  }
  if (fifthScreenFlag)
  {
    printMoon(tm);
    fifthScreenFlag = false;
  }
}

void printLcdDate(time_t date)
{
  char rise[10];
  sprintf(rise, "%02d:%02d", hour(date), minute(date));
  lcd.print(rise);
}

void printTime(int character, int line, tmElements_t tm)
{

  lcd.clear();
  String seconds, minutes;
  lcd.setCursor(character, line);
  lcd.print(tm.Hour);
  lcd.print(F(":"));
  if (tm.Minute < 10)
  {
    minutes = "0" + String(tm.Minute);
    lcd.print(minutes);
  } else
  {
    lcd.print(tm.Minute);
  }

  lcd.setCursor(9, 0);
  lcd.print(tm.Day);
  lcd.print(F("/"));
  lcd.print(tm.Month);
  lcd.print(F("/"));
  lcd.print(tmYearToCalendar(tm.Year));

  time_t s_date = makeTime(tm);
  time_t sRise = sm.sunRise();
  time_t sSet  = sm.sunSet();
  sRise = sm.sunRise(s_date);
  sSet  = sm.sunSet(s_date);

  lcd.setCursor(1, 2);
  lcd.print(F("SunRise  :  "));
  printLcdDate(sRise);
  lcd.setCursor(1, 3);
  lcd.print(F("SunSet   :  "));
  printLcdDate(sSet);

}

void printTemp()
{
  hum1 = dht1.readHumidity();               //inside
  temp1 = dht1.readTemperature();           //inside
  hum2 = dht2.readHumidity();               //outside
  temp2 = dht2.readTemperature();           //outside

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(F("   Inside    Outside"));
  lcd.setCursor(0, 2);
  lcd.print(F("T: "));
  lcd.print(temp1, 1);
  lcd.print(F(" "));
  lcd.print((char)223);
  lcd.print(F("C"));
  lcd.setCursor(13, 2);
  lcd.print(temp2, 1);
  lcd.print(F(" "));
  lcd.print(( char)223);
  lcd.print(F("C"));

  lcd.setCursor(0, 3);
  lcd.print(F("H:  "));
  lcd.print(hum1, 0);
  lcd.print(F(" %"));
  lcd.setCursor(14, 3);
  lcd.print(hum2, 0);
  lcd.print(F(" %"));

}
void printIndex()
{

  hum2 = dht2.readHumidity();               //outside
  temp2 = dht2.readTemperature();           //outside
  temp2f = dht2.readTemperature(true);      // temp in f

  double Point = log(hum2 / 100) + ((17.62 * temp2) / (243.5 + temp2));
  double dp = 243.5 * Point / (17.62 - Point);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(F("  Outside Readings"));
  lcd.setCursor(0, 2);
  lcd.print(F("Dew Point  : "));
  lcd.print(dp, 1);
  lcd.print(F(" "));
  lcd.print((char)223);
  lcd.print(F("C"));

  hif = dht2.computeHeatIndex(temp2f, hum2);          //heat index in degrees F
  hic = dht2.computeHeatIndex(temp2, hum2, false);    //heat index in degrees C

  lcd.setCursor(0, 3);
  lcd.print(F("Heat Index : "));
  lcd.print(hic, 1);
  lcd.print(F(" "));
  lcd.print((char)223);
  lcd.print(F("C"));

}
void printPressure()
{
  Pressure = (bme.readPressure() / 100);    // 100 Pa = 1 millibar

  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print(F(" Press : "));
  lcd.print(Pressure);
  lcd.print(F(" mb"));
  lcd.setCursor(0, 3);
  lcd.print(F("Weather :"));

  if (Pressure <= 970); {
    lcd.setCursor(13, 3);
    lcd.print(F("         "));
    lcd.setCursor(13, 3);
    lcd.print(F("Stormy"));
  }
  if (Pressure > 970) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(11, 3);
    lcd.print(F("Much Rain"));
  }
  if (Pressure > 996) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(13, 3);
    lcd.print(F("Rain"));
  }
  if  (Pressure > 1006) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(11, 3);
    lcd.print(F("Variable"));
  }
  if  (Pressure > 1030) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(13, 3);
    lcd.print(F("Fair"));
  }
  if (Pressure > 1040) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(11, 3);
    lcd.print(F("Set Fair"));
  }
  if (Pressure > 1060) {
    lcd.setCursor(11, 3);
    lcd.print(F("         "));
    lcd.setCursor(11, 3);
    lcd.print(F("Very Dry"));
  }
}

void printMoon(tmElements_t tm)
{
  time_t s_date = makeTime(tm);
  mDay = sm.moonDay(s_date);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(" Moon age is ");
  lcd.print(mDay);
  if (mDay == 1) {
    lcd.print(" day ");
  }
  else {
    lcd.print(" days");
  }
  lcd.setCursor(0, 2);

  if (mDay == 0) {

    lcd.setCursor(0, 2);
    lcd.print("      New Moon   ");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 0 %  ");
    digitalWrite(led1, HIGH);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 1) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 1 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

   if (mDay == 2) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 4 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 3) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 8 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 4) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 15 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 5) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 22 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 6) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 31 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 7) {

    lcd.setCursor(0, 2);
    lcd.print("   First Quarter ");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 50 % ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, HIGH);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }

  if (mDay == 8) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 58 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 9) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 68 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
    if (mDay == 10) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 76 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
    if (mDay == 11) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 84 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
    if (mDay == 12) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 91 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
    if (mDay == 13) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 96 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
    if (mDay == 14) {

    lcd.setCursor(0, 2);
    lcd.print("   Waxing Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 99 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, HIGH);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 15) {

    lcd.setCursor(0, 2);
    lcd.print("     Full Moon   ");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 100 % ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, HIGH);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 16) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 98 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 17) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 93 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 18) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 86 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 19) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 77 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 20) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 67 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 21) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 56 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 22) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Gibbons");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 52 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, HIGH);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
  }
  if (mDay == 23) {

    lcd.setCursor(0, 2);
    lcd.print("    Last Quarter ");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 50 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, HIGH);
    digitalWrite(led8, LOW);
  }
  if (mDay == 24) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 34 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
  if (mDay == 25) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 24 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
  if (mDay == 26) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print(" Illumination 15 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
  if (mDay == 27) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 8 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
  if (mDay == 28) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 3 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
  if (mDay == 29) {

    lcd.setCursor(0, 2);
    lcd.print("   Waning Cresent");
    lcd.setCursor(0, 3);
    lcd.print("  Illumination 1 %  ");
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, HIGH);
  }
}

void print2digits(int number) {

  if (number >= 0 && number < 10) {
    Serial.write('0');
  }
  Serial.print(number);
}

void CalculaDigits( int hour, int min)
{
  int8_t Digit0 = min % 10 ;
  int8_t Digit1 = (min % 100) / 10 ;
  int8_t Digit2 = hour % 10 ;
  int8_t Digit3 = (hour % 100) / 10 ;

  Digits[3] = Digit0 ;
  Digits[2] = Digit1 ;
  Digits[1] = Digit2 ;
  Digits[0] = Digit3 ;

  Display1.display(Digits);
}

Schematics

UPDATED AGAIN Diagram
weather_station1_ZumAs0cBlt.fzz

Comments

Similar projects you might like

Uno Weather Station

Project in progress by wrightmac

  • 7,949 views
  • 4 comments
  • 11 respects

AWS - Arduino Weather Station

Project tutorial by GilettaStefano

  • 19,316 views
  • 13 comments
  • 63 respects

Wireless weather station (Arduino + ESP8266 + Thingspeak)

Project tutorial by Alin-Constantin Paun

  • 8,862 views
  • 2 comments
  • 11 respects

Arduino Weather Station v1.0 (BMP280)

Project tutorial by Gabriele Scordamaglia

  • 7,311 views
  • 15 comments
  • 43 respects

WiFi Weather Station

Project in progress by Dan Fein

  • 32,724 views
  • 17 comments
  • 58 respects

Rube Goldberg Weather Station with Internet Data Storage

Project in progress by randtekk

  • 6,023 views
  • 6 comments
  • 40 respects
Add projectSign up / Login