Mains frequency turned into a clock with plain counters

Oct 12, 2026 Last reply: 4 hours ago 4 Replies
Jump to replies (4)

Most of us would reach for a microcontroller and call it done, so it is refreshing to see a clock that gets its timekeeping pulse by dividing the 60Hz from the wall down to 1Hz with nothing but 8-bit counters and AND gates. The maker built this one as a work in progress, and it is headed for the shop wall once finished.



The signal chain is where the care shows. A divider taps the line side of a bridge rectifier, feeding an optocoupler for isolation, and a parallel SMPS supplies 5V for the logic and displays. A chain of op amps shapes the half sine coming off the opto's NPN side into a square wave, with rising edge detection to strip out noise. From there a decade counter's carry pin pushes 6Hz into a binary counter, and an AND gate resets it every six counts to yield the 1Hz tick. The seconds, minutes and hours are counted by cascaded 8-bit counters handing off down the line. My favourite detail is the roughly 5ms RC delay on the reset signals, which keeps the handoff between counters solid.



Time setting is handled mechanically: a DPDT slide switch pauses the seconds counters and enables the set circuitry, while two momentary buttons advance the minutes and hours, debounced by a dual op amp in a Schmitt trigger arrangement.



It is not all done yet. The hours display is still unwired pending more resistors, the housing is undecided, and true drift will only show up after a long run. Short tests so far suggest only a few milliseconds of drift per day.


The 5ms RC delay on the reset lines is the choice that stands out to me. Counter handoffs are exactly where these divider chains tend to glitch, and giving the reset a little stretch of time makes the transfer between stages dependable. It costs a handful of passive parts and buys a clock that does not hiccup at every carry.

I am curious about the time setting path. When the DPDT slide switch is moved forward, what exactly stops and starts inside the counting chain, and how do the two momentary buttons get their pulses into the minutes and hours counters without the debounce letting noise through?

The maker has described that part. Sliding the switch forward powers the decimal pin, resets and pauses the seconds counters, and powers the Schmitt trigger op amp. Sliding it off disables time set and restarts the clock. The two momentary buttons advance the minutes and hours, and the debouncing is done by a dual package op amp wired in Schmitt trigger configuration.

One concrete idea: capture the schematic in KiCad and have a proper board spun up. With this many counters, gates and op amp stages, a real PCB would cut the wiring dramatically and shrink the footprint, and it would make a second unit for another room nearly trivial to assemble. The perfboard version could stay as the working prototype while the board version hangs in the shop.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required