My setup is pretty simple indeed. This is 9.830400MHZ OCXO which clocking MCU. Then it is Zero-Cross detector which connected to capture timer. The MCU counting the intervals between of each zero-cross event and number of events occurred.

if (htim->Instance == TIM5 && htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
        uwIC2Value2 = (HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1));
        if (uwIC2Value2 >= prevtimer) {
            uwDiffCapture = (uwIC2Value2 - prevtimer);
        } else {
            uwDiffCapture =((0xFFFFFFFF - prevtimer) + uwIC2Value2);
        }

        prevtimer = uwIC2Value2;

        // MAIN Time calculation
        if(++uwCapT > 59) {                  // Every 60 cycles (60hz)
            if(++maintime.Seconds > 59) {
                maintime.Seconds = 0;
                if(++maintime.Minutes > 59) {
                    maintime.Minutes = 0;
                    if(++maintime.Hours > 23)
                        maintime.Hours = 0;
                }
            }
            uwCapT = 0;
       }

Once an hour the program prints its internal clock (MCU time), RTC time and MAIN time

# Uptime:       476 hours
# RTC time:     13:00:00
# MCU time:     13:00:00
# MAIN time:    13:00:01

The graph shows the "delta" between of RTC and MAIN.

On 2017-12-15 12:14, Jeremy Nichols wrote:
I'm surprised Vlad is seeing as much as six seconds differential but
maybe I don't understand the experiment. I've done measurements of the
line frequency here in California and never seen much variation.

Jeremy

On Fri, Dec 15, 2017 at 9:02 AM Vlad <t...@patoka.org> wrote:

I have one of my project boxes, which monitor the main freq. Here is
graph which reflect the time difference between of RTC (based on
number
of pulses from OCXO) and the "MAIN TIME" which is based on number of
zero-cross events.
The observation period is 486 hours.

On 2017-12-14 23:13, Jim Harman wrote:
On Thu, Dec 14, 2017 at 10:53 PM, Bob kb8tq <kb...@n1k.org> wrote:



Of course this *assumes* an electronic approach. Given that
it’s
moving
pretty slow and you
only are looking at fractions of a millisecond, one *could* do an
electro
mechanical design …...

Bob

There is interesting background on power grid frequency/time
adjustment
procedures here


https://en.wikipedia.org/wiki/Utility_frequency#Time_error_correction_(TEC)

and here
https://en.wikipedia.org/wiki/Electric_clock#Accuracy

--
WBW,

V.P._______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--

Sent from my iPad 4.

--
WBW,

V.P.
_______________________________________________
time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Reply via email to