LED RGB Strip Sync to Music Properties

I'm new to working with Arduino and rgb/music. I want to program an analog rgb light strip to change colors and "dance" with the music based on the music properties. Which Arduino would be best for this project and how will I need to code it? I have basic experience with raspberry pi/breakout coding and python if that helps.

Look for a ‘beat detector’. Depending on the source of the music, you will need a different analog circuit.

You can do a lot with just "loudness" and the "the beat" or you can do some frequency detection.

There is a mathematical process called FFT that breaks the signal into frequency components (bins) and there is an FFT library. If you search the Internet for "Arduino Spectrum Analyzer" you'll get an idea of what you can do.

There is also the [u]MSGEQ7 chip[/u] the gives you 7 frequency bands (multiplexed-down to 1 pin). If you simply wanted to use 3 bands (bass, mids, highs) for the 3 different colors you can combine some of those frequency bands, or simply ignore 4 of them. The software for FFT is at least 100 times more complex as the software for the MSGEQ7. (With the FFT library you're not doing the "hard part" yourself, so it's not that bad.)

I've made some sound activated effects* and I only use loudness and a crude beat detector. I kind-of like the crude-inaccurate beat detector because lights than blink exactly to the beat, 1, 2, 3, 4, 1, 2, 3, 4, get's boring! I also don't have any color control, but in one of my configurations I plug-in colored flood lights (4 different colors).

Even with just "loudness" I made 7 different sequencing-chasing/patter-changing effects (including a "VU meter" effect). The effects run randomly and there are variations to keep things interesting... For example , the VU meter can be reversed (going-down with loudness instead of up) or it can be inverted (so louder turns more lights/LEDs off). All of the effects are randomly reversed and inverted.

The simplest effect turns-on a light when the signal is above average and off when below average. That give you lots of "action" since the light is on half the time and off half the time. I have a variation of that where a random pattern is set-up (with some lights on and some lights off) and when the signal is above average the lights toggle to their opposite states. With RGB LEDs, you could do something with different colors for above-average and below-average.

I've got another easy effect that simply throws-up a different random pattern with each "beat".

BTW - All of my effects use either a 20-second moving average and/or the 20-second peak to automatically-adjust to volume changes.

If you're going to use a microphone you'll need a preamp. If you are using a line-level or headphone-level signal, you'll need to bias the input (2 resistors and a capacitor) because the Arduino can't read the negative-half of the AC audio waveform. In-fact it can be damaged by negative voltages. If you are using a microphone preamp, sometimes the bias is built-into the preamp (for example the SparkFun microphone breakout board), and the MSGEQ7 only puts-out positive voltages.

Depending on what you're doing, you may need to (or want to) subtract-out the bias in software. (With FFT the DC bias will "automatically" be removed/isolated because DC is zero-Hz.)

  • I can't share the code because my computer crashed and it wasn't backed-up. (But of course, the Arduino still runs!) Plus, I use a peak-detector circuit, which is extra hardware that some people don't want to build.

Google" arduino color organ". Lots of examples.