Arduino FFT


long time ago i was searching for FFT and arduino, i did find very good example but i didn't save him. Guy was printing output fft data with kind of spectrum using "*" symbols in serial monitor.

8 **********
12 *****
13 ****************
1 2 3 4 ...

So, did anyone has a clue for this article?

Thank you

I know a german article which fits your description, if that helps: Eine einfache FFT – Fast Fourier Transformation – mit dem Arduino Uno | Shelvin – Elektronik ausprobiert und erläutert

lg, couka

Perhaps my thread here?


For a given input signal, any FFT program will give you an amplitude corresponding to a frequency bin.

It should not be difficult for you to figure out how to print a number of * on the serial monitor corresponding to that amplitude, but if you need help, let us know.

Hi, Thank you for reply.

It was something like el_supremo thread but not exactly.

I've developed EEG shield for arduino. From this shield i am able to read voltage changes of EEG signal. I do have 6 channels so i am looking for something like: numpy.fft.fft — NumPy v1.21 Manual

basically i just need to be able to push let say array with 256 voltage levels into something like output = fft(input)

but i need from it to be efficient so i do not quite want to rewrite fft equation.

Thank you for fix_fft I am going to find out what it does and if i can use it for this purpose :slight_smile:


Very efficient Arduino FFT functions.

Hi !

I as able to code working example using arduino FHT library its here:

#define LOG_OUT 1 // use the log output function
#define FHT_N 128 // number of samples
#include <FHT.h>
#include <compute_freqency.h>

#define SAMPLE_RATE 128
#define AMPLITUDE 70

double re[FHT_N] = {0,};
unsigned i = 0;
void setup() {
  pinMode(9, OUTPUT);
  pinMode(8, INPUT);
  // Create FHT_N samples of a single freqency  tone
  const double freqency = 63;
  double phase = 0.0;
  for (unsigned i = 0; i < FHT_N; i++) {
    // a sample of wave
    re[i] = AMPLITUDE * sin(phase * 2.0 * PI);
    // update the phase of wave 1
    phase += freqency / SAMPLE_RATE;
    if (phase >= 1)phase -= 1;

void loop() {
  tone(9, 15);
  if (i < FHT_N)
    fht_input[i] = re[i];
  } else

    double frq = frequency(fht_log_out, SAMPLE_RATE, FHT_N);
    i = 0;
    //  for (int curBin = 0; curBin < FHT_N / 2; ++curBin)
    //  {
    //    fht_log_out[0] = 0;
    //    fht_log_out[1] = 0;
    //    Serial.print(fht_log_out[curBin]);
    //    if (curBin < (FHT_N / 2) - 1)
    //      Serial.print(",");
    //    else
    //    {
    //      Serial.println(";");
    //    }
    //  }

Note that I am not using for() because of that tone() above.
but i do have problem working with actual analog/digital inputs. When i replace part, which loads created data for

if (i < FHT_N)
    fht_input[i] = digitalRead(8);
  } else

I am not able to read/detect value typed in tone(), i have used also another arduino as generator, but with no success.

PS compute_freqency.h just finds max value in fht output and calculates frequency.

Thank You for support.