I have an old (70's) function generator with no display and with only knobs to change the frequency with. So I want to build a frequency counter to mostly be used as a kind of display for the generator but of course with the option to measure other signals too. Signal generator goes from 1 Hz to 100 kHz.
I have both a 10 MHz OCXO frequency standard and a couple of GPS boards with programmable output (UBLOX) that I can use as a reference for the counter.
I've been reading a lot of posts and tutorials about using an Arduino as a frequency counter and they all suffered from pretty bad accuracy issues. What I'm not sure about is if that's only due to the reference used not being accurate enough or if it's to do with the counting done by the Arduino.
So my question is basically, what type of accuracy can I expect from the Arduino when using a very accurate reference? I'm not after +-0.01 Hz accuracy but if I can get +- 1Hz I'd be happy for this application. Up to 50-100 kHz something like that. Is that possible? If so, what Arduino board would be most suitable? I haven't done much with Arduino but if it's a suitable platform for this I'm going to sink my teeth into it.
The Arduino generally has a pretty poor reference oscillator, many types just use a ceramic resonator, some do use a crystal but even then not very precise. As you have both an OCXO and a couple of GPS receivers they of course will be much better, the question is how to use them. The simplest way is to arrange for a gate that opens for exactly 1 second and allows through pulses, and count how many pulses. This will give you +/-1Hz accuracy. But the pulses could be at 100kHz, and counting those is usually done with a dedicated binary counter IC which could usually be clocked up to MHz or more, then transfer the count over a second to a processor for display. You might use an Arduino for the counter, but the basic devices like Uno and Nano IIRC have a cycle time of 4us I think so might struggle at 100kHz. Or it may be possible to use one of the timer/counters on chip but that is more complicated to program. In some ways the simple PIC processor might be better at least for counting, since they can be operated in a way where the signal to be counted clocks the processor directly - see PIC Projects - frequency dividers, timers
I use picPET7's counting a 10MHz OCXO for clock timing measurements.
An ATmega-based Arduino has a 16 bit input capture timer that can count external pulses at rates up to 4 MHz, or the timer can be clocked at 16 MHz to time events or measure periods to +/- 62.5 ns accuracy, relative to the CPU clock accuracy.
Incidentally, you can used the above technique calibrate the Arduino on board CPU clock to a few Hz, using the PPS output of a GPS as the time base on the input capture pin.
With some input signal conditioning, you can use these ideas to create a calibrated 0-4 MHz frequency counter, accurate to a couple of Hz for a clean signal.
Thanks for the reply!
I actually ordered one of those cheap Chinese frequency counters that uses a PIC chip and a 7 segment display. Not sure how accurate that is, I got it more to fool around with. Reason I want to make my own is that I want to make a nixie tube display for the counter.