Oscilloscope with FFT, using a 1.8" TFT


In this sketch we tried to combine the display in time domain and in frequency domain. We used the PlainFFT code published by Didier Longueville but for speed reasons we removed all unnecessary variables and parameters.

The bitreverse which is needed for the FFT and nomally calculated at run-time was generated with spreadsheet software and included as an array.

Also the loop of analogRead commands was generated as a series of commands using spreadsheet software.


Above you see the TFT display connected to an Arduino NANO showing a square wave signal.


With 128 samples you get 64 values in the frequency spectrum.
Not surprising, it shows not only the fundamental frequency but also the third, the fifth and the seventh harmonics.


After reading the samples the program shows the time response of the input signal, then clears the screen an shows the Fourier spectrum.

Download the source:

the sketch

the bit reverse array

the "loop" of analogRead()

If you want to see the autocorrelation as well just use the TFTGraphAutoKo sketch.




contact: nji(at)gmx.de