Arduino Matrix Clock

18,612

17

70

Introduction: Arduino Matrix Clock

Description:

Build your clock using an Arduino, a matrix display, and a Real Time Clock (RTC) module. This is a fun and simple project which I feel is great for beginners. The clock uses the RTC module to accurately track time as well as the day, month, and year. In addition, the module has a built-in temperature sensor. You can learn more about the DS3231 module here as well as the I2C communication bus used for it here. Lastly we will use a Dot Matrix Display to of course, display the time, day of the week, month .etc. You can more about the display here and the MAX7219 IC driver in the datasheet below.

You can also download the pdf version for this project here. It's virtually the same as this instructable.

[UPDATE: 2/22/19] Don't use the pdf guide, I've updated this instructable but those changes are not yet reflected on the pdf.

Step 1: Gather Components

The components you'll need for this project:

In addition, you’ll need an Arduino of any kind (preferably a Nano to minimize the size of the project), a breadboard, jumper wires as well as the Arduino IDE installed on your PC.

Step 2: Libraries

<br>

Download the following libraries and install the .zip file to the Arduino IDE by going
to Sketch > Include Library > Add .Zip library

NOTE: THE VERSIONS MATTER!!!

* Verify that you have the correct versions before downloading. I'd recommend downloading each library within the Arduino IDE to be on the safe side.

MD_Parola 3.0.1: https://github.com/MajicDesigns/MD_Parola

MD_MAX72XX 3.0.2: https://github.com/MajicDesigns/MD_MAX72XX

DS3231 1.0.2: https://github.com/NorthernWidget/DS3231

Alternatively,

In the Arduino IDE go to Sketch > Include Library > Manage Libraries and in the search bar type: “MAX72XX” and you should see the following (See image):

Install only MD_MAX72XX and MD_Parola. MD_MAXPanel is NOT needed.

Step 3: Testing Your Components

After Installing the libraries, test your components individually to ensure that they are working as they should. Please follow these steps before wiring everything together.

To test DS3231 RTC Module, Connect the DS3231 to the Arduino (see Wiring below). Then in the Arduino IDE, go to Files > Examples > DS3231 > DS3231_Test and upload the sketch. Open the Serial Monitor and check to see that you’re getting the correct date, time, day .etc.

To test the matrix display, first connect it to the Arduino (see Wiring below). Next, in the Arduino IDE, go to Files > Examples > MD_Parola > Parola_HelloWorld and upload the sketch. You should see HELLO printed on the display and it may or may not be printed backwards. If the text is backwards then you must change the following line:

#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW

To

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW

Upload the sketch again and the problem should be resolved.

Now that we’ve tested our components, we are ready to wire everything together!

Step 4: Wiring

Refer to the diagram or schematic or table

Step 5: CODE


Get the code here

Note: I used a code originally by Electronic Projects but modified it to support current (at the time of completion) libraries.

Clock Features:

The clock is automatically set to tell time in 24hr format but it can be easily changed to 12hr. The clock will also display the temperature (both in Celsius and Fahrenheit). I've also included a feature called 'Sleep Mode' which is set to "OFF" (See Sleep Mode below for details).

12hr Format: To set the clock to tell time in 12hr format, you'll have to comment line 88

hour =Clock.gethour(h12,PM); //24hr Format 

And uncomment lines 93 through 100

if (Clock.getHour(h12,PM)>=13 || Clock.getHour(h12,PM)==0) 
{
   h = Clock.getHour(12,PM) - 12;
}
   else
{
   h = Clock.getHour(h12,PM);
}

Sleep Mode:

This is a feature that helps reduce the brightness of the clock particularly during the hours in which we are asleep. I don't think you want to wake up in the middle of the night and by blinded by this clock. It is very bright even when it's at the lowest setting. To enable sleep mode, uncomment lines 177 to 184

if(h == 12 || h<8) //Time intervals (in this case, from 12AM to 8AM)
{
   P.setIntensity(0); //Set display brightness to lowest setting
}
   else 
{
   P.setIntensity(6); //Set display brightness to 6 (15 is the brightest)
}

