The "Time Machines"
From the 4000-series to Embedded Systems
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
After learning embedded programming (with the 8051 series) using assembly language, I built another clock using the obsolete AT89C2051.
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.
It is reasonable to expect that I would do more than just rebuilding it, considering how costly (in time) my undergraduate education in the past six years was.
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.
Just when I thought I had found a use of the maths learned in school, I read that the pair of small caps that I have always omitted in crystal oscillator circuit are essential for the operation of the crystal in terms of clock accuracy. It will work even without the small caps, but this is a rare occasion where time accuracy is essential. No measurable clock drift was found after the two caps were installed.
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).