# Measuring high frequencies (300kHz) with arduino

I'm designing a frequency generator with ICL8038, which would output sine, square and triangle waves, which would reach frequency such as 300kHz.

I've already designed a circuit around the ICL8038, but I'm unsure how to measure the frequency, to show on LCD display.

I'm leaving down a schematics I've drawn. A.Duty is going to the analog input of arduino, which will show the duty cycle between 2% and 98%. This will be going to a voltage divider to make a proportional input for the arduino analog input.

The "frequency pin" would be connected directly from the BNC connector from the casing, which means, that the input can be triangular, sine or square.

Just to mension, in case it makes any kind of difference, I'm planning to use just Atmega328 with 16MHz quartz and 2 capacitors, not exactly as Arduino UNO or NANO. But the Atmega will have a arduino bootloader on it. By the time asking about ICL8038, I've got also few questions about the IC:

1. You connect the FM Bias(pin 7) and SWEEP (pin 8) together to create sweep on the output of any kind of signal, whichever it is? This is fixed time constant or should I add some kinda coapacitor there?

2. What exactly does Tcap (pin 10) does? I've read through the datasheet but couldn't understand it's meaning.

3. How would I get proper voltage range every time, when I would change the input voltage of the ICL8038? (it has wide range of output signal, proportionall to the input; it goes from 36V to input, 28V max output)

4. For power supply would be proper LM317 as adjustable power supply (since it has low power consumption) and just use a potentiometer to adjust input of the ICL8038 and monitor the OUTPUT levels?

5. PIn 13 and PIn 14 are NC (not connected). Can I just connect them together and connect them to GND?

As if anybody knows for any "better" IC as this one is, please let me know. I'm already going to have to buy it from China (this gives me doubts about the capabilities), I'd rather just order one from Europe or US.

• Why measure the sine output when you have a perfectly good square wave output needing at most voltage adjust that you can count?? – Chris Stratton Mar 25 '18 at 23:48
• Okay, I've never thought of that :D But thanks, sure will use this tip! – Jakey Mar 26 '18 at 0:19
• the 2nd 1/2 of your post is not Arduino related. – jsotola Mar 28 '18 at 3:11

To sample a 300kHz signal you need to sample at at least 600,000 samples per second (see Nyquist-Shannon Theorem).

The Arduino can sample at an absolute maximum of 125,000 samples per second.

A normal Arduino will not be able to sample the analog input fast enough to even remotely have a clue what the frequency is - let alone what shape the signal is (for that you would have to be sampling in the millions of samples per second).

You will need a much more powerful board than an Arduino to do it.

The other option is to feed the signal through a comparator (an op-amp with infinite gain) to convert the signal into a square wave. You can then use simple frequency counting to get the frequency (count the pulses within a given time frame - maybe 1 second).

As for the rest of your questions, you would be better off asking those on Electrical Engineering.

• Certanly I realize that, the arduino fails to read such frequencies. But I tend to use "additional" PCB only to measure frequency and convert it into proper signal for the arduino. It can be either analog either digial. But I'd prefer digital, since analog has only 1024 bites. – Jakey Mar 25 '18 at 23:33
• Of course you wouldn't sample this - you would count whole periods! – Chris Stratton Mar 25 '18 at 23:48
• In counting you lose the waveform shape information. If you don't care, then yes frequency counting is definitely the way to go. – Majenko Mar 25 '18 at 23:49
• It doesn't matter the waveform information. This part will be solved otherwise (already got a solution). And how am I supposed to do the counting part, while it's range will be between 0.1 Hz and 300 kHz? – Jakey Mar 26 '18 at 9:03
• That makes it simpler then. The comparator and counting is the way to go. The comparator is optional but will give more reliable results and is a jellybean part anyway. – Majenko Mar 26 '18 at 9:04