Projects / Music-reactive LED strip

Music-reactive LED strip

Intermediate1.3 hGuided buildReviewed

Build it step by step

0 of 4 done
  1. NANOMAX4466

    Wire the microphone

    VCC to 3V3 (not 5V, for less noise), GND, OUT to A0.

  2. NANO11.8 mA

    Power and wire the strip

    As in the LED strip build: 5 V supply with 1000 µF, D6 through 330 Ω to DIN, shared ground.

  3. NANOMAX4466

    Set the gain

    Turn the MAX4466 trimmer to the middle to start.

  4. NANO11.8 mA

    Upload and play music

    Play music at normal volume 1 to 2 m away and adjust the gain trimmer until loud parts reach the end of the strip.

In short

How do you build a music-reactive LED strip?

A MAX4466 microphone picks up music and an Arduino turns its loudness into a VU-meter bar on a WS2812B strip. You need Arduino Nano, MAX4466 microphone module, WS2812B addressable RGB LED strip (1 m, 60 LEDs), Resistor 330 Ω, Electrolytic capacitor 1000 µF, 5 V 3 A USB buck module (12/24 V to USB), 12 V 2 A DC adapter and Jumper wires male to male (40 pcs, 20 cm). It takes 4 steps and about 75 minutes.

Level
Intermediate
Time
About 75 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
MAX4466 VCC / GNDNano 3V3 / GNDThe quietest supply on the board
MAX4466 OUTNano A0Audio centred at about 1.65 V
Strip 5V / GND5 V supply, 1000 µF acrossStrip power
Nano D6330 Ω to strip DINLED data
Nano 5V / GND5 V supplyBoard power, shared ground

Code

Arduino IDE, board "Arduino Nano". Install "FastLED". Tune the 15 and 400 in map() for your room.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <FastLED.h>

const int N = 60, PIN = 6, MIC = A0;
CRGB leds[N];
float level = 0, peak = 0;

void setup() {
  FastLED.addLeds<WS2812B, PIN, GRB>(leds, N);
  FastLED.setMaxPowerInVoltsAndMilliamps(5, 2000);
  FastLED.setBrightness(150);
}

void loop() {
  unsigned long start = millis();
  int lo = 1023, hi = 0;
  while (millis() - start < 25) {            // 25 ms window catches bass notes
    int v = analogRead(MIC);
    lo = min(lo, v); hi = max(hi, v);
  }
  int p2p = hi - lo;                          // louder = bigger swing
  float target = constrain(map(p2p, 15, 400, 0, N), 0, N);
  level = target > level ? target : level * 0.85 + target * 0.15;   // fast attack, slow fall
  if (level > peak) peak = level; else peak -= 0.3;
  for (int i = 0; i < N; i++) leds[i] = i < level ? CRGB(CHSV(96 - i * 96 / N, 255, 255)) : CRGB::Black;  // green to red
  if (peak > 0) leds[min((int)peak, N - 1)] = CRGB::White;
  FastLED.show();
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Quiet roomZero to two LEDs lit
Speech at 1 mAbout a quarter of the strip
Loud musicBar jumps to the red end, white peak dot falls back slowly

If it does not work

Always full

Gain too high. Turn the trimmer anticlockwise, or raise 400 in map().

Never moves

Check OUT goes to A0 and the module has power. Clap close to it to test.

Flicker in silence

Raise 15 in map() to 30 to hide background noise.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the music-reactive LED strip?

Arduino Nano, MAX4466 microphone module, WS2812B addressable RGB LED strip (1 m, 60 LEDs), Resistor 330 Ω, Electrolytic capacitor 1000 µF, 5 V 3 A USB buck module (12/24 V to USB), 12 V 2 A DC adapter and Jumper wires male to male (40 pcs, 20 cm).

How long does the music-reactive LED strip take to build?

About 75 minutes for a intermediate maker, in 4 steps.

How do I know the music-reactive LED strip works?

Quiet room: Zero to two LEDs lit. Speech at 1 m: About a quarter of the strip. Loud music: Bar jumps to the red end, white peak dot falls back slowly.

Always full: what should I check?

Gain too high. Turn the trimmer anticlockwise, or raise 400 in map().

Never moves: what should I check?

Check OUT goes to A0 and the module has power. Clap close to it to test.

Flicker in silence: what should I check?

Raise 15 in map() to 30 to hide background noise.