Note: I've come across an issue when using sleep mode while the clock is set to 12hr mode. You'll notice that it will run twice a day since 8am and 8pm are interpreted both as 8. So if you set Sleep Mode to be active from 9pm to 7am, then it will also be active from 9am to 7pm. HOWEVER, this issue does not occur if the clock is set to 24hr mode.

Step 6: Conclusion

Congrats!!! You have a working clock. This is how mine turned out [Clock Gallery]. I hope that you not only learned a little bit more about components and coding, but that you enjoyed the journey getting there. Please share with me your thoughts on this guide over at anthotroncis@gmail.com. This is in fact my first project guide and hoped it served you well. I hope to create many more guides. In addition, if you have any questions, suggestions, and/or improvements on the project, feel free to message me.

10 People Made This Project!

Recommendations

  • Space Contest

    Space Contest
  • First Time Author Contest

    First Time Author Contest
  • Back to School: Student Design Challenge

    Back to School: Student Design Challenge

70 Comments

0
LuisS268
LuisS268

Question 5 weeks ago

Hello, i made this clock, but i have a problem, after one week using, every monday instead showing "Monday", it shows some wierd characters, but then the rest of the week it write them ok, it is just monday. any idea why?

0
deaconefrost
deaconefrost

9 months ago

hi there.
finally found clock which works with DS3231. I have compiled all and it is working fine.
have you got any idea hot wo add seconds? i how to change brightness?

I will probaby plase it in oak box with phone stand and it will look cool!!

would be great if you would help.

0
wilcox
wilcox

Question 1 year ago


Please, someone knows how to set the clock an date?

0
sertanari
sertanari

Answer 1 year ago

