At the end of June 30 this year, a leap second will be inserted (just before midnight UTC), making this day one second longer than normal.
I want to build a clock which will actually display the leap second, so I can watch it happen.
I thought about various unconventional ways to display time, but settled on building an ordinary digital clock with 7-segment LED displays.
To show the leap second, it needs to be accurate (keeping correct time, not drifting out of sync with other clocks) and precise (displaying seconds, keeping time to within a second). And it needs to keep track of the current date, and know the time zone and the dates of leap seconds, to insert an extra second at the right time.
To manage all this I’ve chosen to use an ESP8266, which is a cheap programmable microcontroller with built-in Wi-Fi. I’ll implement SNTP (Simple Network Time Protocol, a simple subset of NTP) so it can receive the correct current time and upcoming leap second information from a public NTP server. The ESP8266 will drive the LED displays using a series of shift registers and ULN2003 transistor arrays.
I don’t have a plan to build a case (yet); I’m just going to make a PCB (printed circuit board) and solder components to it.
I imagine it’ll look something like this. (Not to scale, and I’m not really sure of the size yet.)
Progress so far
Components and circuit design
Based on my vague idea of how the circuit should work, I bought some components from element14 to experiment with, and a couple of ESP8266s and a serial programming cable for them from eBay.
I realised I’ve bought displays with a common cathode connection, and I’ve bought ULN2003 chips which can only drive displays with a common anode connection. So after I’ve experimented more with the hardware and drawn a schematic that should work, I’ll buy common-anode displays and anything else I missed the first time.
I’m using KiCad to draw schematics and design PCBs. I haven’t used it before; I’m learning.
I considered getting the boards manufactured somewhere like dirtypcbs.com, but my board will need to be wider than their cheap 10cm×10cm prototypes. If I can make the boards myself, it may be cheaper, and I’ll have a quicker turnaround time to correct mistakes.
I have a laser printer; I need to buy some copper-clad board and chemicals and experiment with etching.
The ESP8266 will have to connect to my Wi-Fi network, get an IP address using DHCP, find an NTP server using DNS, and request the current time. I’ve read a bit about NTP but haven’t written any of the software yet.