real time clocks & 60hz from power company

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Does anyone know of any reason to not use the 60hz/110VAC signal coming
from the electric utility companies to drive an "approximate" elapsed
time clock?  Isn't that what digital alarm clocks used for their clock
source not too many years ago?  The board I'm working on doesn't have a
crystal that divides down neatly to seconds (milliseconds, etc.) using
any of the built in timers/prescalers, and I'm  having trouble
maintaining a moderately accurate real time clock with it.  One of my
coworkers stated an opinion that power compaines don't have any
guarantee about the accuracy, stability, etc. of the 60hz AC that's
associated with our AC power here in the USA, especially when the power
grid switches things around, and that if I use that 60hz to drive my
clock it'll lose time regularly (i.e., several seconds per day).

Anyone have any comments on this issue?


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

Re: real time clocks & 60hz from power company
I don't know about the USA but in the UK the frequency is adjusted to
maintain the long term accuracy of clocks and timers. Just remember not to
export any of your devices to Europe or you'll certainly lose time running
at 50Hz. The alternative that we chose is to add a real time clock like the
PCF8535. If you are short of cash then adapt an analog watch to give you a
one second interrupt.

Peter

Quoted text here. Click to load it



Re: real time clocks & 60hz from power company
On Mon, 29 Sep 2003 15:00:41 +0100, the renowned "moocowmoo"

Quoted text here. Click to load it

If he has a crystal, resonator or even some RC clocks, he can easily
detect whether it's a 50Hz or 60Hz nominal line, but I really don't
see why he can't use any particular frequency crystal to make an
accurate clock. He has to write firmware that accumulates any errors
to better accuracy than the crystal tolerance.

Best regards,
Spehro Pefhany
--
"it's the network..."                          "The Journey is the reward"
snipped-for-privacy@interlog.com             Info for manufacturers: http://www.trexon.com
We've slightly trimmed the long signature. Click to see the full one.
Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

I can, .... he will have problem with uart's i guess.



Re: real time clocks & 60hz from power company
Quoted text here. Click to load it

The frequency of the crystal is not important (it is for the uart).

What you need is a solid and regular interrupt, one that does not have much
jitter.

Suppose the interrupt comes every 1721 uS, as a result of your
crystal and funny prescalers. No problem at all.

int16 uSec;
int16 mSec;
int8 Seconds;
int8 Minutes;
int8 Hours;

interrupt()
{ uSec += 1721;

  if(uSec>10000)
  { uSec -= 10000;
    mSec += 10;
    if(mSek>1000)
    { mSek -= 1000;
      Second++;
      if(Second>59)
      { Second = 0;
        Minutes++;
        if(Minutes>59)
        { Minutes = 0;
          Hours++;
          if(Hours>23)
          { Hours = 0;
          }
        }
      }
    }
  }
}

Untested code. Will run just fine.

Even allows for calibration of the crystal, by adding, every hour,
the nummer of mSeconds it runs to fast or too slow.

Still, I prefer a RTC with backup for clocks. A ds1302 runs about
2 days on a 0.047F supercap. Enough for most power problems.
Real batteries for handhelds.

--
Thanks,
Frank Bemelman
We've slightly trimmed the long signature. Click to see the full one.
Re: real time clocks & 60hz from power company
Quoted text here. Click to load it

You can use any known frequency to create an accurate clock as long as
the frequency is stable and known.  You just need a piece of software.

  -jm

Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

Same in the US.  It may vary slightly during the day, but they
adjust it to make sure that over a 24-hour period the number of
cycles is dead-on.  That's what they told me at the local power
plant -- and I've heard the same from people I know in the
power industry in other parts of the county as well.

--
Grant Edwards                   grante             Yow!  I'm working under
                                  at               the direct orders of WAYNE
We've slightly trimmed the long signature. Click to see the full one.
Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

Depends on how "approximate" you can tolerate it to be, and what your
viable alternatives are.  There's always the basic isolation / safety
regulations to keep in mind, for starters.  You want to be _very_
careful on that end.

Quoted text here. Click to load it

Sure.  Some of them may even still be in operation, and the power
companies know that.  This *should* imply that as long as your
requirements match those of an alarm clock, you should be fine.  But
as usual, the real answer can only be had straight from your horse's
mouth, i.e.  your local powercorp.

Quoted text here. Click to load it

I don't see why that should pose any problems.  The second is not a
sacred unit if all you really want to know is the amount of time, is
it?  Yes, you may have to perform a division of large-ish operands if
you finally have to display the result in units of seconds --- but
that's mainly a problem of representing the result, not of the
measurement itself.

In other words: what's stopping you from measuring times in units of
crystal cycles or timer ticks (of your own definition), and only
translating that result into seconds if needed, using a pocket
calculator or whatever?  Using an approach similar to the Bresenham
line drawing method of computer graphics, it may well be possible to
reach a very precise result even without having to actually divide.

