Stylish Binary Wall Clock
2016-07-19 | By John Wittington
License: None Arduino Raspberry Pi
A binary clock is a type of clock that utilizes binary format to display the time of day. For this project we build a binary clock that works using either an Arduino or Raspberry Pi.
The circuit of this project is quite easy. Almost everything is done by the MCU core so very little interfacing with other components is necessary. For the schematic, we only need a microcontroller, which is the heart of the project, the LED chain that will light up the clock and a DS1307 RTC module.
Since most of the work resides with the MCU we’ll be talking mostly about the codes for each. For the hardware, be sure that you have everything properly connected as shown in the schematic and you should be all set.
Arduino
The program creates a 4-element array, or binary nibbles, for each clock digit. One can then loop through each binary nibble and use a bit-shift on each bit to set the pixel ON or OFF (there are twice as many “for” to allow the clock to scale and fill any size matrix). Wiring an LED matrix creates a snakes and ladders index, which is difficult to reference without a map. The binary nibbles are created using bit-wise comparison on the decimal digit.
Raspberry Pi
If you get the Arduino working, you can port the project to Raspberry Pi using Pimoroni’s Unicorn Hat. Since we already used Arduino Make makefile, we have a header with the declarations. The main changes were made to the GPIO functions to actually set the matrix. Fortunately, there is WS2812 Driver with the same functions as the NeoPixel library, so it wasn’t too difficult. Rather than referencing the pixel objects, the functions are directly called, since it’s straight C. Unicorn Hat is an 8×8, so it allowed us to check that the scaling works.
The binary clock only needs a 4x4 setup. You can use any material or build you like - the material is only limited by your imagination! However, do make sure to follow the schematic diagram. Upload the code, and you are good to go.
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum