2014-07-20 00:55:27 +00:00
|
|
|
arduinoFFT
|
|
|
|
==========
|
|
|
|
|
|
|
|
Fast Fourier Transform for Arduino
|
2014-07-20 01:01:14 +00:00
|
|
|
|
|
|
|
This is a fork from https://code.google.com/p/makefurt/ which has been abandoned since 2011.
|
2014-07-20 01:08:55 +00:00
|
|
|
|
2014-11-09 08:03:01 +00:00
|
|
|
<del>This is a C++ library for Arduino for computing FFT.</del> Now it works both on Arduino and C projects.
|
2014-07-20 03:42:36 +00:00
|
|
|
|
2017-04-25 20:26:25 +00:00
|
|
|
Tested on Arduino 1.6.11
|
2014-07-20 01:08:55 +00:00
|
|
|
|
2017-04-25 20:26:25 +00:00
|
|
|
### Installation on Arduino
|
2014-07-20 01:08:55 +00:00
|
|
|
|
2018-02-10 20:01:14 +00:00
|
|
|
Use the Arduino Library Manager to install and keep it updated. Just look for arduinoFFT. Only for Arduino 1.5+
|
|
|
|
|
|
|
|
### Manual installation on Arduino
|
|
|
|
|
2014-07-20 03:42:36 +00:00
|
|
|
To install this library, just place this entire folder as a subfolder in your Arduino installation
|
2014-07-20 01:08:55 +00:00
|
|
|
|
|
|
|
When installed, this library should look like:
|
|
|
|
|
2014-07-20 03:42:36 +00:00
|
|
|
Arduino\libraries\arduinoFTT (this library's folder)
|
|
|
|
Arduino\libraries\arduinoFTT\arduinoFTT.cpp (the library implementation file, uses 32 bits floats vectors)
|
2017-04-25 20:26:25 +00:00
|
|
|
Arduino\libraries\arduinoFTT\arduinoFTT.h (the library header file, uses 32 bits floats vectors)
|
2014-07-20 03:42:36 +00:00
|
|
|
Arduino\libraries\arduinoFTT\keywords.txt (the syntax coloring file)
|
|
|
|
Arduino\libraries\arduinoFTT\examples (the examples in the "open" menu)
|
|
|
|
Arduino\libraries\arduinoFTT\readme.md (this file)
|
2014-07-20 01:08:55 +00:00
|
|
|
|
2017-04-25 20:26:25 +00:00
|
|
|
### Building on Arduino
|
2014-07-20 01:08:55 +00:00
|
|
|
|
|
|
|
After this library is installed, you just have to start the Arduino application.
|
|
|
|
You may see a few warning messages as it's built.
|
|
|
|
|
|
|
|
To use this library in a sketch, go to the Sketch | Import Library menu and
|
2014-07-20 03:42:36 +00:00
|
|
|
select arduinoFTT. This will add a corresponding line to the top of your sketch:
|
2014-07-30 14:41:55 +00:00
|
|
|
|
|
|
|
`#include <arduinoFTT.h>`
|
2014-11-09 08:03:01 +00:00
|
|
|
|
2017-04-25 20:26:25 +00:00
|
|
|
### TODO
|
|
|
|
* Ratio table for windowing function.
|
|
|
|
* Document windowing functions advantages and disadvantages.
|
|
|
|
* Optimize usage and arguments.
|
|
|
|
* Add new windowing functions.
|
2018-02-10 20:01:14 +00:00
|
|
|
<del>* Spectrum table? </del>
|
2017-04-26 13:46:41 +00:00
|
|
|
|
|
|
|
### API
|
|
|
|
|
|
|
|
* **arduinoFFT**(void);
|
2018-02-10 20:01:14 +00:00
|
|
|
* **arduinoFFT**(double *vReal, double *vImag, uint16_t samples, double samplingFrequency);
|
2017-04-26 13:46:41 +00:00
|
|
|
Constructor
|
|
|
|
* **~arduinoFFT**(void);
|
|
|
|
Destructor
|
|
|
|
* **ComplexToMagnitude**(double *vReal, double *vImag, uint16_t samples);
|
2018-02-10 20:01:14 +00:00
|
|
|
* **ComplexToMagnitude**();
|
2017-04-26 13:46:41 +00:00
|
|
|
* **Compute**(double *vReal, double *vImag, uint16_t samples, uint8_t dir);
|
|
|
|
* **Compute**(double *vReal, double *vImag, uint16_t samples, uint8_t power, uint8_t dir);
|
2018-02-10 20:01:14 +00:00
|
|
|
* **Compute**(uint8_t dir);
|
2017-04-26 13:46:41 +00:00
|
|
|
Calcuates the Fast Fourier Transform.
|
2018-11-24 10:42:59 +00:00
|
|
|
* **DCRemoval**(double *vData, uint16_t samples);
|
|
|
|
* **DCRemoval**();
|
|
|
|
Removes the DC component from the sample data.
|
2017-04-26 13:46:41 +00:00
|
|
|
* **MajorPeak**(double *vD, uint16_t samples, double samplingFrequency);
|
2018-02-10 20:01:14 +00:00
|
|
|
* **MajorPeak**();
|
2021-02-05 16:24:36 +00:00
|
|
|
* **MajorPeakParabola**();
|
2018-02-10 20:01:14 +00:00
|
|
|
Looks for and returns the frequency of the biggest spike in the analyzed signal.
|
2017-04-26 13:46:41 +00:00
|
|
|
* **Revision**(void);
|
|
|
|
Returns the library revision.
|
|
|
|
* **Windowing**(double *vData, uint16_t samples, uint8_t windowType, uint8_t dir);
|
2018-02-10 20:01:14 +00:00
|
|
|
* **Windowing**(uint8_t windowType, uint8_t dir);
|
2017-04-26 13:46:41 +00:00
|
|
|
Performs a windowing function on the values array. The possible windowing options are:
|
|
|
|
* FFT_WIN_TYP_RECTANGLE
|
|
|
|
* FFT_WIN_TYP_HAMMING
|
|
|
|
* FFT_WIN_TYP_HANN
|
|
|
|
* FFT_WIN_TYP_TRIANGLE
|
2018-10-26 10:24:13 +00:00
|
|
|
* FFT_WIN_TYP_NUTTALL
|
2017-04-26 13:46:41 +00:00
|
|
|
* FFT_WIN_TYP_BLACKMAN
|
2018-10-26 10:24:13 +00:00
|
|
|
* FFT_WIN_TYP_BLACKMAN_NUTTALL
|
|
|
|
* FFT_WIN_TYP_BLACKMAN_HARRIS
|
2017-04-26 13:46:41 +00:00
|
|
|
* FFT_WIN_TYP_FLT_TOP
|
|
|
|
* FFT_WIN_TYP_WELCH
|
|
|
|
* **Exponent**(uint16_t value);
|
|
|
|
Calculates and returns the base 2 logarithm of the given value.
|