Introduction: Matrix-Clock

Hello at this Instructable! In this Instructable i´ll show you how I build a prototype of a clock, that uses a matrix which consists of 288 Neopixels. First I want to say sorry for my english because I´m from Germany. I got the idea to this clock because I recently got some nes and snes games from a friend and when my old clock broke, I thought, that a clock in Retrolookwould be nice. for me, pixels and matrixes are retrolike, so I wanted to build a matrix-clock. I also wants to say, that this is just a prototype and I´m already programing an other version with WLAN, so that the clock gets the time from the internet, gives notifications about for Example new Mails and can show you how many subs you have on YouTube or how many Followers on Instagram. I´m also 3D-modelling a case for the clock.

I´ll update this project when the 3D-modells are finished or i´ve made a new version of the Code.

If you like the project, it would be nice, if you could vote for me in some Contests.

Step 1: Functions

F1 = Pin 11; F2 = Pin 12; OK = Pin 10; Mode Plus and Mode Minus = Pin 8 and 9

The clock has many differet functions:

If you start the clock, you will see a clock with hours, minutes and seconds.

When you press button OK you will see a different clock with an animated clock icon. An other press on OK and you´re back to the first clock. When you´re seeing one of the clocks and press button F1 or F2 you will see the date (day, month and year or day, month ant the animated clock icon).

When you press the F1 and the F2 at the same time, you can set an alarm: plus and minus with F1 and F2; change to the next number with OK. With another press on F1 and F2 you save the time and with a press on ModePlus and ModeMinus at the same time you will activate or deactivate the alarm. (Alarm is on if there is a yellow Rectangle at the bottom left).

When the alarm goes on, you will see the matrix flashing and hear a beeping. Now you can deactivate the alarm with a press on OK.

Whith the ModePlus and ModeMinus Buttons you can change between the clock, a stopwatch and a timer.

The stopwatch (yellow icon) gets started and stoped by a press on OK. You can reset it by pressing F1 and F2 at the same time.

You can configure the timer by pressing F1 and F2 at the same time. Now you can set it like the alarm and start and stop it with a press on OK.

Step 2: Required Materials

To build the matrix-clock, you will need the following:

  • 2 meters Neopixels (WS2812B) (144 LEDs per meter)
  • an Arduino (I tested the Code with an Uno, a Leonardo and a Mega)
  • some buttons (at least 5)
  • a RTC Modul
  • a buzzer
  • wires
  • glue
  • duct tape
  • cardboard

Step 3: Wiring

Connect VCC and GND of the RTC Modul to 5V and GND of the Arduino.

Connect SDA and SCL from the RTC Modul to the specific SDA and SCL Pins on your Arduino.

Connect the buzzer to Pin 5 and GND of the Arduino.

Connect the buttons to pin 8 to 12 and GND of the Arduino.

Connect the Data Pin of the Matrix to Pin 6 on your Arduino.

Connect GND from th matrix to GND of the Arduino.

You can connect the 5V Pin of the matrix to the 5V Pin of the Arduino, but then you musn´t set the brightness of the matrix to light, bvecause then the matrix will draw to much curent. I connected it to VIN on my Arduino, but then there musn´t be more then 5V on the Input.

Step 4: Building the Matrix

You can build the matrix in different ways:

Just build it so that there will be an 36x8 matrix.

Depending on how you build the matrix, you will need to adjust the Code.

Step 5: Adjusting the Code

on the first rows of the Code you can adjust some points:

31.: Here you can ajust how lould the buzzer should be, whe the timer is over.

34.: Here you can ajust the Brightness of the matrix.

41.: Here you must say where your first pixelis on the matrix:

First you say if the pixel is at the top or the bottom (NEO_MATRIX_TAP or NEO_MATRIX_BOTTOM)

Then you say if the pixel is right or left (NEO_MATRIX_RIGHT or NEO_MATRIX_LEFT)

42.: Here you must say how your matrix is disposed:

First you say if the Strips are in rows or colums (NEO_MATRIX_ROWS or NEO_MATRIX_COLUMN)

The you say if the Strips are zigzag or all in one direction (NEO_MATRIX_ZIGZAG or NEO_MATRIX_PROGRESSIVE)

43.: Here you must say what kind of pixels you are having.

Step 6: Enyoy

First you will need to load the SetTime Example.

Now you only need to uploard the Code below and everything should work fine.

If you have some problems or questions write it in the coments.


marcelh32 (author)2017-06-23

Dear Jens,

Ive stumbled upon your work and I have a question about it. I am using also a matrix with ledstrips but the size is 32x8 when I uoload the code and made the changes within the programm about the size the last digits won't show. So I guess is has to do with the size of the digits how do I change it?

Regards Marcel

Jens_2002 (author)marcelh322017-06-25

The code is made for a 36x8 and not for a 32x8 matrix, so your matrix wont work with the code.
Of you could make me some 4x8 icons for a clock, a timer etc., I could change the code a bit, that parts of it schould work with your 32x8 matrix.

marcelh32 (author)Jens_20022017-06-26

Hi Jens,

I was looking at the code to try to tweak some parameters, but I cant find where to chance it, Ive looked and tweaked lines 313-388 in the code but no change in mine matrix, good you give me some pointers (or change it yourself :) ) where I have to look

Regards Marcel

Jens_2002 (author)marcelh322017-06-26

What kind of matrix are you using?
Could you send me a link?

marcelh32 (author)Jens_20022017-06-27

DIY led matrix with ws2812b ledstrips, bought 5mtrs of ledstrip and cut it in lenght of 32 leds

Jens_2002 (author)marcelh322017-06-27

If you could build an other matrix(4x8), I could add some code, so that the matrix should work. The problem is, that I made the code for a 36x8 matrix.
Could you tell me how the LEDs are arranged in your matrix and how many LEDs you've got unused?
Then I could tell you, how to "fix" the too small matrix.

marcelh32 (author)Jens_20022017-06-27

Ive got the leds arranged just like you "snake" but is it not possible to change the width of the digits for example 4 leds wide


"-" = space; ":" = dots; "x" = digits

If I count correctly its 32 pixels wide, is it possible? and where in the code must I look for changing the width of the digits

Jens_2002 (author)marcelh322017-06-27

I am using the Adafruit GFX Library, and every symbol is at least 5x8 pixels. But I've got an idea how to change it, that it also should work on a 30x5 matrix.
Are there any functions that you don't really need? Then I could try to rewrite some parts in the code.

marcelh32 (author)Jens_20022017-06-27

I don't care for the round clock ,if its possible I just want to display the time with the seconds counting on the "main Page"

Jens_2002 (author)marcelh322017-06-28

Would this be ok?
If yes, I would look at the code again one time, to rewrite some bugs.

marcelh32 (author)Jens_20022017-06-29

Looks fine by me. I see that the your first code displays the digits on a different way then your second