Akshay Joseph
Published © GPL3+

Digital Calendar Clock

Digital calendar clock using Arduino Uno, I2C LCD and 1307 RTC module.

BeginnerFull instructions provided13,532
Digital Calendar Clock

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
DS1307 RTC Module
×1
Coin Cell Battery CR2032
Coin Cell Battery CR2032
×1
I2C 16x2 Arduino LCD Display Module
DFRobot I2C 16x2 Arduino LCD Display Module
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Digital Calendar Clock

Code

Digital calendar clock

Arduino
//Sketch created by Akshay Joseph

#include <RTClib.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
RTC_DS1307 rtc;
LiquidCrystal_I2C lcd(0x27, 16, 2);

char daysOfTheWeek[7][12] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
int temp;
void setup() {
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));  /* uncomment before first upload and comment before second upload */
  lcd.begin();
  lcd.backlight();

  if (! rtc.begin()) {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("RTC Not Working");

  }
  
  
  lcd.setCursor(0, 0);
  lcd.print("Digital calendar ");
  lcd.setCursor(1, 0);
  lcd.print("Clock");
}

void loop() {
  DateTime now = rtc.now();
  lcd.clear();
  lcd.setCursor(1, 0);
  lcd.print(now.day());
  lcd.print('/');
  lcd.print(now.month());
  lcd.print('/');
  lcd.print(now.year());

  lcd.setCursor(12, 0);
  lcd.print(daysOfTheWeek[now.dayOfTheWeek()]);
  lcd.setCursor(2, 1);
  if (now.hour() == 0) {
    lcd.print("12");
    temp = 0;
  }
  else if (now.hour() <= 11) {
    lcd.print(now.hour());
    temp = 0;
  }
  else if (now.hour() >= 13) {
    lcd.print(map(now.hour(), 13, 23, 1, 11));
    temp = 1;
  }
  if (now.hour() == 12) {
    lcd.print(now.hour());
    temp = 1;
  }

  lcd.print(':');
  lcd.print(now.minute());
  lcd.print(':');
  lcd.print(now.second());
  lcd.setCursor(12, 1);
  if (temp == 0) {
    lcd.print("AM");
  }
  else if (temp == 1) {
    lcd.print("PM");
  }
  delay(1000);
}

Credits

Akshay Joseph

Akshay Joseph

25 projects • 156 followers
B.Sc. Electronics Student at Govt. College Tanur

Comments