A spectrum analyzer VU meter running a 40kHz FFT on an ESP32 and outputting to a 16 x 16 FastLED matrix. The code is heavily modified from this example originally written by G6EJD.
If you are planning on using this code, it is advisable to watch the YouTube video below explaining how it works. Please note, the code has changed to use FastLED Neomatrix since the video was produced thanks to VonHirsch. See 'Installation and code usage' below.
The matrix will run from both a line input or microphone, so choose whichever setup works for you. When choosing the pin for your button, be careful. Some pins on the ESP32 don't have pullup resistors, and if you choose one of these the button won't work! When I was testing, I found that D2 didn't work, but D4 did so I went with that one.
The incoming stereo signal is first converted to mono using two 10K resistors, then through a 100nF capacitor to block DC. The signal is then biased by two 100k resistors to 3.3V / 2 = 1.65V to be read by the ADC. None of these values are critical. The resistors should be 10k or above and each pair should match. I've tried capacitors from 100nF to 10uF and haven't noticed any difference in the results. Pin D5 is the LED data pin and is connected to the first LED in the matrix. Pin D2 is connected to a momentary push button which is used to change display modes.
This is much simpler than the line in method, but you will be limited to the frequencies that you can detect by the sensititivy of the microphone. You need a mic with on-board amplification, commonly something like the MAX4466 which can be bought cheaply from eBay or alixepress. You would get better results with an I2S microphone, but that is beyond the scope of this project. Turn up the gain on whatever microphone you have. The mic should be connected to GND, 3V3 and the output pin to D35. Pin D5 is the LED data pin and is connected to the first LED in the matrix. Pin D2 is connected to a momentary push button which is used to change display modes.
DCRemoval()
from working, so download it from the GitHub repository and install it from a zip file.The matrix is controlled from a single button. The functions are:
Due to a copyright claim by G6EJD, the MIT license for this project has been withdrawn, and his licence now applies. This can be found in LICENCE.txt. As I would like this code to be MIT licenced going forward, any code that originated with G6EJD will be replaced at a future date and the information on this page updated to reflect this.