i set the time and date with this code. then uploaded the clock code.
/*
https://somtips.com
https://youtube.com/somtips
*/
#include <RTClib.h>
#include <Wire.h>
RTC_DS3231 rtc;
char t[32];
void setup()
{
Serial.begin(9600);
Wire.begin();
rtc.begin();
rtc.adjust(DateTime(F(__DATE__),F(__TIME__)));
//rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
void loop()
{
DateTime now = rtc.now();
sprintf(t, "%02d:%02d:%02d %02d/%02d/%02d", now.hour(), now.minute(), now.second(), now.day(), now.month(), now.year());
Serial.print(F("Date/Time: "));
Serial.println(t);
delay(1000);
}

0
jeffrey.j.dsilva
jeffrey.j.dsilva

Reply 11 months ago

This code worked perfectly for me first try and saved me a lot of frustration!! Thanks a lot!!

0
AnirbanD21
AnirbanD21

Reply 1 year ago

I used this code only 7 minutes delay showes on watch. Unablento understand. In serial monitor two times coming one is my Pc time another is the 7 minutes delay time but daye is ok. How to rectify.

15904756714458002747951645840975.jpg
0
klpdharmawardhana01

I made it. But i get tiny problem. Today is 5th july 2020 sunday. But my clock shows 5th july 2020 "monday". How can i fix it? Please help me......😕😕😕😕

0
fpvGustl
fpvGustl

1 year ago

hi @ all!
and thank you for this building - its very cool
PLEASE is it possible to show ONLY THE TIME??
do not need Temp and Date!
thx in advance

0
willi4mM
willi4mM

Reply 1 year ago

I have the same question

0
Ardudroid4869
Ardudroid4869

Question 1 year ago

How do to change the clock and date year. Thank you

1589562222412329395438149137214.jpg
0
Martin T
Martin T

1 year ago

I keep getting this fault every time i try to upload #include "Font_Data.h"
i have done everything to the letter as far as i can see, making sure i am using the right release1.2.0 etc.

The Hello code works fine

any help would be appreciated.

Martin

0
AnirbanD21
AnirbanD21

Reply 1 year ago

I have also getting same problem...PLEASE admin need you help.

0
bobw39
bobw39

Reply 1 year ago

Make sure your project .ino (in this case Matrix_Clock.ino) file is in the same folder as Font_Data.h both should be in a folder called Matrix_Clock. If they are not close the IDE and move the files to the folder (Make one if you have too) and run it from there.

0
AnirbanD21
AnirbanD21

Reply 1 year ago

Now I made this but Time and date is not correctly showing. Date showing 1 Jan 2000, Monday. But in calendar 1vJan 2000 is Saturday.I don't know how this time and date is getting. Please help me. I tried to change in serial but couldn't.

0
bobw39
bobw39

Reply 1 year ago

Make sure your project .ino (in this case Matrix_Clock.ino) file is in the same folder as Font_Data.h both should be in a folder called Matrix_Clock. If they are not close the IDE and move the files to the folder (Make one if you have too) and run it from there.

0
BarzanM1
BarzanM1

Question 2 years ago

how i can #include "Font_Data.h"clude

0
bobw39
bobw39

Answer 1 year ago

Make sure your project .ino (in this case Matrix_Clock.ino) file is in the same folder as Font_Data.h both should be in a folder called Matrix_Clock. If they are not close the IDE and move the files to the folder (Make one if you have too) and run it from there.

0
AnthoTRONICS
AnthoTRONICS

Answer 2 years ago

You can download the file by clicking on the get code here link in step 5. There you can download the code as well as the Font_Data.h or just copy the code. Make sure that when you open the Matrix_Clock.o file that you see both files like so

1.png
0
dancopy
dancopy

1 year ago

Cool design! A suggestion: make that same Watch but, controlled with IR Remote Control; Thanks

0
sertanari
sertanari

1 year ago

hi. i made this project and changed clock and temperature fonts but couldnt change date and day fonts. any idea? (i changed temp and clock font at Font_Data.h but it didnt affect day and date. also changed MD_MAX72xx_font.cpp but nothing changed.)
Font_Data.h changes:

5, 255, 255, 129, 255, 255, // 48 - '0'
4, 130, 255, 255, 128, // 49 - '1'
5, 251, 251, 137, 207, 207, // 50 - '2'
5, 195, 203, 137, 255, 255, // 51 - '3'
5, 15, 15, 8, 255, 255, // 52 - '4'
5, 207, 207, 137, 251, 251, // 53 - '5'
5, 255, 255, 137, 251, 251, // 54 - '6'
5, 3, 243, 249, 31, 15, // 55 - '7'
5, 255, 255, 137, 255, 255, // 56 - '8'
5, 207, 207, 137, 255, 255, // 57 - '9'


5, 255, 255, 9, 255, 255, // 65 - 'A'
5, 255, 255, 137, 255, 118, // 66 - 'B'
5, 255, 255, 129, 195, 195, // 67 - 'C'
5, 255, 255, 129, 255, 126, // 68 - 'D'
5, 255, 255, 137, 203, 195, // 69 - 'E'
5, 255, 255, 9, 11, 3, // 70 - 'F'
5, 255, 255, 129, 251, 251, // 71 - 'G'
5, 255, 255, 8, 255, 255, // 72 - 'H'
4, 129, 255, 255, 129, // 73 - 'I'
5, 224, 227, 129, 255, 255, // 74 - 'J'
5, 255, 255, 24, 255, 231, // 75 - 'K'
5, 255, 255, 128, 192, 192, // 76 - 'L'
5, 255, 254, 12, 254, 255, // 77 - 'M'
5, 255, 255, 3, 255, 255, // 78 - 'N'
5, 255, 255, 129, 255, 255, // 79 - 'O'
5, 255, 255, 9, 15, 15, // 80 - 'P'
5, 63, 63, 33, 255, 255, // 81 - 'Q'
5, 255, 255, 9, 255, 246, // 82 - 'R'
5, 207, 207, 137, 251, 251, // 83 - 'S'
6, 3, 1, 255, 255, 1, 3, // 84 - 'T'
5, 255, 255, 128, 255, 255, // 85 - 'U'
5, 63, 127, 192, 127, 63, // 86 - 'V'
6, 255, 127, 48, 48, 127, 255,// 87 - 'W'
5, 227, 247, 8, 247, 227, // 88 - 'X'
5, 207, 207, 136, 255, 255, // 89 - 'Y'
5, 227, 243, 153, 207, 199, // 90 - 'Z'

IMG_20200107_113721.jpg