Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.91 KB

README.md

File metadata and controls

47 lines (31 loc) · 1.91 KB

kissFFT Adaptation for the ESP32 or any other microcontroller

This is a personal adaptation for the ESP32 microcontroller of the well known kissFFT library.

FFTProcessor Class

Usage example:

Invoke a instance of the FFTProcessor class.

FFTProcessor *FFT = new FFTProcessor(SIGNAL_LENGTH, WINDOW_SIZE);

This software works perfect when AUDIO_LENGHT and WINDOW_SIZE are equal and less than 1300.

Test the code with a sine wave. First create a sine wave of frecuency "freq" and Number of samples equal to AUDIO_LENGTH.

float *sin_200 = FFT->sin_wave(freq, SIGNAL_LENGTH);

(Take in mind that freq has to be < SIGNAL_LENGTH/2). For example, if SIGNAL_LENGTH = 1200 -> freq < 600.

Compute the FFT of the signal:

FFT->computeFFT(sin_200);

You can then see the output with various functions (I'll be adding more when i have the time):

- FFT->print_energy_python(); -> prints the FFT result in a python array style.
- FFT->print_energy();        -> prints the absolute value of each frecuency.
- FFT->print_complex();       -> prints the result for each frecuency in their complex format ( real + i*imag )

Output of ESP32 FFT of the 200Hz sine wave.

ESP32 200Hz Sine Wave Output

Testing with a real EMG signal:

real emg signal (You can find this signal in 'data.h')

After applyig the FFT to the signal, we can compare the output of the spectral density generated by the ESP32 with the result generated by the python FFT algorithm.

Python FFT Output ESP32 FFT Output