Project tutorial
Big Real-Time Clock Using Arduino

Big Real-Time Clock Using Arduino © GPL3+

This project demonstrates the use of electronics and embedded system with clock.

  • 1,744 views
  • 1 comment
  • 15 respects

Components and supplies

Apps and online services

About this project

Real-Time Clock Using DS3231 and P10 Display Matrix

This project demonstrates the use of electronics and embedded system with clock.

Dot-matrix display or more commonly referred to as free running text is often found in shops as a means of advertising their products, it is practical and flexible in its use that encourages business actors to use it as advertising advice. Now the use of dot-matrix display has spread, not just as advertiser media only, as well as prayer schedules, warning boards, queuing machines, etc.

Here, we will give a post about how I made a clock using P10 marix display and DS3231 RTC using Arduino.

Step 1: Hardware and Software Requirements

Hardware:

  • Arduino Uno x 1
  • Push button (Keypad) x 4
  • RTC Module (DS3231)
  • P10 Dot-matrix Display

Software:

  • Arduino IDE
  • DMD 2 Library / DMD Library

Before that, you need a supporting library that must be installed on Arduino IDE. To download the DMD2 library mentioned above

Step 2: Connections

*Arduino -> RTC Module*

  • A4-> SDA
  • A5-> SCL
  • VCC -> 5V
  • GND -> GND

*Arduino -> P10 DMD*

  • D8-> SCK
  • D6-> A
  • D7-> B
  • D11 -> R
  • D13-> CLK
  • D9-> OE

Step 3: The Code

You can find the sample code below.

//Chakra Healing Harmonizer using Arduino/*Visit the Channel for more interesting projects https://www.youtube.com/channel/UCks-9JSnVb22dlqt...*/

