# Analog Max Frequency Detector Circuit

As a follow up to this question: How to sample audio at Nyquist frequency with MSP430F5438?

What type of circuit would I use to generate something that a microcontroller could use to determine the max frequency of an input? I was thinking it would preferably provide a voltage that is lineally related to the frequency.

The information provided by the frequency detector could then be used by the microcontroller to know what frequency it needed to be sampled at.

Is there any ICs that do this? or any circuit that will do this?

-
It is hard to understand what you mean by "the frequency" of an input. Only a pure sine wave input is of a single frequency. Any other signals are composed of several frequencies. –  markrages Dec 26 '10 at 22:07
@markrages Sorry, I mean max frequency. It was implied from the other posting, but should have be included in my question. –  Kellenjb Dec 26 '10 at 22:13

1. One could use a crossover, which is an implementation of several bandpass filters, followed by power measurement in order to obtain a rough power spectral density. The highest frequency pass-band achieving a threshold would indicate maximum significant input frequency. If each crossover channel were input to trigger/comparator interrupt pins, some good debounce code may be able to take care of the rest. The crossover could be as simple as an array of diode detectors with RC filtering. Circuit complexity would be dependent on the bandwidth and resolution of the crossover. I'm sure we've all ooo'd & aaw'd at quality audio crossovers; diode detectors are very simple; RF range adds complications, but can use diode detectors as well.

2. One could mix down the input frequency, followed by a LPF. Using a continous LO frequency, start at some minimum (~kHz) and increasing to a maximum expected frequency (20 kHz for audio), one could setup a trigger based on a threshold DC or low frequency output, or just record and compare over the entire range. I've never looked for a low frequency mixer, but it would be simple to make a crude one (diode bridge; Gilbert cell); RF mixer ICs are available.

Both of these methods are inferior to oversampling, but much more fun. There are frequency-to-voltage conversion ICs (DigiKey: PMIC - V/F and F/V Converters, 1MHz max).

-
My first thought for the guys problem was to over-sample, but in an embedded environment I can see why a different method could be preferred. –  Kellenjb Dec 26 '10 at 22:15
I think over-sampling and resampling in software is probably the best plan. Otherwise, the sampling filter will need to be a "brick wall" of variable frequency, which is a tricky design in itself. –  markrages Dec 26 '10 at 22:19