1
$\begingroup$

I have an electrical current sensor which generates measurements every second. I want to calculate the FFT of this signal. Since my real-time values are received every second, I think that the fastest I can go with the FFT sampling period is also 1 sec. In that case, what I am basically doing is that I collect X number of samples in a buffer and I calculate the FFT. I then store the new values as they arrive at the end of this buffer and repeat the FFT calculation.

Q1: is this a correct setup? Q2: is there a minimum requirement for the buffer (FFT window?). I have now set it up to process 10 samples. Q3. what is the maximum number of frequencies that can be detected in this scenario?

$\endgroup$
1
  • $\begingroup$ As Hilmar very well stated in their comment you should really consider going through the anti-aliasing step. Now, I would only like to add that since your acquisition is so slow you could also use an algorithm for the FFT which updates with every single sample that is being introduced. The term is Sliding-DFT (or FFT) and the mindset is similar to other "moving" algorithms (such as moving average, moving RMS, etc.). You can find more information about it here [ en.wikipedia.org/wiki/Sliding_DFT ] and here [ music.mcgill.ca/~ich/research/misc/papers/cr1137.pdf ]. $\endgroup$
    – ZaellixA
    Jun 9, 2022 at 14:51

1 Answer 1

1
$\begingroup$

Q1: is this a correct setup?

I'm guessing "no" but that really depends on your application and goal. The process will produce numbers but if these numbers are useful or not depends on what you want to do with them.

Q2: is there a minimum requirement for the buffer (FFT window?).

Mathematically speaking : no. You can run a FFT on a single sample if you want to. t doesn't do anything useful but it can be done. The real requirements come from your application.

I have now set it up to process 10 samples. Q3. what is the maximum number of frequencies that can be detected in this scenario?

An FFT setup like this will you give you ten numbers which are the complex amplitudes from -0.5Hz to +0.5Hz in 0.1 Hz steps. That's not the only frequencies you "detect" but that's a more complicated topic. If you feed a 0.15Hz sine wave in the process all 10 numbers will be non-zero.

You may also get significant aliasing with this setup, if you don't use a decent anti-aliasing filter before the current sensor.

$\endgroup$
4
  • 1
    $\begingroup$ thank you for your answer. The idea is that, although the sensor measures the DC current that passes through it, the FFT would give me some understanding of the noise in the signal (in fact I'm going to do some experiments which I hope that will introduce some noise and hence the FFT will detect it). The sensor is a commercial product so I can't mess around with it. I simply push the measurements to a python script I'm creating for the FFT calculation. All in all, I'm bound to detect frequencies from -0.5Hz to 0.5Hz because of the 1sec sampling restriction correct? $\endgroup$
    – Jimakos
    May 15, 2021 at 16:36
  • 1
    $\begingroup$ Sort of. Are you familiar with the sampling theorem and aliasing ? $\endgroup$
    – Hilmar
    May 16, 2021 at 2:10
  • 1
    $\begingroup$ It's been years since I studied DSP in the uni. In general I know that the selected FFT size directly affects the resolution of the resulting spectra (I think because of the Nyquist theorem i should get half the spectrum - so in my case for 10 samples I should get 5 measurements). The frequency resolution of each spectral line is equal to the sampling rate divided by the FFT size. For instance, in my case with the FFT size being 10 and the Sampling Rate is 1, the resolution of each spectral line will be: 1 / 10 = 0.1 Hz. I'm not familiar with aliasing $\endgroup$
    – Jimakos
    May 25, 2021 at 6:35
  • 1
    $\begingroup$ Sorry to say that: but if you don't what aliasing is, you should maybe read up on the basics of sampling and spectral analysis before writing code: sampling theorem, aliasing, periodicity pf discrete signals, spectral leakage, windowing, etc. Without the basics, you are at risk of making significant mistakes. $\endgroup$
    – Hilmar
    May 26, 2021 at 13:28

Your Answer

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

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