One of the projects I've been involved in at Dynamic Controls is building a Dyno Bench - essentially a set of motors that are very well instrumented. With this bench we can measure all sorts of things like Motor Speeds, Voltages, Current, and temperatures.
Recently I've been investigating more and more in a live fashion - wanting to see changes in real time while I tweak parameters or inputs. I required a quick an easy way to see the frequencies present in an arbitrary signal. This is usually calculated after the test has run with a large Fast Fourier Transform. These calculations are quite expensive but with a small enough window and a powerful enough computer they can easily run in real time.
By considering the frequencies of interest, as well as the computation power you have to play with you can make the trade off between a small enough sampling time dt
and a large enough sample size n
For a problem on Friday I was interested in frequencies in the 10 - 100 Hz range, so I decided to take voltage measurements every 1 ms
and calculate the FFT with a 3 second
window. It worked rather well, identifying the strengths of each frequency I observed.
My fft calculation and display code was entirely separate from the data capture code so I decided to share it as a gist:5945252.
Hope it can be useful for someone