Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino WS2812B + KY-037: Music-Reactive LED Effects | ShillehTek

June 10, 2026 9 views

Arduino WS2812B + KY-037: Music-Reactive LED Effects | ShillehTek
Project

Build an Arduino WS2812B LED strip that reacts to music using a KY-037 mic module, with VU meter and beat effects, using parts from ShillehTek.

20 min Beginner to Intermediate4 parts

Project Overview

Arduino (or ESP32) + WS2812B + KY-037: In this build, you will wire a WS2812B (NeoPixel-style) addressable LED strip to an Arduino or ESP32, add a KY-037 sound sensor module, and program music-reactive animations like a VU meter, beat pulse, and color chase.

WS2812B strips are individually addressable RGB LEDs where each pixel is independently controlled over a single data wire. A 5-meter roll typically has 300 LEDs, runs on 5 V, and can display any color animation you can code.

This guide walks through wiring and three simple music-reactive effects using the FastLED library in about 50 lines of example code.

WS2812B LED strip connected for a music-reactive lighting project
  • Time: 20 to 45 minutes
  • Skill level: Beginner to Intermediate
  • What you will build: A WS2812B LED strip that reacts to audio levels from a KY-037 module with multiple visual effects.

Parts List

From ShillehTek

External

  • 5 V, 10 A power supply for a full 5 m strip (300 LEDs at full white can peak around 18 A; 10 A is typically fine for music-reactive modes).
  • 1000 µF electrolytic capacitor across the strip 5 V and GND at the power input.
  • 330 Ω resistor in series with the LED data line.
  • Jumper wires and (optionally) a breadboard for prototyping.

Note: Do not power the strip from the Arduino 5 V pin. Use a dedicated 5 V supply and make sure the microcontroller ground and LED strip ground are connected (shared ground).

Step-by-Step Guide

Step 1 - Wire the LED strip and sound sensor

Goal: Connect power, data, and the KY-037 analog output so the microcontroller can drive the WS2812B strip and read audio level.

What to do: Power the WS2812B strip from a real 5 V supply. Add a 1000 µF capacitor across 5 V and GND at the strip input. Put a 330 Ω resistor in series with the data line. Connect grounds together (power supply, strip, and microcontroller).

Arduino wired to a WS2812B LED strip with a 330 ohm data resistor and shared ground, plus KY-037 sound sensor connected to A0

Wiring map:

5V PSU(+) -> Strip 5V    (with 1000uF cap to GND)
5V PSU(-) -> Strip GND
Arduino GND -> Strip GND (shared ground is critical)
Arduino D6  -> 330ohm    -> Strip DIN

KY-037     Arduino
VCC    ->  5V
GND    ->  GND
AO     ->  A0 (analog audio envelope)

Expected result: The strip has stable 5 V power, the microcontroller shares ground with the strip, and A0 is ready to read the KY-037 analog level.

Step 2 - Verify FastLED with a simple rainbow

Goal: Confirm your data pin, LED type, and LED count work before adding music logic.

What to do: Install the FastLED library in the Arduino IDE. Set DATA_PIN to your chosen output pin (D6 in this guide) and NUM_LEDS to match your strip (example below uses 60).

Code:

#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN 6
CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}

void loop() {
  // simple rainbow sweep
  static uint8_t hue = 0;
  fill_rainbow(leds, NUM_LEDS, hue++, 7);
  FastLED.show();
  delay(20);
}

Expected result: The LEDs display a moving rainbow sweep with no flicker or random colors.

Step 3 - Add VU meter mode

Goal: Map the KY-037 analog envelope to a classic VU bar on the strip.

What to do: Read analogRead(A0), map it to 0..NUM_LEDS, then light that many pixels. Tune the input range (the 0..600 values) for your room and sensor adjustment.

WS2812B LED strip showing a rainbow VU meter bar reacting to audio level

Code:

void vuMeter() {
  int level = analogRead(A0);
  int peak = constrain(map(level, 0, 600, 0, NUM_LEDS), 0, NUM_LEDS);
  for (int i = 0; i < NUM_LEDS; i++) {
    if (i < peak) {
      leds[i] = CHSV(i * 4, 255, 255);   // rainbow ramp
    } else {
      leds[i] = CRGB::Black;
    }
  }
  FastLED.show();
}

Expected result: Louder audio produces a taller bar of lit pixels, and quiet audio drops the bar toward black.

Step 4 - Add pulse mode (beat-reactive color burst)

Goal: Create a full-strip color pulse whose brightness follows peaks in the microphone envelope.

What to do: Track a simple peak hold value, map it to brightness, then fill the strip with a cycling hue at that brightness. The peak decays over time for a smoother “beat” feel.

Code:

void beatPulse() {
  static int peakHold = 0;
  int level = analogRead(A0);
  if (level > peakHold) peakHold = level;
  uint8_t brightness = constrain(map(peakHold, 100, 600, 0, 255), 0, 255);
  fill_solid(leds, NUM_LEDS, CHSV(millis() / 30 % 255, 255, brightness));
  FastLED.show();
  peakHold = peakHold * 0.9;  // decay
}

Expected result: The whole strip flashes brighter on beats and fades between hits while the color slowly shifts.

Step 5 - Add chase/explosion mode

Goal: Create a moving “head” pixel with a fading trail for a chase or explosion-style look.

What to do: Fade the whole strip each frame, then light a single “head” LED and advance it along the strip.

WS2812B LED strip showing a bright moving chase head with a fading trail effect

Code:

void chase() {
  static int head = 0;
  fadeToBlackBy(leds, NUM_LEDS, 30);
  leds[head] = CHSV(head * 4, 255, 255);
  head = (head + 1) % NUM_LEDS;
  FastLED.show();
  delay(20);
}

Expected result: A bright point moves down the strip with a smooth fading trail behind it.

Step 6 - Choose ESP32 vs Arduino Nano for large strips

Goal: Understand performance differences so you pick the right microcontroller for your LED count.

What to do: If you are driving larger strips, consider using an ESP32. An ATmega328P (Arduino Nano) can start to bottleneck above about 150 LEDs because FastLED is bit-banging the timing. An ESP32 can use dedicated peripherals for WS2812B output and can handle 1000+ LEDs at high frame rates while also leaving headroom for WiFi features.

Expected result: You can decide whether the Nano is “good enough” for your 5 m roll (300 LEDs) or if you want the ESP32 for smoother animations and future expansion.

Conclusion

You now have a WS2812B music-reactive LED strip driven by an Arduino (or ESP32) and a KY-037 sound sensor, with effects like a VU meter, beat pulse, and a chase/explosion animation. From here you can keep adding modes by mixing different FastLED patterns with your audio level input.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.

Credit: Inspired by "DIY Music Reactive RGB LED Strip WS2812B" on Instructables. Images credited to the original author.