The tuning fork clock

I got the inspiration for this project after reading this article on another tuning fork clock on Hackaday last year. And since I was, at the time, burdened with an overly loud mechanical clock on my desk I thought that this might be a perfect project to replace that clock with something just slightly less annoying.


Designing the oscillator

Analogue oscillator section schematic
Analogue oscillator section schematic

I really liked the general concept and started doing some experiments on how to build my own tuning fork oscillator. While I liked the idea of driving the fork magnetically as in the original project I thought it would be much nicer to also sense the vibration magnetically.
Of course the tuning fork doesn't have it's own magnetic field so I designed a 3D printed holder which would contain both the inductors which I use as driving and sensing coils and a neodymium magnet which would generate an external field. Similar to a guitar pickup the motion of the tuning fork inside that field generates disturbances which can be picked up by the sense coil and amplified.

I needed a way to add positive feedback between the sense and drive coil to keep the tuning fork going, so I designed a simple transistor based amplifier circuit that integrates some filtering to minimize harmonics.
The output of the sense coil is amplified by a single stage common emitter amplifier and filtered by a passive bandpass filter centered roughly around 440Hz. From there the signal is fed into a second transistor amplifier which powers the drive coil.

This circuit is surprisingly effective and is able to sustain the oscillation of the fork down to less than three volts while drawing around 1mA. When running at 5V, like in the finished clock it's also sensitive enough to be self starting, eliminating the need to tap the fork to get the clock going.

Digital oscillator section schematic
Digital oscillator section schematic

As a last step the signal from the sense coil is also fed into a 555 which ensures that the analog signal from the sense coil amplifier is suitable for a digital input pin on a microcontroller.

---------- more ----------

Digital section

Digital section schematic
Digital section schematic

The digital section of the board consists of an ATTiny4313 and a 74HC595 shift register. The ATTiny4313 uses one of it's timers to count the oscillations of the tuning fork and handles serial I/O and a push button rotary encoder for user input. The 74HC595 is used to shift out the data to be displayed on the 5 multiplexed 7-segment displays.
A set of three LEDs (not shown in the above schematic) are used to give feedback to user inputs and display the current status of the oscillator.


Firmware

The firmware is written in C for the avr-gcc compiler. I originally started out with a ATtiny2313 microcontroller but realized I'd need more flash storage to implement the serial control protocol I envisioned, so I switched to the larger ATtiny4313.

The main timekeeping work is done by a timer which counts the number of pulses coming from the tuning fork oscillator. Two overflow events are generated from this, one roughly every second, and one every minute.
I decided to count the number of pulses per minute and use that as my main source of timekeeping since the larger number of pulses would allow for finer adjustment of the speed the clock runs at. The second interrupt is used for giving a rough approximation of the progress of the minute, a blinking second indicator and a pulse per second signal.

A second timer takes care of the display scanning and update, monitoring of the oscillator signal and various other regular tasks like input timeouts and display blink animations.

The main loop of the program handles non timing critical code like serial input and output, parsing incoming commands and executing them. When no further work is available the processor goes to sleep to save on power.


Character Set

Illustration of clock character set
Illustration of clock character set

To accentuate the unusual look...

Read more »