RGB LED Strip Music Visualisation based on different Frequency Ranges


It’s my first project using an Arduino. And also since I am in the learning phase, some may find the code to be inefficient and lengthy. Still, I tried my best.

The whole idea is to filter the incoming audio signal and each colored LED of the RGB 3528 SMD strip will react to different frequency range of the audio signal.
For example, the red LEDs will react to bass kicks, blue to shrill snares.

The whole project is divided into three parts:
1. Building a pre-amplifier mic circuit.
2. Taking the mic signals as the input in the Arduino and filtering it into three frequency ranges using the FIR filter implemented in the code itself.
3. Building the LED circuit and using the filtered outputs to control the brightness of the RGB LEDs.

You can see my project in action here.


1 x Arduino Uno
1 x RGB 3528 LED Strip
3 x TIP31C npn transistors
1 x Electret Microphone
1 x 12V Battery
3 x 470Ω resistors
1 x 10µF capacitor
1 x 100nF capacitor
1 x LM358 op-amp
2 x 1K resistors
2 x 10K resistors
1 x 100K resistor


The main objective of this circuit is to amplify the voltage signals of the electret mic.
After the unconvincing performance of an NPN amplifier circuit, I moved to op-amps(I used an LM358).They are high gain voltage amplifiers.
I used the inverting AC amplifier configuration.



The V_OUT_UC goes into the Arduino. The V_OUT is for connecting earphones directly.

The voltage gain = – R5/R4.
So, with R5=100K Ω and R4=1KΩ we get 100x gain.

The readings on the serial plotter were quite impressive.



Here’s the amp circuit-


Now coming to the various components of the circuit:

Microphone Coupling Capacitor (electrolytic one):
Since, with the AC audio signal a DC signal is also present to power the microphone, we need to block the DC signal to avoid noise.

Power Supply Decoupling (ceramic one):
A decoupling capacitor’s job is to suppress high-frequency noise in power supply signals. They take tiny voltage ripples, which could otherwise be harmful to delicate ICs, out of the voltage supply.

The power supply is obtained from 5V out of the Arduino.


The LED strip requires 12V.

Since the Arduino cannot supply much current, I used NPN transistors.I used the TIP31Cs because they can withstand high current.

The PWM voltage(which controls the brightness) output pins are connected to the base, the LED Strip to the collector and emitter to the ground.

Here’s the led strip circuit:


Sampling & Filtering-The Code

The Arduino Uno clock is at 16MHz.
The ADC clock is at (16/prescaler) where the prescalar can be 16,32,64 or 128.
One ADC conversion takes 13 ADC clocks.
According to the Atmega 328P datasheet, the recommended ADC clock should be between 50KHz and 200KHz. So, by default, the prescaler is set to 128, which, would in turn give us a sampling rate of ~9600Hz. But to get 8KHz analyzable spectrum we need to sample at 16KHz according to Nyquist theorem. So, in the code, I have set the prescaler to 64 so that we can get a sampling rate of 17800Hz(almost 16KHz).

After sampling at 17800Hz, we are filtering the signal through digital FIR filters.
I calculated the filter coefficients and the gain using a simple MATLAB code.

Here’s some graphical representation of the filters:




And I figured out the cutoff frequencies for the three filters by playing some tracks and observing the most active frequency ranges on trueRTA.


Here is my main Arduino code.
I have commented as much as possible and the functions are pretty self-explanatory.

Thank you for reading my blog post.Hope you will also have fun with the project and improve it further.

Here are some pictures of my project:

This slideshow requires JavaScript.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: