โ† Back to Advanced Projects

๐ŸŽถ OLED Audio Spectrum Analyzer

Visualize music as a real-time 7-band animated frequency spectrum on an OLED.

๐Ÿ“‹ Overview

The MSGEQ7 is a dedicated audio equalizer IC that splits the audio spectrum into 7 bands (63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz, 16kHz) and outputs each band's amplitude as an analog voltage. This project reads all 7 levels and renders an animated bar graph on a 128ร—64 SSD1306 OLED.

What you'll learn: Audio signal path design, MSGEQ7 strobe/reset control, multiplexed analog reading, OLED graphics with the U8g2 library, and smooth peak-hold animations.

Estimated time: 2โ€“3 hours. Difficulty: โญโญโญ Intermediate.

๐Ÿงฉ Components Needed

ComponentSpecificationQtyNotes
Arduino Nano5V, ATmega328P1Compact for a final build
MSGEQ7 ICPDIP-817-band spectrum analyzer chip
0.96" I2C OLEDSSD1306 128x641Display output
Audio Jack 3.5mmStereo to mono mix1Input from phone/PC
0.1ยตF & 33pF CapsCeramic2 eachMSGEQ7 filter network
200kฮฉ Resistor1/4W1MSGEQ7 input bias

๐Ÿ“– Step-by-Step Tutorial

1

Build MSGEQ7 Filter Circuit

Connect Pin 1 (GND), Pin 2 (Vout โ†’ A0), Pin 3 (GND), Pin 4 (Reset โ†’ D5), Pin 5 (Strobe โ†’ D4), Pin 6 (+5V), Pin 7 (Input via 0.1ยตF cap from audio). Add 33pF cap from Pin 8 to GND.
2

Wire the OLED

Connect OLED SDA โ†’ A4, SCL โ†’ A5, VCC โ†’ 3.3V, GND โ†’ GND on the Nano.
3

Install Libraries

Install U8g2 by Oliver Kraus from Library Manager. It provides high-performance OLED graphics primitives.
4

Read 7 Band Values

Toggle the Strobe pin LOW/HIGH 7 times. After each toggle, read A0 โ€” this gives the amplitude for each of the 7 frequency bands in sequence.
5

Render Animated Bars

Map each band value (0โ€“1023) to a bar height (0โ€“64 pixels). Draw filled rectangles for bars and track a falling peak dot per band for a professional VU meter look.
๐Ÿ’ก
Audio signals from headphone jacks are very weak (millivolts). Add a non-inverting op-amp gain stage (e.g., TL072 with 10x gain) before the MSGEQ7 input for much stronger, cleaner bar graphs.

๐Ÿ’ป Code / Configuration

oled_spectrum.ino
INO
// OLED Audio Spectrum Analyzer - Volt X
#include <U8g2lib.h>
#include <Wire.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);

const int strobePin = 4;
const int resetPin  = 5;
const int audioPin  = A0;

int spectrum[7];
int peaks[7];
int peakHold[7];

const char* freqLabels[] = {"63", "160", "400", "1k", "2.5k", "6.25k", "16k"};

void readMSGEQ7() {
  digitalWrite(resetPin, HIGH); delayMicroseconds(5);
  digitalWrite(resetPin, LOW);
  for (int i = 0; i < 7; i++) {
    digitalWrite(strobePin, LOW); delayMicroseconds(36);
    spectrum[i] = analogRead(audioPin);
    digitalWrite(strobePin, HIGH); delayMicroseconds(1);
  }
}

โญReviews & Ratings

โ€”0 reviews
5โ˜…
0
4โ˜…
0
3โ˜…
0
2โ˜…
0
1โ˜…
0
...

Loading reviews...