I'm looking for some advice, I am hoping one of the many forum experts could help me with some advice on the sampling and processing of signals. I am using an STM32F4 processor with 12 bit ADC and DSP core. Presently, I can use either CMSIS DSP or Siglib libraries. Here's a point description of the problem space:

I can sample at whatever rate is required: in front of the ADC is a 10th order analog amplifier and LPF, Fc = 55Hz. Amplifier can be set to provide ideal ADC range of 3Vpp

Sinusoidal incoming signals are in the range of 10Hz to 40Hz that can be set for any duration in time. Ideally, in the range of 200ms to 300ms (can be changed)

In between these tones, there is dead space of (ideally) 50ms to 100ms (can be changed)

There would be a series of these tones with a total time of about 4, or possibly 5 seconds (can be processed after last signal arrives, ideally real-time)

I need the best amplitude and frequency accuracy possible, ideally about 2dB and 0.5Hz. The environment is noisy, but incoming signals can be kept 20dB over noise.

I am not looking for a code handout. Just a best approach algorithm and ideally some specifics such as sampling rate (is decimation required), buffer size, to use overlap-add/sliding window, signal processing chain - FIR required (how many taps), FFT method/size?

It may not be complex to many of you, but I haven't finished all the theory I need to try an implementation without spending a long time,(I have all the books but there's a lot of reading yet!) and the problem requires me to try for a solution now.

Thank you for your help! Roger

  • \$\begingroup\$ What exactly are you trying to do with the tones? It's not clear. \$\endgroup\$
    – pjc50
    Jan 28, 2015 at 17:24
  • 2
    \$\begingroup\$ What difference does it makes to the solution? That's like me asking what's the best way to harvest grapes with certain size baskets and number of people, and you ask "What do you want to do with the grapes"? Make jelly? Make wine? Who cares! \$\endgroup\$
    – user10326
    Jan 29, 2015 at 18:53
  • \$\begingroup\$ your question is poorly written... \$\endgroup\$
    – hassan789
    Feb 1, 2015 at 5:38
  • \$\begingroup\$ Who cares what I "do" with the tones? The objective is to discriminate one from the other with the FFT, that's it. Maybe when I see one tone, I'll open a relay. With another, I'll light up a 40' x 40' LED sign. What I do with them after, why does that matter? \$\endgroup\$
    – user10326
    Feb 2, 2015 at 15:52

1 Answer 1


This is a very well-written question and you are correct with regards to not really needing to know what you do with the signals.

There is always a tradeoff between frequency accuracy and temporal precision.

you have identified the shortest time-span of interest: 50ms. thus you need an FFT configuration that lets you see 50ms or quicker.

Your highest frequency is 40Hz. Therefor you want to sample at >= 80hz (nyquist rules). For simplicity lets sample at 120Hz.

120Hz / 256 = 0.46875 size frequency bins. You need a sample block size of 256 to work on to achieve this.

256 samples at 1200Hz takes 213.33 milliseconds to complete. That is your lag, plus you cannot determine when the tone occurred during that 213.33ms time.

  • \$\begingroup\$ You have made a couple assumptions that are not valid in general: (1) the resolution of the FFT is not equal to its precision, (2) a single unwindowed FFT is a relatively poor representation of the spectrum. Although in ideal circumstances it would work, in the real world, were the signals are not synchronized with the sampling, it would not. You need more margin than what you allocated. \$\endgroup\$ Feb 15, 2019 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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