Arduino LED matrix binary clock

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.

Air quality,2,Arduino code library,2,Arduino projects,23,Buggy,1,Casual stuff,1,ESP8266,2,MikroElektronika,3,PIC projects,7,Review,26,Robots,1,Tutorial,20,
Electronza: Arduino LED matrix binary clock
Arduino LED matrix binary clock
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content