modified: Monday 5 December 2016
Project: Wooden synchronous clock
This clock took many months to complete. So much for a weekend project!
The wooden gears are driven by a stepper motor. This stepper is controlled by a circuit that counts the 50Hz waveform of mains to keep time.
Whilst mains frequency changes about quite a lot during the day, over the long term power companies ensure that any lost or gained cycles are counteracted. Many digital clocks (including alarm clocks, oven clocks and microwave clocks) count mains to tell the time.
Once upon a time synchronous motors were popular to run clocks. You may still encounter some today. Listen for gentle motor and gearset whirring near power boards, pool control systems, hot water heaters and wall clocks that plug directly into mains.
Inkscape has a built-in gear generator. Although involute gears would be better, I can't cut accurately enough for it to matter.
I print and then stick the gear designs onto plywood. This is an easy and accurate way to get things done:
Printers are an amazing tool for making stencils like this. I do this for aluminium parts too. Most printers have a small scale error that you can adjust/counteract if necessary, but either way they have a ridiculously high relative accuracy and paper is cheap.
You can also see that I've drilled holes in the valleys between teeth. After this I band-saw the rest of the shape out. These holes provide convenient and neat end points for the cuts. I stole this idea from a clever person somewhere on the web.
The gears do need a little work to mesh together properly and have quite a lot of backlash. I spend some time sanding the teeth to a better shape after using the band saw. They end up looking pretty nice:
The roman-numeral clockface was applied using the same toner transfer technique I use to make PCBs. It took me a few tries, the first few of which only partially transferred so I sanded them off to start again. I found that layering multiple transfers on top of each other worked the best.
Rightmost board: power supply. Takes in ~9VAC from an external plugpack and spits out 5VDC. Nothing fancy. These used to be popular more than a decade back: WES Wagner sells them if you are in Sydney.
Middle board: samples the AC and converts it into square 50Hz pulses using a comparator. Then counts those pulses using decade counters. The LED pulses once every 9 seconds, indicating the motor should take one more step.
Left board: drives motor with a dual H-bridge (four half bridges) and keeps track of the stepper motor state using a decade counter. LEDs represent the motor state.
The 'squaring up' circuit has a little tomfoolery in it, mixing in signals from various sources through the four resistors. I used the philosophy of 'try some values and see what happens' to design this.
First of all: we don't want voltages above 5V entering the comparator, as that is what the comparator is powered with. So I used a voltage divider to cut the 9VAC down a bit.
Second of all we don't want negative voltages touching the comparator. Although the waveform we should be getting is half-wave rectified, it still drops around 0.7V below zero. So I used another resistor to pull it up toward 5V by a little.
The comparator suffered instability when it hit the crossing point of the 50Hz signal. This appears a lot like switch bounce in the output wave. It was particularly hard to spot because the output looked like a perfect square wave on a scope screen -- until you zoomed in very heavily to see the spurious pulses. To fix this I put a resistor from the output of the comparator to the input, adding in a bit of positive feedback (aka hysteresis).
The shape of the waveform made by this mixture of voltages is quite interesting and I have a little picture of it drawn on the schematic. The threshold level for the comparator is adjustable, and as you adjust this you can see the vertical 'slip' lines (where the circuit switches from high to low or visa versa) lines move up and down in the waveform. The bottom end of the waveform has some interesting distortions too -- it has three distinct steps in its shape, rather than just a small curve.
It's also worth mentioning that many comparators have an open collector output. Equivalent circuits in datasheets help allude to this. The solution is to use a pull up resistor on the output pin (pin 7 in the diagram above).
The gears shown in the photos above are completely wrong. They give an irrational ratio. Please don't ask. In the end I had to remake the smaller gear with a different number of teeth and modify the counting circuity to counteract it. You can't just modify the counting circuitry to counteract irrational ratios, unless you're happy to gain/lose time each day.
During these changes I fitted a 'rotating mount' for the stepper motor (not pictured) which made depthing the gears easier. It was basically a couple of strips of aluminium that acted as a pair of arms.
If you depth the gears too close to each other then the clock would silently lose time over the day. Occasionally a step would fail (not enough torque) and you wouldn't notice. I wanted to run the stepper motor off the rectified 9VAC, but even with lots of capacitance the motor noticeably vibrated with the ripple current, so I opted to use the regulated 5VDC instead.
Oh and there are probably errors in my schematic! Make sure to poke me if you encounter them or are suspicious.