I know very little DSP beyond an intro undergrad course. I was looking to write a C algorithm that takes ADC samples and determines if a specific frequency is present (in the range of 100KHz); not caring about any other components of the signal.

I'm not sure where to start. I looked at Goertzel algorithm; would this be a recommendable approach?

I was wondering if it is feasible to analyse a signal at 100KHz with a ARM micro controller, or will I need a special DSP breed?

Should I even be tackling this with a PLL or something similar? If so, does anyone have some design references?



Regarding the implementation question, maybe you could tell us more about your hardware: ARM family (cortex M3 or M4?), clock rate...

A fixed-point implementation of the Goertzel algorithm is a dozen instructions, so this would indeed be doable with a sample rate of 1 MHz on a low-end ARM micro (say STM32F1 or LPC1343) clocked at 72 MHz (assuming you don't have much overhead for reading your ADC, eg. by letting the DMA subsystem handle this).


  • You might hit the upper range of your ADC sample rate, and/or will have little margin to design your anti-aliasing filter (say 105kHz is the upper frequency of interest... You can sample at 210kHz but will need the steepest anti-aliasing filter... Or at 800kHz and have more margin for the transition band of your anti-aliasing filter).
  • This still looks like a waste of CPU cycles, especially if you are only interested in a narrow band of the signal. Keep in mind that if the only thing that interests you is the 99kHz to 101kHz band, you actually need a sample rate of just 4kHz to capture all the useful information - provided you have a mean of modulating the input signal by a 100kHz sine wave.

In such situations, and if you control the target hardware, a bit of pre-processing in the analog domain could be handy, such as:

  • Frequency shifting your signal by 100kHz so the band of interest becomes the base-band and so that you can sample it at a low sample-rate (requires a sine oscillator, a multiplier, and a low-pass filter).
  • Applying a narrow band-pass filter in the area of interest + rectifier + low-pass filter - this would measure the energy of the frequency band of interest.

If you are familiar with discrete fourier transform, it is basically a correlation with sine waves and cosine waves for every possible frequency. So if you are interested in only one specific frequency you could perform a correlation with a sine and cosine of the frequencies you are interested in. Another method is to use a band pass filter, using an IIR filter you can get some really efficient algorithms, this will let you get frequencies which are close to you target frequency if that is what you want.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.