The hardware is a fork of the Maniacal Labs Super 7 Seg Kit. I really liked their design, but didn't need all 12 digits. I could've just cut off a display, but I also wanted to change the controller, so I modified their design to only fit five two-digit displays. Their controller was set via serial, would would require some other method to set the time anyways, so I completely redesigned that board to use an ESP32. It was perfect because it's powered by +5V USB, connects to WiFi to get the time, has enough pins to drive the display (more on that later), is programmed via Arduino (which actually be a downside after spending so much time messing with the software), has dual cores (one for WiFi, the other for controlling the display), hardware timers for accurate time keeping, and PWM pins to control the brightness of the display. I wrote a separate post about how I used TopoR to autoroute this PCB.
When I received the PCBs, I started writing code and realized I had made an error on the controller board. Although the documentation refers to pins 34 and 35 as “GPIO”, they are input-only. I didn’t have any extra output pins on the board, so I was forced to remove the decimal point pins.
My software was written using the Arduino environment. I thought this would make it more simple, but the lack of debugging really hindered me as I dug deep into the internals of this chip. A simple breakdown of my software is as follows:
- Sets up the pins as PWM outputs to control the display (currently set at full brightness)
- Creates a background process on another core to connect to WiFi and get the time
- Until the time is received, it displays an animation on the screen
- Here's the important part: it waits until the moment that the second changes to being displaying the time. After the time is initialized, it will continue to be aligned forever.
- After the time is received from an NTP server, it continuously displays the time. It reads the time via the "time.h" header.
- A one-hour hardware timer kicks off a function so that the device reconnects to the internet and re-synchronizes to the current time to prevent any drift.
This video shows the completely synchronized time in the newest code:
I also designed and 3D-printed a simple mount for this board so I can mount it to my desk.
This description was condensed from my original blog post on the project.