If you are into electronics, you’ve probably built a clock at some point in time – it’s a daily use thing everyone finds handy, building an accurate clock is not as easy as it seems and you have limitless options on how to actually tell the time.
I, for example, have built a clocks from 72 LEDs (both a large and a small one), a clock from Nixie Tubes (and I am currently building another one), multiple clocks with seven segment displays and also a clock from 3 analogue voltmeters.
One of the very intriguing types of clock missing from the list above is the so called “WordClock”. Basically speaking, it’s a clock which lights up different letters to spell the current time. This type of clock looks amazing, but it has two disadvantages – it takes a lot of work to put it together, and it’s almost impossible to create the diffuser for the letter outlines without a laser cutter. That’s why I was reluctant to start such a project.
But then I saw that someone used a PCB as the actual diffuser, and that really sparked my interest. Given the cheap prices of PCBs from China, you can dedicate an entire 100×100 mm board to the diffuser and another one to the LED array for a couple of dollars.
So that’s what I’ve done. I’ve created the “letter shade” or “diffuser” in Eagle, basically the top side is fully filled with a copper and soldermask – except the “cutouts” for the letters. This can be simply done by filling the entire board with a copper polygon and drawing the letters on the tRestrict layer. The same applies to the bottom side, except instead of letter shapes, I used rectangles.
Another crucial part of a WordClock is the light source. I really wanted to avoid soldering 144 individual LEDs, but I just haven’t found any pre-made matrixes that would fit this project. So I ended up soldering all of them by hand, next time I’d probably use some assembly service. As I driver, I chose the MAX7219, which can drive up to 64 LEDs, so there are three in total. Then I laid out all 144 LEDs in Eagle – using some tricks with the grid tool made this relatively quick – and then used the autorouter to route it.
The last board to draw was the RTC board, which keeps track of time, does all the WordClock logic and sends data to the MAX7219 drivers. There were two reasons why I did not incorporate this into the LED array board – there wasn’t enough space and also I wanted to use this RTC boards in a different clock project. Firstly, I designed a board with the classical DS1307 RTC chip with a 32 kHz crystal. I added an STM32F030F4P6 32bit MCU, some supporting circuitry and this is what I was left with:
However, I couldn’t get the RTC to run accurately. No matter what I did, it was faster by about 5 seconds a day. Which is 58 ppm! While this might not seem like much, this inaccuracy quickly adds up and you gain an error of 1 minute every 12 days.
I still don’t know why was the crystal running faster – the DS1307 has integrated 12pF load caps for the crystal, so I used 32.768 kHz crystals designed for 12 pF of capacitance (I even bought a new set of these from a trusted source). I even tried desoldering the two crystal IOs and soldering the crystal directly to these two pins to avoid any trace capacitance, but again, no luck, it was still running too fast.
So either my DS1307 was somehow faulty or there is something I am missing (which is possible). So, being frustrated by that, I decided to screw this idea and use a different approach to timekeeping:
Yes, that is an ESP8266. Since this clock is meant to be stationary anyways, why not use an ESP, connect to WiFi and get a very precise time from NTP (Network Time Protocol)? Because I used the ESP-12E, I could also connect the MAX7219 inputs directly to this processor, thus avoiding the need for the STM32 and simplyfying the whole board.
The code on the ESP is not complicated – I used one of the ESP8266’s examples, removed a lot of the unnecessary stuff and added the function I wanted.
I am happy with the result – it didn’t take that much work and it looks really cool. I’m still puzzled as to why didn’t the damn crystal-based RTC work more accurately, but in the end, the ESP8266 is probably a better solution anyways. Just out of curiosity, I measured the current it’s drawing: 0.55 A max (all letters on), 0.17 A on average (but again, it depends on what’s currently shown).
Everything can be found on my GitHub. And here are the schematics in picture form:
Update 08/20: after running non-stop since May, some of the LEDs started showing burnout effect, ie. their brightness decreased. For that reason, I lower the drive current by incresing the set resistor to 16.2k (10k and 6.2k in series).