Vetinari's clock

Lord Vetinari is a fictional character in Terry Pratchett's Discworld series. In his waiting room, he installed a clock which produces an irregular ticking and nevertheless keeps a perfectly accurate time. This is a real life realization of this clock. The seconds hand is irregular but in average the clock keeps on time.

Principle of operation

This project is based on an analog clock driven by a quartz oscillator. In this kind of clock, the timebase is produced by a quartz oscillating at 32768 Hz whose frequency is halved 15 times to produce a 1Hz signal. This signal drives a solenoid which moves the seconds hand of the clock. We just need to drive directly the solenoid from a microcontroller to make the time pass at the pace we want.

Principle of operation of the clock.

The microcontroller which drives the clock is a MSP430G2211 from TI. It has several features which make it a perfect fit for this kind of project :

The firmware is extremely simple, an interrupt is triggered by a 32768 Hz quartz oscillator which wakes the µC up every 1/64th of a second. The length of each second is initially randomly chosen (by a linear feedback shift register) between 10/64th and 118/64th of a second. This ensures that after counting N seconds, an average of N true seconds have elapsed.

Nevertheless, the standard deviation of the number of true seconds elapsed is proportional to N, thus it increases with time (even if the relative error is proportional to 1/N and decreases with time). The firmware includes a compensation mechanism which produces seconds which are in average a little bit shorter when the clock is too early compared to the real time and longer seconds when the clock is late. The time remains accurate to a few seconds.

Finally, the MSP430G2211 requires a minimal voltage of 2.2V, the clock cannot run on a single 1.5V battery like the original clock. Thus I used two 1.5V batteries connected in series.

Possible improvements