[time-nuts] Building a mains frequency monitor

Tim Shoppa tshoppa at gmail.com
Tue Apr 12 13:38:13 UTC 2016


I shared a schematic from a 70's era consumer clock 60Hz detector in the
past week. I never really noticed any of these dropping cycles or picking
up extra cycles, but I'm sure it happened. The single pole of RC low pass
filtering in front of the Schmitt trigger seems to do fine.

Tom, you shared the AD app note which showed a synchronized Schmitt-trigger
oscillator. That kind of circuit was very common in 90's era consumer
digital clocks but was usually described as "battery backup" mode in the
consumer clock labeling - those would free-run near 60Hz while unplugged
thanks to the simple locked RC oscillator.

The above applications don't care too much about phase sensitivity but do
care about dropped cycles.

I have yet to dredge up the 60Hz line-lock schematic circuit used in more
than half a century of analog scope trigger circuits. The Tek scopes had
exceptionally robust trigger circuits.

Tim N3QE

On Tue, Apr 12, 2016 at 8:25 AM, Tom Van Baak <tvb at leapsecond.com> wrote:

> Hi Hal,
>
> > What do you mean by a double wide cycle?
> > What do you mean by a missed cycle?
> > They seem like the same thing - if you miss one, the next one will be
> twice as wide.
>
> Yes, sorry, I mixed up my words there. A missed cycle would be a reading
> that looks closer to 32 ms than 16 ms. And a double cycle is one where, for
> example, the negative zero crossing confuses the ZCD and you get two
> readings that each look like 8 ms instead of one at 16 ms. Or if there's
> noise you might get 2 ms and 14 ms, or 0.1 ms and 16.5 ms, etc. I've seen
> period counters where you get cycle slips as a result.
>
> This effect is especially bad in 1970's era mains clocks where they would
> keep time by counting mains cycles. That's a case where signal conditioning
> is important.
>
> Similar problems occur with a TIC when you use a GPS 1PPS as start and DUT
> 1PPS as stop. You can get into awkward situations where each reading takes
> 2 seconds instead of 1 second.
>
> With a time-stamping counter every reading essentially includes the full
> history of phase, so missing or extra data doesn't change the net result.
> At worst you use a "picket fence" model to clean up the raw data.
>
> By the way, a cool thing you can do with a mains time-stamping counter is
> check the polarity of your AC outlets. You can go around the house with a
> battery operated timestamping counter and depending on which way you orient
> the plug or which 120-0-120 leg your outlet is on, you get 8 ms shifts in
> the time stamps.
>
> > I agree that working with time stamps seems simpler.  I wonder if that's
> > because I got started that way and/or wanted to watch phase drift?  I'll
> bet
> > durations work just as well if the data collection code remembers the
> round
> > off and includes it in the calculations for the next cycle.
>
> Correct, a data set of phase (or timestamps) and a data set of intervals
> (or duration, or period, or frequency) are mathematically equivalent and
> you can freely convert from one to the other, plus a constant.
>
> You have to watch out for floating-point data formats, where you can loose
> precision if you are not careful, due to rounding or range. This is
> especially true for data files of frequency; that 1/period calculation can
> result in accumulation of error.
>
> > To me, this is the important advantage of working with time stamps, but
> > that's because I was interested in tracking phase which turns into clock
> > error.
>
> Right. You and I both record phase because we're treating mains as a
> clock. But I think other people are more interested to see strip charts of
> frequency over time, or histograms of frequency deviation and the like. In
> that case, the occasional bad data or cycle slip is not a problem. Another
> way to put it -- being a time nut is always harder than being a frequency
> nut.
>
> /tvb
>
> ----- Original Message -----
> From: "Hal Murray" <hmurray at megapathdsl.net>
> To: "Tom Van Baak" <tvb at leapsecond.com>; "Discussion of precise time and
> frequency measurement" <time-nuts at febo.com>
> Cc: <hmurray at megapathdsl.net>
> Sent: Monday, April 11, 2016 7:04 PM
> Subject: Re: [time-nuts] Building a mains frequency monitor
>
>
> >> record the duration of each cycle directly
> >> 5) Double wide cycles are detectable but missed cycles are not.
> >
> > What do you mean by a double wide cycle?
> > What do you mean by a missed cycle?
> > They seem like the same thing - if you miss one, the next one will be
> twice
> > as wide.
> >
> >> Here are the advantages of the timestamping method:
> >> 5) Extra or missing cycles are easy to detect and repair with no loss of
> >> phase information.
> >
> > I'd expect the extra or missing cycles would be easy to spot if you were
> > looking at the duration.  The duration would either be twice normal or
> less
> > than half of normal.  In the latter case, you have to figure out which
> is the
> > extra pulse.
> >
> > I agree that working with time stamps seems simpler.  I wonder if that's
> > because I got started that way and/or wanted to watch phase drift?  I'll
> bet
> > durations work just as well if the data collection code remembers the
> round
> > off and includes it in the calculations for the next cycle.
> >
> > To me, this is the important advantage of working with time stamps, but
> > that's because I was interested in tracking phase which turns into clock
> > error.
> >
> > Cycle duration:
> >> 3) With period or frequency measurements, if you lose even a single
> reading,
> >> you lose track of phase (timekeeping).
> >
> > Timestamps:
> >> 3) You get perfect long-term phase tracking, even if there is noise or
> >> glitches or lost or corrupted data.
> >
> >
> >
> > --
> > These are my opinions.  I hate spam.
> >
> >
> >
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>



More information about the Time-nuts_lists.febo.com mailing list