DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkESD damage is real — protecting your components
Building an Audio Spectrum Analyzer
Built a real-time audio spectrum analyzer on a 128x64 OLED using an Arduino Uno and the MSGEQ7 chip. The MSGEQ7 is an analog filter bank that outputs the amplitude of 7 frequency bands (63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz, 16kHz) multiplexed on a single analog pin.
The MSGEQ7 needs a strobe pulse to reset the multiplexer and a clock pulse to advance through each channel. Read all 7 analog values in under 1ms, map them to display rows, and draw the bar chart. At 30fps the display updates smoothly with music.
For a more capable analyzer, the ESP32's I2S ADC sampling at 44.1kHz combined with a software FFT (arduinoFFT library) gives 256 frequency bins. The FFT requires more CPU but gives much finer frequency resolution and lets you implement features like peak hold and logarithmic frequency scaling.