It all started when I got a photocopy of a Motorola 4000-series data book from my mentor in high school. My first electronics project was building a digital clock, pictured below (the big transparent box):
Sizes of clocks following the "Moore's Law"
Right after I completed the first clock, I had enough soldering skill and confidence to build a truly "desktop" version. The newer one is shown in the picture above (the small black one on top).
Soldering "glue logic" chips on proto-boards was a pain
A clock built using a microcontroller
An attempt to build yet another clock using printed circuit board (PCB).
It was etched using copper (II) sulphate solution, obtained from a local store that sells aquarium fish.
I have been using the clock I built back in 2006 for over six years now. It has been running on my wall without problem, until recently I noticed some LEDs on the segment display do not turn off fully.
The microcontroller used (AT89C2051) is obsolete; Windows 7 has no driver for my parallel programmer for the chip; I could not understand the assembler code I wrote six years ago (not worth the trouble). So I rebuilt the circuit for an Attiny2313 and rewrote the program in C. Here's a video of it under test:
I also replaced the push button with a reed switch, so now I can adjust the time using a magnet instead of pushing the boring (and not so reliable) button. I thought about using a mercury switch, but then realized that I can't tilt the clock once it's mounted on the wall.
Knowing how to do least square fitting, I can run the clock for a day or two and record the clock drift with respect to another clock (my iPhone 4s). Together with a little MATLAB magic, I can compensate for clock drift in software. The graph shows the clock skew (203 us/s) and the initial clock offset (0.77 s) between my clock and my reference clock.
This new "C clock" is not as accurate as the "Assembler clock" it replaced, even though they both use the hardware clock of the uc. It lags ~2 minutes after running for eight months (-6 ppm). This is still well below the tolerance of the crystal oscillator (30ppm) though.
I can't think of a cost-effective offline solution to improve the time accuracy further. NTP and GPS limits where I can put the clock (near window / Ethernet socket).
Stanley Lio >