Intrigued by this post, I wanted to try the same thing with the Graphics Board.
So here goes:
A real-time Spectrum Analyzer, with due credit to “deif” on the Arduino forum for making Tom Roberts’ simple 8-bit FFT implementation available (three more people are credited in the source code). On the above display you can see a typical “power spectrum”, with one dominant frequency plus harmonics at fixed intervals.
The sketch can be found here:
This is almost the same code as the 100 KHz DSO sketch, just extended with FFT.
The LCD is refreshed at maximum speed. As you can see, the lag of the LCD itself is actually quite useful in this context. This did bring a bug to the surface: I’ve noticed that the speed-up I implemented for the ST7565 was slightly too fast for this chip. After running for a while, the display would just turn black and stop refreshing.
So I changed these two lines in ST7565::spiwrite() :
… to this, slightly slower but equivalent code:
I’ve also updated my version of the ST7565 ZIP file accordingly.
One more note about this code is that it uses most of the available RAM now: the 1 Kb buffer in the ST7565 library, plus two 256-char arrays to store 256 datapoints for running the FFT on.
With code such as this, it would actually be possible to get rid of the ST7565 buffer, since we’re re-constructing the entire display each time.
But for now, I’ll just leave it at this…
How do you phisicaly connect this to the 230V, 50Hz main line ?
Don’t understand the question… I never did that – why would you want to?
Any numbers on how fast the display refresh rate is ? (i.e. how much time does the FFT take ?) thanks for a inspiring weblog! /Thomas
Easy to find out. Results: FFT takes 21 ms, LCD display update takes 15 ms. So that’s roughly 30 FPS.
You could connect it to the power line in order to analyze harmonics