
Disclosure: As an Amazon Associate I earn from qualifying purchases.
Every previous project in this series ran software somebody else wrote. This one is yours: a microphone listens to the room, a short Python program does the math, and a five-meter strip of lights dances to whatever’s playing. It’s the project that makes “I can code” stop being a sentence and start being a thing on your wall.
Get the full kit → jumps to the parts list. Any Pi from your starter kit runs this — including the Zero 2 W, though a Pi 4/5 makes the audio processing lazier.
What You’ll Need
One of these parts is a power supply, and it matters more than the lights — read its line twice. Prices are estimates checked in October 2026.
- WS2812B LED strip, 5 m — ~$18 est. The individually-addressable kind: every LED can be any color, controlled from one wire. Get the 60-LEDs-per-meter version for smoothness; 30/m is the budget option and still looks great.
- 5V 10A power supply — ~$16 est. The strip gets its own supply, sized to the strip. This is the rule that keeps this project fun instead of smoky: never power a long strip from the Pi’s 5V pin. The Pi tells the lights what to do; this supply does the heavy lifting.
- USB microphone — ~$12 est. Any small USB mic works — the program needs to hear the room, not record an album. A mic on a short cable lets you place it near a speaker and away from the strip’s power brick hum.
- Breadboard + jumper kit with a 74AHCT125 level shifter — ~$12 est. The shifter is a fifty-cent chip that translates the Pi’s 3.3V data signal into the 5V the strip expects. Many strips forgive skipping it; the ones that don’t flicker mysteriously forever. Build it right.
Total: ~$58 est. — and the strip, supply, and mic all get reused by later projects in this series.
Step 1 — Wire It Like You Mean It (30 Minutes)
Four connections, done in this order, with everything unplugged:
- Strip power: the strip’s red and black wires go to the 5V supply’s + and − terminals. Not the Pi. (Once more, with feeling.)
- Common ground: a wire from the strip’s ground to a Pi ground pin. Two devices, one ground reference — skip this and the data signal is gibberish.
- Data: Pi GPIO 18 → level shifter input; shifter output → the strip’s data-in wire. Mind the strip’s arrow direction: data flows with the arrows.
- Mic: USB, any port. Then power the strip supply first, the Pi second, and run the strip library’s test pattern (the
rpi-ws281xstrand test) to prove the chain before writing a line of your own code.
One sizing note the internet argues about: a 300-LED strip at full white could theoretically draw 18A. You will cap brightness in code (Step 3) and music mode never lights everything at full white anyway — the 10A supply plus the brightness cap is the standard, sane combination. If your strip is longer than 5 m, inject power at both ends and size up.
Step 2 — Hear the Room (30 Minutes)
Install the pieces: sudo apt install python3-pyaudio (or pip’s sounddevice — either gives Python ears), plus numpy, the math library every audio project on Earth stands on. Then the concept, which is simpler than it sounds: your program grabs a tiny slice of sound — about 1/20th of a second — and runs an FFT, a standard transform that answers “how much bass, how much midrange, how much treble is in this slice?” Numbers in hand, the program decides colors: bass drives the reds and the brightness pulse, treble sprinkles the far end of the strip. Slice, transform, paint, repeat — twenty times a second, that loop is the visualizer, and everything else is decoration you’ll add because you can.
Step 3 — The Program (45 Minutes, the Good Part)
In outline — the full script is the kind of thing you’ll type, break, and fix, which is the point:
- Setup block: strip length, brightness cap (start at 40% — your eyes and the power supply will both agree), GPIO pin, mic sample rate. Constants at the top, because future-you tunes from here.
- Listen: open the mic stream; read one chunk of samples into a numpy array.
- Measure: FFT the chunk; average the low band (bass), mid band, and high band into three numbers; smooth each against its previous value so the lights glide instead of strobing.
- Paint: map bass → pulse brightness from the strip’s start, mids → a moving color wash, highs → sparkle at random positions. Push the frame to the strip.
- Loop: forever, until Ctrl-C turns the strip politely off (trap the exit — a strip left mid-frame stays lit, which is a fun bug exactly once).
It’s roughly 30 lines of your code standing on two libraries. When it works — and the moment a kick drum first thumps the whole strip in time is a genuine core memory — start making it yours: new color palettes, a “chill mode” that breathes instead of bouncing, a rainbow that travels on snare hits. Every improvement is another small program you now know how to write.
Troubleshooting the Classics
- First LED green, rest dark: data wire on the strip’s output end. Flip the strip — data enters at the arrow’s tail.
- Random flicker: the missing level shifter, or a loose common ground. It’s almost always those two, in that order.
- Strip freezes mid-song: the mic stream underflowed — increase the chunk size slightly. Computers are divas; feed them bigger bites.
- Colors fine, timing mushy: you’re printing debug text every frame. Print is slow. Log every 20th frame, or none.
What NOT to Buy
- A “music-reactive” strip with its own remote and app. That product does this project’s job with none of the learning and all of the data collection. The point is the program you write.
- The cheapest strip on the marketplace. Dead pixels and mystery wiring are common at the bottom of this market, and debugging somebody else’s quality control is not a first project. The named brands in this range are boring in the best way.
- A bigger power supply “to be safe” beyond the math. Size to the strip with a brightness cap as designed; a random 30A brick adds cost and fault energy, not safety. Correct sizing is the safety.
- A fancy audio interface. The program needs loudness-by-frequency, not fidelity. A $12 USB mic is the right tool; studio gear changes nothing the strip can show.
The Total, Honestly
- WS2812B strip (5 m, 60/m): ~$18 est. · 5V 10A supply: ~$16 est.
- USB microphone: ~$12 est. · Breadboard/jumper/level-shifter kit: ~$12 est.
- Total: ~$58 est. (October 2026)
Build It This Weekend
Strip + its own supply + USB mic + wiring kit. Wire carefully, prove the test pattern, then write thirty lines and put on a song with a good drummer.
Next in the series: we point the Pi’s brain at the natural world — Project 11, the AI bird camera, uses the AI HAT to name every bird at your feeder. More Python, bigger magic.