GPS-based frequency counter library

I don’t own a frequency counter, but I was interested in checking accuracy of system clocks and also RTCs. I’d seen a couple frequency counter sketches around, but they used the system clock as their time base. I thought that by using the 1Hz signal from a GPS receiver I could achieve pretty good accuracy. This library seems to do the trick, but of course I have no way of verifying accuracy, so a certain amount of hope is involved. I recently calibrated several RTCs with it, so I’ll let those run for a while and see how it goes.

Check it out at GitHub - JChristensen/gpsFreq: Arduino frequency counter library, uses a 1 Hz (PPS) signal from a GPS receiver as an accurate time base. Comments welcome as always.

I think you should disable timer0 in order to avoid spurious glitches.

I saw that in other frequency counter sketches and had it coded in at one point, but frankly I don't see much if any difference. I do see a very occasional reading that seems to be off by a few Hertz and I wondered if that wasn't the cause. Probably would have to make a couple long runs, one with and one without, log the data and compare. I should try that, thanks.