Logic clock without an on-board oscillator

[Lucassiglo21] developed this logic clock without using a crystal oscillator or a resonator. Instead, he’s letting the incoming electricity keep the time for him. The supply is AC at 50 Hz so he’s using some 4017 decade dividers to reduce that down to a 1 Hz signal. From there it keeps track of the ticks just like the last digital logic clock we saw.

If you’ve used AC line frequency as the clock source in your project we’d like to hear about it. Send us a tip and make sure your writeup includes a schematic. We’re especially interested to see if anyone has a good way of using this method with inexpensive microcontrollers.

58 thoughts on “Logic clock without an on-board oscillator

  1. After I got bored a couple weeks ago, and someone asked a question about how to measure the 60Hz AC frequency on a computer (I can’t remember why he wanted to do this) for some other application, I rigged up a simple circuit.

    18VAC -> clamp diodes to +5/0V -> comparator with 2.5V reference -> AVR @ 10MHz.

    Wrote some simple code to implement a reciprocal counter. It counts system clock cycles for a given number of detected AC cycles – AVR provides hardware to do this with single-cycle accuracy and it allows much more accurate frequency measurements with short counting periods. I’ve been collecting data at 2s intervals for about 3 days.

    This is not even a particularly accurate setup and it’s starting to show similar AD results as the link posted above (which I’d seen); not particularly stable and starts to gain stability after averaging for 10^5 seconds or more.

    For more basic results – my run so far:

    >>> numpy.mean(a)
    >>> a[len(a)/2]
    60.000450003375001 # a is sorted, this is the median
    >>> numpy.std(a)
    >>> numpy.min(a)
    >>> numpy.max(a)
    >>> len(a)

  2. so it’s accurate until the fourth digit in a couple of days. so the error is aprox 0.0009%, a crystal oscillator is 30 PPM i think, wich is an error of 0.003%. Sooo, the line is more accurate in a couple of days.

    if i did the math wrong please correct me

  3. Re: Projects which use AC line frequency for timing

    The old think-geek LED binary clock does this, as I discovered by accident… when I first got mine I was hitting the wrong button to put it in 24-hour mode, and was instead putting it in 50Hz mode instead of the 60Hz we use in the US. So within a few hours I was off by a minute or two. Took me about a week to figure what was wrong ^.^;

  4. @magetoo
    >Do you have to “idle” the turbines and generators to do that, or do you just end up with them delivering a bit less electricity to the grid before they’re in sync?

    Inre: “idle”, Even when a power plant is shutdown for maintenance/repairs they like to keep the generator/turbine rotating (maybe this only applies to a horizontal shaft) to keep the shaft from “settling” or distorting, which can happen if the plant is idle for an appreciable length of time (weeks?)

  5. @Skipper

    Have to pat you on the back for that, Skipper. The same is true of UK power utilities as well. The power companies know how long their system has been running slightly under (or over) the required freq (50Hz here) and they tweak the freqs up or down for the same amount of time to bring everything back into line.

    – – – – –

    To those of you who live in or near to a large metropolis, this project will work fine. Folks who dwell in outlying areas or remote locations or in countries where the power is not always as reliable as they’d like, will have problems.

  6. As noted previously, variations in grid frequency are extremely disruptive to mega-scale power networks, such as in the US and Europe. Such variations lead to phase differences that can cause monstrously large changes in line voltage and current, which can do catastrophic damage to generating and transmission equipment, not to mention causing your alarm clock to lose a few seconds. See also:


    A ham radio friend of mine works for a large power utility. He does fault monitoring at work, and as a hobby has built some microcontroller- based power line frequency monitors. These devices are exquisitely sensitive – from the plain old 120V outlets in his house, he can routinely detect power grid events hundreds of miles away.


    Also, some interesting trivia he mentioned one time… the major interconnects between regional power grids in the US convert each region’s AC power to DC at the connection point. That way, any AC frequency variation between regions will not be a risk factor.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s