tomclarke wrote:How do you average zero crossing data over 7 cycles?
If you reckon the noise is Gaussian time invariant then it is straightforward.
But more likely the noise is different. Getting the best possible frequency from such data is quite interesting in itself. As a first attempt I'd take the median value from the period of 3 5 cycle chunks each displaced by one cycle. That does not use all the info available, but is simple.
Well I'm not counting periods of the master clock. I'm taking time stamps. So I have time stamp one and time stamp seven. I subtract them and divide the difference by 6. (and some other stuff to get a read out of 60.000) that averages out the zero crossing errors. Not perfectly. But pretty good. My master clock is 59 MHz. So I can read out to about 1 ppm. But the clock itself is only good to 20 ppm (worst case over a wide temperature range) and the readout itself is in steps of about 16.67 ppm. So the reported number is about in line with the available accuracy - not counting zero crossing error.
The next build is going to have a 10X better clock (2.5 ppm over temperature). And a 10X faster comparator (400nS vs 4 uS). The comparator offsets are about the same (5 mV worst case). It may or may not make much difference.
The third build will have a GPS clock good to at least 1 part in 1E7 short term accuracy and 1 part in 1E12 long term.
BTW reporting the grid "frequency" from .1 second counts is standard. The variation was much greater when I was reading single periods.
Compare that with this: http://blog.blinkenlight.net/experiments/measurements/power-grid-monitor-2/
When I get a board design suitable for reproduction I will publish schematics and code. The current design is a prototype.