Introduction: Arduino Matrix Clock


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


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


* 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:

MD_MAX72XX 3.0.2:

DS3231 1.0.2:


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:




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;
   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
   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 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.