byte dayOfWeek=4;byte dayOfMonth=1;#include         //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include         //
#include    //
#include "Wendy3x5.h"
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68int AlarmSetPin = 2;
int SnoozePin = 3;
int Alarm = 4;
int AlarmSet = 0;
int Snooze = 0;
int a,b;
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock// Assumes you're passing in valid numbersvoid setDateDs1307(byte second,        // 0-59
byte minute,        // 0-59
byte hour,          // 1-23
byte dayOfWeek,     // 1-7
byte dayOfMonth,    // 1-28/29/30/31
byte month,         // 1-12
byte year)          // 0-99
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(0);
  Wire.write(decToBcd(second));    // 0 to bit 7 starts the clock
  Wire.write(decToBcd(minute));
  Wire.write(decToBcd(hour));     
  Wire.write(decToBcd(dayOfWeek));
  Wire.write(decToBcd(dayOfMonth));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));
  Wire.write(00010000); // sends 0x10 (hex) 00010000 (binary) to control register - turns on square wave
  Wire.endTransmission();
}// Gets the date and time from the ds1307
void getDateDs1307(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(0);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
}//Fire up the DMD library as dmd
DMD dmd(1,1);void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}void setup()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;  //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
  Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
  Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()  //clear/init the DMD pixels held in RAM
  dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
  dmd.selectFont(Wendy3x5 );  Wire.begin();  // Change these values to what you want to set your clock to.
  // You probably only want to set your clock once and then remove
  // the setDateDs1307 call.  second = 0;
  minute = 35;
  hour = 11; // use 24-hour time otherwise day/date calculations will be off
  dayOfWeek = 1;
  dayOfMonth = 23;
  month = 3;
  year = 14;
  //uncomment the setDateDs1307 call below to set time to intervals above.  Remember if you set the time 
  //you need to uncomment the line below again otherwise the sketch will only stay at the time set.
  //setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);  pinMode(AlarmSetPin, INPUT_PULLUP);
  pinMode(SnoozePin, INPUT_PULLUP);
  pinMode(Alarm, OUTPUT);
  digitalWrite(Alarm, LOW);
}void drawDay()
// shows day of week
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(dayOfWeek)
  {
  case 1:
    dmd.drawString( 1,0, "Sun,", 3, GRAPHICS_NORMAL );    
    break;  case 2:
    dmd.drawString( 1,0, "Mon,", 3, GRAPHICS_NORMAL );        
    break;  case 3:
    dmd.drawString( 1,0, "Tue,", 3, GRAPHICS_NORMAL );        
    break;  case 4:
    dmd.drawString( 1,0, "Wed,", 3, GRAPHICS_NORMAL );        
    break;  case 5:
    dmd.drawString( 1,0, "Thu,", 3, GRAPHICS_NORMAL );        
    break;  case 6:
    dmd.drawString( 1,0, "Fri,", 3, GRAPHICS_NORMAL );        
    break;  case 7:
    dmd.drawString( 1,0, "Sat,", 3, GRAPHICS_NORMAL );        
    break;
  }
}void drawDate()
// shows numerical date
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(dayOfMonth)
  {
  case 1:
    dmd.drawString( 20,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 20,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 20,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 20,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 20,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 20,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 20,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 20,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 20,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 20,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 20,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 20,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 20,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 20,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 20,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 20,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 20,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 20,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 20,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 20,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 20,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 20,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 20,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 20,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 20,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 20,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 20,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 20,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 20,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 20,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 20,0, "31", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawHour()
// draws the hour hand
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  if (hour>12) //Remove this if command for 24 hour time
  {
    hour=hour-12; // This is a 12 hour Clock 
  }
  switch(hour)
  {
  case 1:
    dmd.drawString( 0,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 0,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 0,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 0,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 0,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 0,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 0,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 0,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 0,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 0,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 0,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 0,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 0,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 0,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 0,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 0,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 0,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 0,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 0,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 0,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 0,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 0,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 0,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 0,0, "24", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawMinute()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(minute)
  {
  case 0:
    dmd.drawString( 12,0, "00", 2, GRAPHICS_NORMAL );
    break;
  case 1:
    dmd.drawString( 12,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 12,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 12,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 12,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 12,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 12,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 12,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 12,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 12,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 12,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 12,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 12,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 12,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 12,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 12,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 12,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 12,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 12,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 12,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 12,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 12,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 12,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 12,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 12,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 12,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 12,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 12,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 12,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 12,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 12,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 12,0, "31", 2, GRAPHICS_NORMAL );
    break;
  case 32:
    dmd.drawString( 12,0, "32", 2, GRAPHICS_NORMAL );
    break;
  case 33:
    dmd.drawString( 12,0, "33", 2, GRAPHICS_NORMAL );
    break;
  case 34:
    dmd.drawString( 12,0, "34", 2, GRAPHICS_NORMAL );
    break;
  case 35:
    dmd.drawString( 12,0, "35", 2, GRAPHICS_NORMAL );
    break;
  case 36:
    dmd.drawString( 12,0, "36", 2, GRAPHICS_NORMAL );
    break;
  case 37:
    dmd.drawString( 12,0, "37", 2, GRAPHICS_NORMAL );
    break;
  case 38:
    dmd.drawString( 12,0, "38", 2, GRAPHICS_NORMAL );
    break;
  case 39:
    dmd.drawString( 12,0, "39", 2, GRAPHICS_NORMAL );
    break;
  case 40:
    dmd.drawString( 12,0, "40", 2, GRAPHICS_NORMAL );
    break;
  case 41:
    dmd.drawString( 12,0, "41", 2, GRAPHICS_NORMAL );
    break;
  case 42:
    dmd.drawString( 12,0, "42", 2, GRAPHICS_NORMAL );
    break;
  case 43:
    dmd.drawString( 12,0, "43", 2, GRAPHICS_NORMAL );
    break;
  case 44:
    dmd.drawString( 12,0, "44", 2, GRAPHICS_NORMAL );
    break;
  case 45:
    dmd.drawString( 12,0, "45", 2, GRAPHICS_NORMAL );
    break;
  case 46:
    dmd.drawString( 12,0, "46", 2, GRAPHICS_NORMAL );
    break;
  case 47:
    dmd.drawString( 12,0, "47", 2, GRAPHICS_NORMAL );
    break;
  case 48:
    dmd.drawString( 12,0, "48", 2, GRAPHICS_NORMAL );
    break;
  case 49:
    dmd.drawString( 12,0, "49", 2, GRAPHICS_NORMAL );
    break;
  case 50:
    dmd.drawString( 12,0, "50", 2, GRAPHICS_NORMAL );
    break;
  case 51:
    dmd.drawString( 12,0, "51", 2, GRAPHICS_NORMAL );
    break;
  case 52:
    dmd.drawString( 12,0, "52", 2, GRAPHICS_NORMAL );
    break;
  case 53:
    dmd.drawString( 12,0, "53", 2, GRAPHICS_NORMAL );
    break;
  case 54:
    dmd.drawString( 12,0, "54", 2, GRAPHICS_NORMAL );
    break;
  case 55:
    dmd.drawString( 12,0, "55", 2, GRAPHICS_NORMAL );
    break;
  case 56:
    dmd.drawString( 12,0, "56", 2, GRAPHICS_NORMAL );
    break;
  case 57:
    dmd.drawString( 12,0, "57", 2, GRAPHICS_NORMAL );
    break;
  case 58:
    dmd.drawString( 12,0, "58", 2, GRAPHICS_NORMAL );
    break;
  case 59:
    dmd.drawString( 12,0, "59", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawSec()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(second)
  {
  case 0:
    dmd.drawString( 24,0, "00", 2, GRAPHICS_NORMAL );
    break;
  case 1:
    dmd.drawString( 24,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 24,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 24,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 24,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 24,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 24,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 24,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 24,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 24,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 24,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 24,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 24,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 24,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 24,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 24,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 24,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 24,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 24,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 24,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 24,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 24,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 24,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 24,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 24,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 24,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 24,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 24,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 24,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 24,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 24,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 24,0, "31", 2, GRAPHICS_NORMAL );
    break;
  case 32:
    dmd.drawString( 24,0, "32", 2, GRAPHICS_NORMAL );
    break;
  case 33:
    dmd.drawString( 24,0, "33", 2, GRAPHICS_NORMAL );
    break;
  case 34:
    dmd.drawString( 24,0, "34", 2, GRAPHICS_NORMAL );
    break;
  case 35:
    dmd.drawString( 24,0, "35", 2, GRAPHICS_NORMAL );
    break;
  case 36:
    dmd.drawString( 24,0, "36", 2, GRAPHICS_NORMAL );
    break;
  case 37:
    dmd.drawString( 24,0, "37", 2, GRAPHICS_NORMAL );
    break;
  case 38:
    dmd.drawString( 24,0, "38", 2, GRAPHICS_NORMAL );
    break;
  case 39:
    dmd.drawString( 24,0, "39", 2, GRAPHICS_NORMAL );
    break;
  case 40:
    dmd.drawString( 24,0, "40", 2, GRAPHICS_NORMAL );
    break;
  case 41:
    dmd.drawString( 24,0, "41", 2, GRAPHICS_NORMAL );
    break;
  case 42:
    dmd.drawString( 24,0, "42", 2, GRAPHICS_NORMAL );
    break;
  case 43:
    dmd.drawString( 24,0, "43", 2, GRAPHICS_NORMAL );
    break;
  case 44:
    dmd.drawString( 24,0, "44", 2, GRAPHICS_NORMAL );
    break;
  case 45:
    dmd.drawString( 24,0, "45", 2, GRAPHICS_NORMAL );
    break;
  case 46:
    dmd.drawString( 24,0, "46", 2, GRAPHICS_NORMAL );
    break;
  case 47:
    dmd.drawString( 24,0, "47", 2, GRAPHICS_NORMAL );
    break;
  case 48:
    dmd.drawString( 24,0, "48", 2, GRAPHICS_NORMAL );
    break;
  case 49:
    dmd.drawString( 24,0, "49", 2, GRAPHICS_NORMAL );
    break;
  case 50:
    dmd.drawString( 24,0, "50", 2, GRAPHICS_NORMAL );
    break;
  case 51:
    dmd.drawString( 24,0, "51", 2, GRAPHICS_NORMAL );
    break;
  case 52:
    dmd.drawString( 24,0, "52", 2, GRAPHICS_NORMAL );
    break;
  case 53:
    dmd.drawString( 24,0, "53", 2, GRAPHICS_NORMAL );
    break;
  case 54:
    dmd.drawString( 24,0, "54", 2, GRAPHICS_NORMAL );
    break;
  case 55:
    dmd.drawString( 24,0, "55", 2, GRAPHICS_NORMAL );
    break;
  case 56:
    dmd.drawString( 24,0, "56", 2, GRAPHICS_NORMAL );
    break;
  case 57:
    dmd.drawString( 24,0, "57", 2, GRAPHICS_NORMAL );
    break;
  case 58:
    dmd.drawString( 24,0, "58", 2, GRAPHICS_NORMAL );
    break;
  case 59:
    dmd.drawString( 24,0, "59", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawCol1()
{
  dmd.drawString( 8,0, ":", 1, GRAPHICS_NORMAL );
}void drawCol2()
{
  dmd.drawString( 20,0, ":", 1, GRAPHICS_NORMAL );
}void runClock()
{
 // drawDay();  
 // drawDate();
  drawHour();
  drawCol1();
  drawMinute();
  drawCol2();
  drawSec();
 // CheckAlarm();}/*void AlarmSequence() {
  drawDay();  
  drawDate();
  drawHour();
  drawCol();
  drawMinute();
  digitalWrite(Alarm, HIGH);
  delay(1000);
  dmd.clearScreen( true );
  digitalWrite(Alarm, LOW);
  delay(1000);
}
*/
/*void CheckAlarm() {
  AlarmSet = digitalRead(AlarmSetPin);
  Snooze = digitalRead(SnoozePin);
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);*/
  /* Only Trigger Alarm If it is a day listed below. This can be changed by changing the numbers to any of the following:
   1 = Sunday
   2 = Monday
   3 = Tuesday
   4 = Wednesday
   5 = Thursday
   6 = Friday
   7 = Saturday
   */
/*  if(dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5 ||dayOfWeek == 6) { //This is days ALLOWED to ring alarm
    if(hour == 18 && minute == 05 ) { //Set Time Here (In 24 hour Time) 
      if(AlarmSet == LOW) { //If alarm pin is on
        Snooze = digitalRead(SnoozePin);
        while(Snooze == HIGH)
        {
          Snooze = digitalRead(SnoozePin);
          AlarmSequence();
        }
      }
    }
  }
}
*/
void loop()
{
  runClock();  
}

Step 4: Features

DMD

  • 32 x 16 high brightness Red LEDs (512 LEDs total) with 10mm pitch
  • Supports 5V operation
  • Viewable over 12 meters away
  • Tough plastic frame
  • Onboard Controller IC
  • Arduino compatible library, graphics functions

RTC

  • Counts seconds, minutes, hours and year
  • Accuracy: +2ppm to -2ppm for 0ºC to +40ºC, +3.5ppm to -3.5ppm for -40ºC to +85ºC
  • Digital temperature sensor with a ±3ºC accuracy
  • Two Time-of-day alarms
  • Programmable square wave output
  • Register for Aging trim400Khz I2C interface
  • Low power consumption
  • Automatic power failure battery switch circuitry
  • CR2032 battery backup with two to three-year life

Step 5: Working of This Project - Simple Clock

Step 6: Working of This Project - Clock With Settings

Step 7: Conclusion

Give a thumbs up if it really helped you and do follow my channel for interesting projects. :)

Share this video if you like.

Happy to have you subscribed: https://www.youtube.com/channel/UCks-9JSnVb22dlqtMgPjrlg/videos

Thanks for reading!

Code

Code snippet #2Plain text
byte dayOfWeek=4;byte dayOfMonth=1;#include         //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include         //
#include    //
#include "Wendy3x5.h"
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68int AlarmSetPin = 2;
int SnoozePin = 3;
int Alarm = 4;
int AlarmSet = 0;
int Snooze = 0;
int a,b;
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock// Assumes you're passing in valid numbersvoid setDateDs1307(byte second,        // 0-59
byte minute,        // 0-59
byte hour,          // 1-23
byte dayOfWeek,     // 1-7
byte dayOfMonth,    // 1-28/29/30/31
byte month,         // 1-12
byte year)          // 0-99
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(0);
  Wire.write(decToBcd(second));    // 0 to bit 7 starts the clock
  Wire.write(decToBcd(minute));
  Wire.write(decToBcd(hour));     
  Wire.write(decToBcd(dayOfWeek));
  Wire.write(decToBcd(dayOfMonth));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));
  Wire.write(00010000); // sends 0x10 (hex) 00010000 (binary) to control register - turns on square wave
  Wire.endTransmission();
}// Gets the date and time from the ds1307
void getDateDs1307(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(0);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
}//Fire up the DMD library as dmd
DMD dmd(1,1);void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}void setup()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;  //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
  Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
  Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()  //clear/init the DMD pixels held in RAM
  dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
  dmd.selectFont(Wendy3x5 );  Wire.begin();  // Change these values to what you want to set your clock to.
  // You probably only want to set your clock once and then remove
  // the setDateDs1307 call.  second = 0;
  minute = 35;
  hour = 11; // use 24-hour time otherwise day/date calculations will be off
  dayOfWeek = 1;
  dayOfMonth = 23;
  month = 3;
  year = 14;
  //uncomment the setDateDs1307 call below to set time to intervals above.  Remember if you set the time 
  //you need to uncomment the line below again otherwise the sketch will only stay at the time set.
  //setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);  pinMode(AlarmSetPin, INPUT_PULLUP);
  pinMode(SnoozePin, INPUT_PULLUP);
  pinMode(Alarm, OUTPUT);
  digitalWrite(Alarm, LOW);
}void drawDay()
// shows day of week
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(dayOfWeek)
  {
  case 1:
    dmd.drawString( 1,0, "Sun,", 3, GRAPHICS_NORMAL );    
    break;  case 2:
    dmd.drawString( 1,0, "Mon,", 3, GRAPHICS_NORMAL );        
    break;  case 3:
    dmd.drawString( 1,0, "Tue,", 3, GRAPHICS_NORMAL );        
    break;  case 4:
    dmd.drawString( 1,0, "Wed,", 3, GRAPHICS_NORMAL );        
    break;  case 5:
    dmd.drawString( 1,0, "Thu,", 3, GRAPHICS_NORMAL );        
    break;  case 6:
    dmd.drawString( 1,0, "Fri,", 3, GRAPHICS_NORMAL );        
    break;  case 7:
    dmd.drawString( 1,0, "Sat,", 3, GRAPHICS_NORMAL );        
    break;
  }
}void drawDate()
// shows numerical date
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(dayOfMonth)
  {
  case 1:
    dmd.drawString( 20,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 20,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 20,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 20,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 20,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 20,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 20,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 20,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 20,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 20,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 20,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 20,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 20,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 20,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 20,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 20,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 20,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 20,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 20,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 20,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 20,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 20,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 20,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 20,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 20,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 20,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 20,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 20,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 20,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 20,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 20,0, "31", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawHour()
// draws the hour hand
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  if (hour>12) //Remove this if command for 24 hour time
  {
    hour=hour-12; // This is a 12 hour Clock 
  }
  switch(hour)
  {
  case 1:
    dmd.drawString( 0,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 0,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 0,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 0,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 0,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 0,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 0,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 0,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 0,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 0,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 0,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 0,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 0,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 0,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 0,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 0,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 0,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 0,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 0,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 0,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 0,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 0,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 0,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 0,0, "24", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawMinute()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(minute)
  {
  case 0:
    dmd.drawString( 12,0, "00", 2, GRAPHICS_NORMAL );
    break;
  case 1:
    dmd.drawString( 12,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 12,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 12,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 12,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 12,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 12,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 12,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 12,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 12,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 12,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 12,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 12,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 12,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 12,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 12,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 12,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 12,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 12,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 12,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 12,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 12,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 12,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 12,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 12,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 12,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 12,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 12,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 12,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 12,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 12,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 12,0, "31", 2, GRAPHICS_NORMAL );
    break;
  case 32:
    dmd.drawString( 12,0, "32", 2, GRAPHICS_NORMAL );
    break;
  case 33:
    dmd.drawString( 12,0, "33", 2, GRAPHICS_NORMAL );
    break;
  case 34:
    dmd.drawString( 12,0, "34", 2, GRAPHICS_NORMAL );
    break;
  case 35:
    dmd.drawString( 12,0, "35", 2, GRAPHICS_NORMAL );
    break;
  case 36:
    dmd.drawString( 12,0, "36", 2, GRAPHICS_NORMAL );
    break;
  case 37:
    dmd.drawString( 12,0, "37", 2, GRAPHICS_NORMAL );
    break;
  case 38:
    dmd.drawString( 12,0, "38", 2, GRAPHICS_NORMAL );
    break;
  case 39:
    dmd.drawString( 12,0, "39", 2, GRAPHICS_NORMAL );
    break;
  case 40:
    dmd.drawString( 12,0, "40", 2, GRAPHICS_NORMAL );
    break;
  case 41:
    dmd.drawString( 12,0, "41", 2, GRAPHICS_NORMAL );
    break;
  case 42:
    dmd.drawString( 12,0, "42", 2, GRAPHICS_NORMAL );
    break;
  case 43:
    dmd.drawString( 12,0, "43", 2, GRAPHICS_NORMAL );
    break;
  case 44:
    dmd.drawString( 12,0, "44", 2, GRAPHICS_NORMAL );
    break;
  case 45:
    dmd.drawString( 12,0, "45", 2, GRAPHICS_NORMAL );
    break;
  case 46:
    dmd.drawString( 12,0, "46", 2, GRAPHICS_NORMAL );
    break;
  case 47:
    dmd.drawString( 12,0, "47", 2, GRAPHICS_NORMAL );
    break;
  case 48:
    dmd.drawString( 12,0, "48", 2, GRAPHICS_NORMAL );
    break;
  case 49:
    dmd.drawString( 12,0, "49", 2, GRAPHICS_NORMAL );
    break;
  case 50:
    dmd.drawString( 12,0, "50", 2, GRAPHICS_NORMAL );
    break;
  case 51:
    dmd.drawString( 12,0, "51", 2, GRAPHICS_NORMAL );
    break;
  case 52:
    dmd.drawString( 12,0, "52", 2, GRAPHICS_NORMAL );
    break;
  case 53:
    dmd.drawString( 12,0, "53", 2, GRAPHICS_NORMAL );
    break;
  case 54:
    dmd.drawString( 12,0, "54", 2, GRAPHICS_NORMAL );
    break;
  case 55:
    dmd.drawString( 12,0, "55", 2, GRAPHICS_NORMAL );
    break;
  case 56:
    dmd.drawString( 12,0, "56", 2, GRAPHICS_NORMAL );
    break;
  case 57:
    dmd.drawString( 12,0, "57", 2, GRAPHICS_NORMAL );
    break;
  case 58:
    dmd.drawString( 12,0, "58", 2, GRAPHICS_NORMAL );
    break;
  case 59:
    dmd.drawString( 12,0, "59", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawSec()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  switch(second)
  {
  case 0:
    dmd.drawString( 24,0, "00", 2, GRAPHICS_NORMAL );
    break;
  case 1:
    dmd.drawString( 24,0, "01", 2, GRAPHICS_NORMAL );
    break;
  case 2:
    dmd.drawString( 24,0, "02", 2, GRAPHICS_NORMAL );
    break;
  case 3:
    dmd.drawString( 24,0, "03", 2, GRAPHICS_NORMAL );
    break;
  case 4:
    dmd.drawString( 24,0, "04", 2, GRAPHICS_NORMAL );
    break;
  case 5:
    dmd.drawString( 24,0, "05", 2, GRAPHICS_NORMAL );
    break;
  case 6:
    dmd.drawString( 24,0, "06", 2, GRAPHICS_NORMAL );
    break;
  case 7:
    dmd.drawString( 24,0, "07", 2, GRAPHICS_NORMAL );
    break;
  case 8:
    dmd.drawString( 24,0, "08", 2, GRAPHICS_NORMAL );
    break;
  case 9:
    dmd.drawString( 24,0, "09", 2, GRAPHICS_NORMAL );
    break;
  case 10:
    dmd.drawString( 24,0, "10", 2, GRAPHICS_NORMAL );
    break;
  case 11:
    dmd.drawString( 24,0, "11", 2, GRAPHICS_NORMAL );
    break;
  case 12:
    dmd.drawString( 24,0, "12", 2, GRAPHICS_NORMAL );
    break;
  case 13:
    dmd.drawString( 24,0, "13", 2, GRAPHICS_NORMAL );
    break;
  case 14:
    dmd.drawString( 24,0, "14", 2, GRAPHICS_NORMAL );
    break;
  case 15:
    dmd.drawString( 24,0, "15", 2, GRAPHICS_NORMAL );
    break;
  case 16:
    dmd.drawString( 24,0, "16", 2, GRAPHICS_NORMAL );
    break;
  case 17:
    dmd.drawString( 24,0, "17", 2, GRAPHICS_NORMAL );
    break;
  case 18:
    dmd.drawString( 24,0, "18", 2, GRAPHICS_NORMAL );
    break;
  case 19:
    dmd.drawString( 24,0, "19", 2, GRAPHICS_NORMAL );
    break;
  case 20:
    dmd.drawString( 24,0, "20", 2, GRAPHICS_NORMAL );
    break;
  case 21:
    dmd.drawString( 24,0, "21", 2, GRAPHICS_NORMAL );
    break;
  case 22:
    dmd.drawString( 24,0, "22", 2, GRAPHICS_NORMAL );
    break;
  case 23:
    dmd.drawString( 24,0, "23", 2, GRAPHICS_NORMAL );
    break;
  case 24:
    dmd.drawString( 24,0, "24", 2, GRAPHICS_NORMAL );
    break;
  case 25:
    dmd.drawString( 24,0, "25", 2, GRAPHICS_NORMAL );
    break;
  case 26:
    dmd.drawString( 24,0, "26", 2, GRAPHICS_NORMAL );
    break;
  case 27:
    dmd.drawString( 24,0, "27", 2, GRAPHICS_NORMAL );
    break;
  case 28:
    dmd.drawString( 24,0, "28", 2, GRAPHICS_NORMAL );
    break;
  case 29:
    dmd.drawString( 24,0, "29", 2, GRAPHICS_NORMAL );
    break;
  case 30:
    dmd.drawString( 24,0, "30", 2, GRAPHICS_NORMAL );
    break;
  case 31:
    dmd.drawString( 24,0, "31", 2, GRAPHICS_NORMAL );
    break;
  case 32:
    dmd.drawString( 24,0, "32", 2, GRAPHICS_NORMAL );
    break;
  case 33:
    dmd.drawString( 24,0, "33", 2, GRAPHICS_NORMAL );
    break;
  case 34:
    dmd.drawString( 24,0, "34", 2, GRAPHICS_NORMAL );
    break;
  case 35:
    dmd.drawString( 24,0, "35", 2, GRAPHICS_NORMAL );
    break;
  case 36:
    dmd.drawString( 24,0, "36", 2, GRAPHICS_NORMAL );
    break;
  case 37:
    dmd.drawString( 24,0, "37", 2, GRAPHICS_NORMAL );
    break;
  case 38:
    dmd.drawString( 24,0, "38", 2, GRAPHICS_NORMAL );
    break;
  case 39:
    dmd.drawString( 24,0, "39", 2, GRAPHICS_NORMAL );
    break;
  case 40:
    dmd.drawString( 24,0, "40", 2, GRAPHICS_NORMAL );
    break;
  case 41:
    dmd.drawString( 24,0, "41", 2, GRAPHICS_NORMAL );
    break;
  case 42:
    dmd.drawString( 24,0, "42", 2, GRAPHICS_NORMAL );
    break;
  case 43:
    dmd.drawString( 24,0, "43", 2, GRAPHICS_NORMAL );
    break;
  case 44:
    dmd.drawString( 24,0, "44", 2, GRAPHICS_NORMAL );
    break;
  case 45:
    dmd.drawString( 24,0, "45", 2, GRAPHICS_NORMAL );
    break;
  case 46:
    dmd.drawString( 24,0, "46", 2, GRAPHICS_NORMAL );
    break;
  case 47:
    dmd.drawString( 24,0, "47", 2, GRAPHICS_NORMAL );
    break;
  case 48:
    dmd.drawString( 24,0, "48", 2, GRAPHICS_NORMAL );
    break;
  case 49:
    dmd.drawString( 24,0, "49", 2, GRAPHICS_NORMAL );
    break;
  case 50:
    dmd.drawString( 24,0, "50", 2, GRAPHICS_NORMAL );
    break;
  case 51:
    dmd.drawString( 24,0, "51", 2, GRAPHICS_NORMAL );
    break;
  case 52:
    dmd.drawString( 24,0, "52", 2, GRAPHICS_NORMAL );
    break;
  case 53:
    dmd.drawString( 24,0, "53", 2, GRAPHICS_NORMAL );
    break;
  case 54:
    dmd.drawString( 24,0, "54", 2, GRAPHICS_NORMAL );
    break;
  case 55:
    dmd.drawString( 24,0, "55", 2, GRAPHICS_NORMAL );
    break;
  case 56:
    dmd.drawString( 24,0, "56", 2, GRAPHICS_NORMAL );
    break;
  case 57:
    dmd.drawString( 24,0, "57", 2, GRAPHICS_NORMAL );
    break;
  case 58:
    dmd.drawString( 24,0, "58", 2, GRAPHICS_NORMAL );
    break;
  case 59:
    dmd.drawString( 24,0, "59", 2, GRAPHICS_NORMAL );
    break;
  }
}void drawCol1()
{
  dmd.drawString( 8,0, ":", 1, GRAPHICS_NORMAL );
}void drawCol2()
{
  dmd.drawString( 20,0, ":", 1, GRAPHICS_NORMAL );
}void runClock()
{
 // drawDay();  
 // drawDate();
  drawHour();
  drawCol1();
  drawMinute();
  drawCol2();
  drawSec();
 // CheckAlarm();}/*void AlarmSequence() {
  drawDay();  
  drawDate();
  drawHour();
  drawCol();
  drawMinute();
  digitalWrite(Alarm, HIGH);
  delay(1000);
  dmd.clearScreen( true );
  digitalWrite(Alarm, LOW);
  delay(1000);
}
*/
/*void CheckAlarm() {
  AlarmSet = digitalRead(AlarmSetPin);
  Snooze = digitalRead(SnoozePin);
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);*/
  /* Only Trigger Alarm If it is a day listed below. This can be changed by changing the numbers to any of the following:
   1 = Sunday
   2 = Monday
   3 = Tuesday
   4 = Wednesday
   5 = Thursday
   6 = Friday
   7 = Saturday
   */
/*  if(dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5 ||dayOfWeek == 6) { //This is days ALLOWED to ring alarm
    if(hour == 18 && minute == 05 ) { //Set Time Here (In 24 hour Time) 
      if(AlarmSet == LOW) { //If alarm pin is on
        Snooze = digitalRead(SnoozePin);
        while(Snooze == HIGH)
        {
          Snooze = digitalRead(SnoozePin);
          AlarmSequence();
        }
      }
    }
  }
}
*/
void loop()
{
  runClock();  
}

Schematics

Connection
Fo5umfjjoiy0444 large wludiq7clq
Connection
F779gxljoiy044g large q63kzxm1rt

Comments

Similar projects you might like

Analog Clock with LED Matrix and Arduino

Project tutorial by LAGSILVA

  • 12,286 views
  • 8 comments
  • 39 respects

A Very Compact Alarm with Card Reader and Real-Time Clock

Project tutorial by Simone Adobs

  • 6,721 views
  • 3 comments
  • 31 respects

4-Stroke Digital Clock With Arduino

Project showcase by LAGSILVA

  • 11,103 views
  • 9 comments
  • 39 respects

Digital And Binary Clock With Two LED Matrix And RTC

Project tutorial by LAGSILVA

  • 6,117 views
  • 10 comments
  • 27 respects

Real-Time Clock Controlled Herbal Garden Watering System

Project tutorial by Maximilian Dullo

  • 6,651 views
  • 2 comments
  • 14 respects

Tiny Calendar and Clock Featuring Moon Phase in a LED Matrix

Project showcase by LAGSILVA

  • 6,075 views
  • 6 comments
  • 33 respects
Add projectSign up / Login