Unix Time Clock

Dillon Nichols
My Life as a Tinkerer
6 min readMay 3, 2018

I remember hearing about the Unix time transition to 1500000000 and I stayed up to watch the seconds tick over from 1499999999. Of course, that was on a computer screen, but ever since then, I wanted a hardware clock that displays the current Unix time in decimal. Since then I’ve had various ideas on how to make it, including one idea where I use a high pin count FPGA and all of the 7 segment displays I have on hand to rig something up, but asdI found the Super 7 Seg Kit by Maniacal Labs, I knew it was the perfect project to fork into my own. This post will explain what I needed to modify to fulfill my dream.

Too many digits? No problem. Just cut them off! Or maybe there’s a better way? 🤔

It currently takes 10 digits to display the Unix time in decimal (and it won’t roll over to 11 digits for a few hundred years), so I didn’t need the full 12 digits that the kit has. I originally planned on just cutting off the right 2 digits from the PCB so I’d be left with 10 digits, but decided against it mainly because I wanted to redesign the controller board to better suit my needs. The original controller board is driven by a serial connection, so at the very least I’d need to connect it to a PC to generate the time for the display. I thought about mounting a Raspberry Pi Zero to it, but at that point, why don’t I just drive the display from the Pi itself? This may be possible, but I thought I didn’t need an entire operating system to display the time so I looked for other devices that might do the job. My requirements were that the chip:

  1. Is powered by+5V USB connection
  2. Connects to WiFi to get the time
  3. Has enough pins to drive the displays

I’m sure there is a multitude of gadgets that fit these requirements, but I settled on the ESP32 chip mounted on the ESP-WROOM-32 development board. As an added benefit the ESP32:

  1. Is programmed in the Arduino Environment (allows quick and easy bring up)
  2. Has dual cores (can handle WiFi connection with one core, and control the display pins with the other core)
  3. Has hardware timers (can set a one-second timer and change the time on the display accurately when the timer expires)
  4. Has plenty of PWM-capable pins (can control the brightness of the display)

As I mentioned earlier, I went about modifying the boards from the Super 7 Seg project in KiCad. The display board was simple enough — delete a display and the traces going to it. I also added more mounting holes in the original style because I wasn’t sure how I was going to mount it at the time. Next up, I redesigned the controller board. I kept the board to board connection and the ULN2003A IC that is used to provide the digits with higher current than a GPIO pin can offer. I made a footprint for the ESP32 module and added it to control the board to control the displays. I made another post about how I used TopoR to autoroute this PCB:

All of my changes are in my GitHub repository here: https://github.com/dwaq/Super7Seg/

Then what the ‘I’ in GPIO stand for?

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. This isn’t an issue for my design, but it may be problematic if someone wanted to display something else using this display. I have modified the KiCad file on my GitHub to match the changes I needed to make on my board. Also, although I’m only controlling 10 digits on my display, my controller board does support controlling the original 12 digit display made by Maniacal Labs (albeit without the decimal points).

Controller and Display schematics

Onto the control… The Firmware-ESP32 directory contains my code. As it works now, it does the following:

  1. Sets up the pins as PWM outputs to control the display (currently set at full brightness)
  2. Creates a background process on another core to connect to WiFi and get the time
  3. Until the time is received, it displays an animation on the screen
  4. 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.
  5. After the time is received from an NTP server, it continuously displays the time. It reads the time via the “time.h” header.
  6. 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.

I designed a bracket in Fusion 360 and 3D printed it to mount this project to my desk. The dimensions were way off so I had to hack it up for it to work (as you can see). Since then I edited the files to match my modifications, but I haven’t printed it again to make sure it’s perfect now. My CAD files are in theMount-ESP32 directory on GitHub.

I’m happy that I finally have a physical design for something that I dreamed of so long ago. As great as this display is, there is a certain amount of dread from watching the digits count up forever and never seeing the same time twice. Other than that, it turned out exactly like I planned and I’m very glad that Maniacal Labs shared their original design so I could develop my idea from it. When discussing this project with them, they mentioned that they have a binary epoch clock — check it out if you’re interested! I don’t have any more PCBs, but I do have parts for two more displays and controllers, so if you’re interested in building one of these for yourself, reach out to me and I’ll send you the parts for a discounted rate.

--

--

Dillon Nichols
My Life as a Tinkerer

Electrical engineer: hardware/firmware; tinkerer; hobbyist; amateur fabricator;