Music Reactive LED Strip Using Arduino (Sound to Light Visualizer)

by AkshayProject in Circuits > Arduino

532 Views, 0 Favorites, 0 Comments

Music Reactive LED Strip Using Arduino (Sound to Light Visualizer)

IMG_20260915_101054.jpg
FVQAUK3MU1VJNO0.jpg

Do you want to bring your music to life? In this DIY tutorial, we will learn how to make a Music Reactive LED Strip using an Arduino, an sound/microphone module, and addressable WS2812B (NeoPixel) LEDs. This project syncs the flashing and colors of the LEDs with the beat and rhythm of your favorite songs, creating an amazing visualizer for your room, gaming setup, or party!

​Whether you are an electronics beginner or a seasoned maker, this step-by-step guide will help you build your own sound-reactive lighting system easily and affordably.

Disclaimer: This post contains affiliate links. If you purchase components through these links, I may earn a small commission at no extra cost to you.


Supplies

IMG_20260915_101940.jpg
IMG_20260915_101915.jpg
IMG_20260915_101415.jpg
IMG_20260915_101300.jpg
IMG_20260915_101233.jpg
  1. Microcontroller: Arduino Nano
  2. ​LEDs: WS2812B Addressable LED Strip
  3. ​Sound Sensor: Sound Detection Sensor Module KY-037 module
  4. ​Power Supply: MT3608
  5. ​Other Materials: soldering iron (optional)

Circuit Diagram & Connections

circuit_image (8).png
IMG_20260915_101328.jpg

​WS2812B LED Strip:

  1. ​VCC (5V): Connect to the positive terminal of the 5V external power supply.
  2. GND: Connect to the GND of the power supply and Arduino GND (Common Ground is mandatory!).
  3. Data In (DIN): Connect to Digital Pin 3 of the Arduino (or your chosen data pin).

Sound Sensor Module:

  1. ​VCC: Connect to 5V (or 3.3V depending on the module) on Arduino.
  2. ​GND: Connect to Arduino GND.
  3. AO (Analog Out): Connect to Analog Pin A0 of the Arduino

Tip: Always use a capacitor (around 1000µF) across the power supply lines to protect the LEDs from voltage spikes.

Arduino Code for Music Reactive LEDs

Upload the following code to your Arduino. Make sure you have installed the FastLED or Adafruit NeoPixel library via the Arduino IDE Library Manager before compiling.

#include <FastLED.h>

#define LED_PIN 3 // Arduino ki pin jisme LED ka DIN connected hai
#define NUM_LEDS 20 // Total LEDs ki sankhya
#define MIC_PIN A0 // Mic sensor ki Analog pin
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB

CRGB leds[NUM_LEDS];

// Sensitivity settings (Aap inhe apne mic ke hisaab se change kar sakte hain)
int noiseThreshold = 20; // Normal shor (noise) ko ignore karne ke liye
int maxVolume = 350; // Maximum volume ka level

void setup() {
Serial.begin(9600); // Serial monitor chalu karne ke liye (debugging ke kaam aayega)
// FastLED setup
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
// Brightness set karein (0 se 255). 100 safe hai MT3608 ke liye.
FastLED.setBrightness(100);
}

void loop() {
// Mic se sound ki reading lein
int micValue = analogRead(MIC_PIN);
// MAX4466 aur KY-038 normal state mein lagbhag 512 value dete hain.
// Hum current sound ko normal state se minus karke actual "volume" nikalenge.
int signal = abs(micValue - 512);

// Serial monitor par value dekhein (Mic adjust karne me madad karega)
Serial.println(signal);

// Sound signal ko 0 se lekar total LEDs (20) tak map karein
int ledsToLight = map(signal, noiseThreshold, maxVolume, 0, NUM_LEDS);
// Constrain ensures ki value 0 se kam ya 20 se zyada na ho
ledsToLight = constrain(ledsToLight, 0, NUM_LEDS);

// LEDs ko color dena
for (int i = 0; i < NUM_LEDS; i++) {
if (i < ledsToLight) {
// Color Range set karein
if (i < 10) {
leds[i] = CRGB::Green; // Pehli 10 LEDs Green
}
else if (i < 16) {
leds[i] = CRGB::Yellow; // Beech ki 6 LEDs Yellow
}
else {
leds[i] = CRGB::Red; // Aakhri 4 LEDs Red (High bass ke liye)
}
} else {
leds[i] = CRGB::Black; // Baaki LEDs off rahengi
}
}
FastLED.show();
delay(15); // Smooth animation ke liye thoda delay
}

Uploading and Testing

IMG_20260915_101052.jpg
IMG_20260915_101054.jpg
IMG_20260915_101049.jpg
IMG_20260915_101152.jpg
  1. Connect your Arduino to your computer via a USB cable.
  2. ​Open the Arduino IDE, select the correct Board (Arduino Nano) and Port from the Tools menu.
  3. ​Paste the code above, click the Upload button.
  4. ​Play some music near the microphone sensor and watch your LEDs dance to the rhythm!

Troubleshooting & Tips

  1. LEDs are flickering or not turning on? Check your Common Ground connection. The power supply GND and Arduino GND must be tied together.
  2. ​Sensor is too sensitive or unresponsive? Adjust the onboard potentiometer (blue screw) on your sound sensor module to calibrate the sensitivity.
  3. ​Power Issue: Do not power a long LED strip directly from the Arduino's 5V pin, as it can overheat the onboard regulator. Always use an external 5V power source.

Conclusion

Music Reactive LED Using Arduino 🎵 | Sound Reactive WS2812B LED Strip | DIY Project

Congratulations! You have successfully built your own Music Reactive LED Strip. You can mount this behind your desk, TV, or inside a custom enclosure to level up your room aesthetics.