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?
Scott,
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 becomes one RS232 binary byte becomes one read(). Note if the pulse is too short (<100 us at 9600 baud) the port may miss it. If the pulse is too long (>900 us) the byte may have a framing error. But anything in between is fine. Thus simply reading the serial port and counting the bytes, or hi-res timing the arrival of each byte, will give you the raw measurement that you need. From that you calculate things like period, frequency, accumulated time error, average frequency, etc. So the PC itself becomes your frequency counter, with NTP providing the long-term timebase stability you need. Mains cycles-per-second become RS232 bytes-per-second. You will get, on average, 60 bytes per second. At the end of a "perfect" day you would have read 5184000 characters. In Europe, it's 4320000 (50 Hz * 86400). The file format I use is mjd,te. mjd = modified julian date, and te = time error (the cumulative phase error, in seconds). For detailed study I log data once a cycle or once a second; for long-term monitoring and pretty plots, once a minute is more than enough. /tvb _______________________________________________ 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.