Arduino LED matrix binary clock

Jan 22, 2019 0 comments

Last days I revisited some older projects on the blog looking for a source of inspiration, and I realized that I did not publish too many clock projects. Well, it’s time to fix this: today I will show you how to make a binary clock using one Arduino Uno, and one Arduino Uno Click shield, one 8×8 LED matrix B click and one RTC2 Click from MikroElektronika.

As usual, when working with MikroElektronika click boards, the hardware part is deceptively simple: attach the Arduino Uno Click shield on top of the Arduino Uno board. Put the 4×4 B click in mikroBUS socket #1. Put the RTC2 click into mikroBUS socket #2. That’s all. Both click boards are designed to run on 5V power, so there’s no need to change jumpers and such.

Binary clock Arduino code

As prerequisites, besides the hardware, one has to install the following code libraries:

  • LED Control library from This is the library that works best with the 8×8 B click — it’s the same library I used before, in the game of life project.
  • DS1307 RTC library from There are many libraries available for the DS1307, but this project requires one library that “knows” how to configure the RTC for SQW output.

The code comes in two flavors, one that shows one binary value for each digit of the hour, minute and seconds respectively; the other version shows each of the hours, minutes and seconds as a single binary value.

Both version will update the RTC values when the program is compiled and uploaded, so there is no need to set the time separately. Then, the RTC is configured to output an 1Hz square wave on its INT pin — that corresponds to pin D3 on the Arduino Board.

In the Arduino code, an interrupt is generated every second. The ISR routine sets the is_second variable to “true”. In the main loop, the value of this variable is tested and, if true, the LED matrix is updated and the is_second variable is cleared.

The main difference between the two codes is within the update_display() routine that updates the LED matrix.

In the first version, each of the hours, minutes and seconds is split into two digits, one for the tens and one for the units. A look-up table is used to convert those values into meaningful binary values that are then shown onto the LED matrix.

In the second version of the code each of the hours, minutes and seconds are shown as a single binary value. Again, a look-up table is used to convert time into meaningful binary values. However, in this version, the look-up table is much larger because the possible values now range between 0 and 59.

Related Posts


{{posts[0].date}} {{posts[0].commentsNum}} {{messages_comments}}


{{posts[1].date}} {{posts[1].commentsNum}} {{messages_comments}}


{{posts[2].date}} {{posts[2].commentsNum}} {{messages_comments}}

Contact Form


Email *

Message *

Recent Comments