Thanks to #MinCup26 I got curious as to how quartz is used in electronic clocks.
It's easy to say "it's the piezoelectric effect, dummy!" But that's just half the story. #TIL quartz crystals used in clocks are actually shaped like tuning forks.
Piezoelectric effect? Quartz bends when a current is applied to it. If you apply an AC current, it vibrates.
The length and thickness of the crystal determines the vibrating frequency. The crystals are built to vibrate at exactly 32768 Hz. If you see that number and go like "wait a second…" you are exactly right: that's 2¹⁵ Hz. You halve that 15 times (using flip flops) and you get 1 Hz.
(Side quest: how does the 100th of a second chronometer in the same watch work? TLDR; it doesn't, it just averages the error)
Why tuning forks? Because a flat straight crystal vibrating at 2¹⁵ Hz would be much larger. The crystal in a wrist watch is about 4 mm long. Early electronic clocks using quartz crystals were in fact much larger. Modern crystals are cut using special machinery to get them to the correct frequency.
Why 2¹⁵ Hz? Because something faster would require more energy and something slower would be larger.
Long story short: you feed a DC signal into the circuit to transform it into an AC one. The crystal in the circuit forces the frequency to 2¹⁵ Hz. You feed that into a microchip that outputs a 1 Hz signal. You count the pulses and you have a clock.
https://en.wikipedia.org/wiki/Quartz_clock