šµ ESP32 Music Visualizer with LEDs
š 1. Introduction
A music visualizer converts audio signals into dynamic visual effects.
In this project, an ESP32 reads sound from a microphone module, processes the signal, and drives addressable LEDs (WS2812B/Neopixel or RGB strips) to create colorful visual patterns that react to music beats.
šÆ 2. Objectives
- To design a low-cost audio visualizer using ESP32.
- To capture real-time sound input via a microphone/ADC.
- To display LED patterns based on sound intensity and frequency.
- To understand the application of FFT (Fast Fourier Transform) in audio processing.
āļø 3. Hardware Requirements
- ESP32 Development Board
- Microphone Module (MAX9814 / MAX4466 / INMP441 I²S Mic)
- WS2812B Addressable LED Strip (Neopixel)
- 5V Power Supply (depending on LED strip length)
- Jumper wires, breadboard
š 4. Circuit Connections
ESP32 ā Microphone (I²S INMP441 example)
- INMP441 SCK ā GPIO14
- INMP441 WS ā GPIO15
- INMP441 SD ā GPIO32
- VCC ā 3.3V
- GND ā GND
ESP32 ā WS2812B LED Strip
- Data Pin ā GPIO5
- VCC ā 5V
- GND ā GND
š 5. Arduino Code (Basic Music Visualizer)
#include <FastLED.h>
#define LED_PIN 5
#define NUM_LEDS 60
#define BRIGHTNESS 180
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
// Microphone pin (Analog)
#define MIC_PIN 34
void setup() {
Serial.begin(115200);
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
int micValue = analogRead(MIC_PIN); // Read sound level
int level = map(micValue, 0, 4095, 0, NUM_LEDS); // Scale to LED count
// Light up LEDs based on sound intensity
for (int i = 0; i < NUM_LEDS; i++) {
if (i < level) {
leds[i] = CHSV(map(i, 0, NUM_LEDS, 0, 255), 255, 255);
} else {
leds[i] = CRGB::Black;
}
}
FastLED.show();
delay(10);
}
š Working Principle
The ESP32 music visualizer works as follows:
Audio Signal Capture
- A microphone module (MAX9814 / INMP441 / MAX4466) detects sound vibrations from music or voice.
- The analog or I²S digital signal is fed into the ESP32.
Signal Processing
- The ESP32 reads the sound level using its ADC (analog-to-digital converter).
- The amplitude (loudness) of the signal is calculated in real time.
- (Optional: FFT can be applied to split the signal into bass, mid, and treble frequency bands).
LED Mapping
- The processed sound values are mapped to brightness, color, and number of LEDs.
- Louder music lights up more LEDs, while softer sounds light fewer.
- Colors shift dynamically (e.g., rainbow effects using HSV mode) to make the visualization attractive.
Real-Time Visualization
- The LED strip updates continuously, creating a visual effect that reacts instantly to music beats and rhythm.
š Conclusion
The ESP32 Music Visualizer with LEDs demonstrates how sound signals can be transformed into real-time visual effects.
By combining an ESP32 microcontroller, a microphone module, and addressable LEDs, the system successfully converts music loudness and rhythm into dynamic light patterns.
Key outcomes:
- Provides an interactive and entertaining way to visualize sound.
- Teaches students the fundamentals of signal processing, ADC sampling, and LED control.
- Serves as a foundation for advanced visualizers using FFT frequency analysis for richer effects.
This project is not only a fun DIY application but also a practical embedded systems experiment that blends electronics, programming, and creativity.