2
$\begingroup$

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

$\endgroup$
  • $\begingroup$ Do you know the exact frequencies or can it be anything in the given range? $\endgroup$ – Matt L. Jan 22 '15 at 17:16
  • $\begingroup$ Yes....the frequencies are known and exact. i.e, 31.5Hz $\endgroup$ – user10326 Jan 22 '15 at 21:54
  • 1
    $\begingroup$ If the set of possible frequencies is known in advance you could just use the FSK demodulator from the library. No need for an FFT. I thought the information is in the frequency of the tone only, but now you also mention the amplitude. So there's also information in the amplitude? What kind of modulation is it? $\endgroup$ – Matt L. Jan 23 '15 at 8:13
1
$\begingroup$

As I understand, you want to sample a noisy tone signal at 20dB SNR and in 10Hz-40Hz range with best possible amplitude and frequency accuracy using 12 bit ADC of STM32F4 ARM+DSP chip.

To get the most frequency accuracy you need more samples to be buffered and large FFt sizes for a given samplig rate Fs. This is for frequencies on a given range.

Using high sampling rate (oversampling) may be advantageous for increased SNRQ. See Sigma-Delta converters and Noise shapers for details.

Size of FIR filters: As again it is a direct compromise between computing power and processing quality. STM32F4 is quite powerful chip at 168 Mhz operating frequency and 32 bit FPU.

For FFT, you can write your own code if you have time. I can provide you a butterfly implementation. Or you better use it from some free library.

You should select long fft sizes for better frequency resolution.

please have a look at this document: http://support.ircam.fr/docs/AudioSculpt/3.0/co/Window%20Size.html

$\endgroup$
  • $\begingroup$ Bulent - thank you for taking the time to reply. As mentioned, I can use libraries from Siglib or CMSIS DSP. I can sample as fast as required - by DMA driven or timer. However, a large sample buffer uses a lot of memory at high rates. The STM32F4 operates at 168MHz, so processing power isn't an issue. I thought frequency resolution was related to FFT size vs sampling rate? I'm not sure what you mean by "what kind of processing" - it's pretty much as I described, I'm trying to end up with a buffer of validated flags as to whether or not I did detect specific tones. $\endgroup$ – user10326 Jan 22 '15 at 21:54
  • $\begingroup$ @user10326 Frequency resolution of DFT X[k] of sampled signal x[n] depends on the size N of the FFT for a given sampling rate Fs. Large Fs will give you less resolution for a given window size N. (sorry if I mixed it on the post) Also an N-point FFT requires that, N , many samples to be buffered. And that also reqires the signal to have a long duration (long enough observation window). Please refer to Time-Frequency analysis for a discussion of frequency resolution vs signal duration. $\endgroup$ – Fat32 Jan 22 '15 at 22:33
0
$\begingroup$

I don't know all the details of your problem, such as signal stability, timing accuracy and so on, so I'll presume a few things and suggest using an FFT based Gaussian ratio technique (download tutorial4 and related C++ code example at:)

http://www.fftguru.com/

The technique has been known, although not widely so, since 1991. Basically, it depends on using a Gaussian window on the input data, followed by an FFT, then it computes frequency and amplitude based on the natural log values of the FFT. A related technique is used at CERN, and they've done extensive analysis on it.

Based on your signals going up to 40 Hz, your minimum sample rate would be 80 Hz. But since your Fc is 55 Hz, if you have anything from 40 to 55 Hz, it will alias, so your minimum sample rate has to be at least 110 Hz. And your other requirements may force you to accept a higher rate.

But there are other issues independent of sample rate. First, you have sinusoidal signals from 10 to 40 Hz that exist for 200-300 msec (.2-.3 sec.). For a 10 Hz input, that works out to be only 2 to 3 cycles (and 8-12 cycles for a 40 Hz input). And keep in mind that a higher sample rate will not increase either the length of the signal or the number of cycles.

Second, since you have a 50-100 msec dead time between signals, you'll have to synchronize your processing with the input. You may want to have some kind of 'signal present' or 'not present' detector Given that your 10 Hz input would have a different rise/fall time than a 40 Hz input, such a detector may be overly complicated for you. So in the interest of keeping things simple, let's just presume your signal and dead time are stable with regards to their timing, and you can somehow determine when things start and stop.

So let's presume 300 msec signals, and 100 msec dead times for a total of 400 msec (.4 sec). Since you'll be windowing the inputs, it would be best if you had 50 msec of dead time, followed by 300 msec of signal, followed by 50 msec of dead time. Windows tend to deemphasize the beginnings and ends of signals, so the above would be desirable. Maybe you'd need to have a 50 msec dead time detector. As soon as you determine that exactly 50 msec of dead time have been received, you'd begin to receive the other 50 msec of dead time, then the 300 msec signal, and then another 50 msec dead time (total 400 msec). You might think that this is very simple - I can assure you that it isn't. Synchronizing things can present some pretty tricky coding problems, especially if you're using interrupts to get your A/D samples, (or you have asynchronous inputs).

Once you've collected one block of data, you'd apply the Gaussian window and compute frequency and amplitude. Then you'd wait for the next block. You may have to adjust your frequency and amplitude estimates somewhat if you're including the dead time in your FFT (no adjustment needed if you can synchronize exactly and pick out just signal only).

As for sample rate, you should probably plan on using 2 to 4 (or more) times the minimum of 110 Hz. So perhaps 200 to 400 samples/sec. would be appropriate. More samples/sec will help you better average out the noise. But it costs more in processing power.

Your FFT and buffer size will follow directly from your choice of sample rate. So if you choose 400 samples/sec, your 300 msec signal plus 100 msec dead time would require: 400 samples/sec x .4 sec = 160 samples. If your code libraries don't accommodate non-power of 2 FFT sizes, you'll have to crunch the numbers with that restriction in mind.

$\endgroup$

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.