[time-nuts] TEC party file format?
albertson.chris at gmail.com
Tue Jun 28 18:55:44 UTC 2011
On Tue, Jun 28, 2011 at 11:31 AM, Tom Van Baak <tvb at leapsecond.com> wrote:
>> I'm planning on counting 60Hz line cycles with some embedded hardware,
>> then dumping the count over RS-232 every minute or so to a linux box running
>> ntp. Any thoughts on what data to log?
> You have a PC and RS232? Skip the embedded hardware.
> An easy trick is to convert the 60 Hz sinewave into a narrow
> pulse and send it to -- a serial port. Someone else on the list
> can propose the minimum circuit for this (one 555 would do
> it, but there is probably a simpler way).
> If you make the pulse about 500 microseconds wide and
> configure the serial port for 9600 baud, then each pulse will
> be magically interpreted as a start bit (and some arbitrary
> data bits). Each 60 Hz cycle becomes one 500 us pulse
You can do even better. Connect the pulse to pin one (DTR?) This is
the same pin used for the PPS from a GPS unit. The Linux (or BSD)
kernel will time pulses on this pin with a nanosecond resolution
counter. On most computers that have a real hardware rs232 port you
get accuracy way better then the microsecond level. The pulse will
cause an interrupt and there is a kernel level device drivers that
simply reads the clock and stores it. Then you need a user level
program that polls the interface for data. When it sees data available
it reads and gets the clock value. It will find data available 60
times per second.
If you care about calibration to UTC then connect the pulse per second
(pps) output from a GPS to a second port. The the PPS lets you
calibrate the rate of the nanosecond counter and find the phase of the
60Hz signal relative to the UTC second
The good part is that the data rates are low. 60Hz is dead slow for a
Redondo Beach, California
More information about the time-nuts