Projects / Sound-reactive LED costume

Sound-reactive LED costume

Beginner2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. XIAO

    Plan the LED runs

    Keep each segment short.

  2. XIAO14.6 mA

    Test the strip on the bench

    A simple colour sweep.

  3. XIAOMAX4466

    Add the microphone

    Check the level on the serial plotter.

  4. XIAO14.7 mA

    Set the gain

    Quiet speech lights a few LEDs.

  5. XIAO14.7 mA

    Sew the strip on

    Use silicone wire and slack.

  6. XIAO

    Pocket the board and bank

    Keep them dry.

  7. XIAO

    Test it with music

    Adjust the brightness cap.

In short

How do you build a sound-reactive LED costume?

LED strips sewn on a jacket pulse with music from a small microphone, powered by a power bank. You need Seeed XIAO RP2040, WS2812B strip 5 m (30 LEDs/m), MAX4466 microphone module, USB A to USB-C cable (data) and Resistor 330 Ω. It takes 7 steps and about 120 minutes.

Level
Beginner
Time
About 120 min
Parts
5

Parts list

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

Wiring

FromToWhy
MAX4466 OUTXIAO A0 (D0)Microphone signal
MAX4466 VCC and GNDXIAO 3V3 and GNDPower (output sits at about half of 3.3 V)
Strip DIN330 ohm resistor to XIAO D1LED data
Strip 5VXIAO 5V pin (comes from USB-C)LED power
Strip GNDXIAO GNDCommon ground
USB-C leadPower bankPower for everything

Code

The microphone amplifier outputs a wave centred at about half of 3.3 V, so loudness is not the voltage itself but how far the wave swings. The sketch measures the lowest and highest readings over twenty milliseconds, turns the difference into a level, and lights that many LEDs, with a quick rise and a slow fall so it looks smooth and does not flicker. Set the little gain screw on the MAX4466 so quiet speech lights a few LEDs and loud music lights most, then tune the 400 in the code. Power: a metre of 30 LEDs can draw about 1.8 A at full white, more than many power banks give, so the sketch limits brightness to 60 out of 255. Use a power bank that can give at least 1 A. Sew the strip on with flexible silicone wire between segments, leave a little slack at joints, and keep the electronics in a pocket away from sweat. Fast flashing lights can trigger photosensitive epilepsy, so keep the smooth fade and do not add strobe effects. Do not wear it in rain, and do not put the bank against skin if it gets warm. Arduino IDE with the Raspberry Pi Pico / RP2040 board package, board "Seeed XIAO RP2040".

Runs on a virtual Seeed XIAO RP2040 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).

// Sound-reactive costume LEDs: loudness sets how many LEDs light and their colour, with a smooth fade (no strobing).
// Library: Adafruit NeoPixel. Board: Seeed XIAO RP2040.
#include <Adafruit_NeoPixel.h>
const uint8_t STRIP_PIN = D1;
const int N_LEDS = 30;                     // a 1 m strip of 30 LEDs
Adafruit_NeoPixel strip(N_LEDS, STRIP_PIN, NEO_GRB + NEO_KHZ800);
float level = 0;
void setup() {
  analogReadResolution(10);
  strip.begin();
  strip.setBrightness(60);                 // keeps power bank current low (about 0.5 A at most)
  strip.show();
}
void loop() {
  int lo = 1023, hi = 0;
  unsigned long start = millis();
  while (millis() - start < 20) {          // 20 ms window finds the swing of the sound wave
    int v = analogRead(A0);
    if (v < lo) lo = v;
    if (v > hi) hi = v;
  }
  float loud = (hi - lo) / 400.0;          // adjust 400 to suit your microphone gain
  if (loud > 1) loud = 1;
  if (loud > level) level = level + (loud - level) * 0.5; else level = level * 0.92;   // quick rise, slow fall
  int lit = (int)(level * N_LEDS);
  for (int i = 0; i < N_LEDS; i++) {
    if (i < lit) strip.setPixelColor(i, strip.ColorHSV((uint16_t)(i * 65535L / N_LEDS * 0.6), 255, 255));
    else strip.setPixelColor(i, 0);
  }
  strip.show();
}

Test checklist

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

CheckExpected
SilenceLEDs off or one lit
MusicBar rises and falls smoothly
Brightness capBank stays cool
Walking aboutJoints and wires hold

If it does not work

LEDs flicker

Check the common ground and the 330 ohm resistor.

Always full

Lower the gain screw or raise the 400.

Reboots on bass

The bank cannot give enough current; lower brightness.

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

Ask Lark AI

Common questions

What parts do I need for the sound-reactive LED costume?

Seeed XIAO RP2040, WS2812B strip 5 m (30 LEDs/m), MAX4466 microphone module, USB A to USB-C cable (data) and Resistor 330 Ω. WS2812B strip 5 m (30 LEDs/m): Cut 1 m.

How long does the sound-reactive LED costume take to build?

About 120 minutes for a beginner maker, in 7 steps.

How do I know the sound-reactive LED costume works?

Silence: LEDs off or one lit. Music: Bar rises and falls smoothly. Brightness cap: Bank stays cool.

LEDs flicker: what should I check?

Check the common ground and the 330 ohm resistor.

Always full: what should I check?

Lower the gain screw or raise the 400.

Reboots on bass: what should I check?

The bank cannot give enough current; lower brightness.