The 60 Hz (which are of course 50 Hz around here ;-) are said to have
rather good long-time stability, exactly because of those mains-driven
clocks of old.  But short-term fluctuations do, indeed, happen.  So
you shouldn't assume you can accurately time one second by counting 60
mains cycles --- but still, a day will quite reliably be 86400*60
cycles long.
--
Hans-Bernhard Broeker ( snipped-for-privacy@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.

Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

   The 60 Hz power frequency does vary slightly, but I doubt it's ever
off by as much as several seconds, and over the long term it stays
accurate. Here's a thread on it:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&threadm=3e938ab7.46794566%4065.82.44.187&rnum=1&prev=/groups%3Fq%3DHow%2Baccurate%2Bis%2Bthe%2B60Hz%2Bline%253F%2Bgroup:sci.electronics.design%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26selm%3D3e938ab7.46794566%254065.82.44.187%26rnum%3D1

or:

http://makeashorterlink.com/?D20312B06
Quoted text here. Click to load it

-----
http://mindspring.com/~benbradley

Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

When I was at the university, years ago, they had been using the 60Hz
signal from the power line for timing a telescope.  Someone noticed
one day at just before midnight that the clock sped up to about 120Hz
for a few seconds.  The law required them to put out so many cycles
in a day and they were just catching up.  So it just depends on how
"approximate" you need.

Re: real time clocks & 60hz from power company
snipped-for-privacy@yahoo.com says...
Quoted text here. Click to load it
Considering how tightly synced the grid is I doubt the local utility
somehow sped up the cps on the wires.  I would rather guess there was
some bug in the rest of the system.  
I would shudder to think what jumping the grid frequency would do to
some industrial customers using BIG 3 phase motors.

              Jim

Re: real time clocks & 60hz from power company
Quoted text here. Click to load it

That 120Hz is a joke of course. I'd bet my last penny that it's not
more than 60.1Hz no less than 59.9Hz during the catching up. And
a nationwide correction.

--
Thanks,
Frank Bemelman
We've slightly trimmed the long signature. Click to see the full one.
Re: real time clocks & 60hz from power company
Quoted text here. Click to load it

I didn't see it myself, but I heard the story from my astrophysics
professor who had been at the observatory in 71 when they noticed
that the telescope suddenly sped up to about twice its normal speed
and made noises that they had never heard before.  Once they determined
that the power grid was racing to catch up to the required cycles per
day they got a more reliable clock source for their drive.  Things may
be better today, but it is still an issue of the definition of approximate.

Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

   That's really surprising, I would think running a large generator
at twice standard speed would be dangerous in several ways. I'm sure
this was an extremely unusual circumstance. Was power supplied by an
on-campus power plant rather than the utility?
   What school and year was this (exact or approximate date would
help)? Is there any way one might track down a news story on this? I
(and surely others) want to see documentation, because it's bizarre
enough that it sounds like an urban legend.

-----
http://mindspring.com/~benbradley

Re: real time clocks & 60hz from power company


Quoted text here. Click to load it

   Are you sure these wall clocks were wired to the regular power net?
I remember that in institutions all clocks were controlled from a
central source to keep them in sync, change betwn daylight and standard
time, etc
rw


Re: real time clocks & 60hz from power company
That's true, but they weren't corrected by changing the frequency of the
60hz supply.
It was a signal modulated on top of the line. Might drive some devices crazy
I
suppose. Still sounds like an urban legend to me :)

Doug

Quoted text here. Click to load it
approximate.



Re: real time clocks & 60hz from power company

Quoted text here. Click to load it

School clocks and such worked like that with a local signal over the power
line.  Hmm... Googling for Western Union and clocks might get you
something.  (They synced the local time base with a signal over a Western
Union wire.  Oi!)

--
Ron Sharp.



Re: real time clocks & 60hz from power company

[snip]

Quoted text here. Click to load it

You never get an interesting aneckdote without adding a bit of juice ;)


--
Thanks,
Frank Bemelman
We've slightly trimmed the long signature. Click to see the full one.
Re: real time clocks & 60hz from power company
The local utilities do guarantee that the number of cycles per day is
exact. The correction is not that dramatic though. Just a small speed
up or slow down to make it correct. Good for clocks and such but
not for any kind or real accurate work. I can't remember the exact
spec but +/- a few seconds is what I remember. Plus the correction
is graduadually applied.

Doug

Quoted text here. Click to load it



Re: real time clocks & 60hz from power company
The frequency of the crystal is largely irrelevant, but the fact that
you want a real time clock sort of hints that you might have a micro.
That makes things easy, even if you don't have the micro you can always
divide your crystal to almost any number to get a secondary time base
which is a convenient fraction of a second.

Al

Dave Sudolcan wrote:

Quoted text here. Click to load it

--
Please remove capitalised letters to reply
My apologies for the inconvenience
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline