VU Meter: Music Reactive LEDs
by TechMartian in Circuits > Arduino
4900 Views, 28 Favorites, 0 Comments
VU Meter: Music Reactive LEDs
![title.jpg](/proxy/?url=https://content.instructables.com/F2K/YHU9/J65G1IPA/F2KYHU9J65G1IPA.jpg&filename=title.jpg)
![VU Meter Demo 2](/proxy/?url=https://content.instructables.com/FHF/G2OF/J65G1GG8/FHFG2OFJ65G1GG8.jpg&filename=VU Meter Demo 2)
This is a VU meter, where the LEDs light up to the tune (more accurately, volume) of music. It is comprised of a sound detector board and 10 differently coloured LEDs which depicts the meter. In the video shown above, the LEDs light up to the sound of Avicii's "Wake me Up."
A VU meter is a volume indicator tool usually represented by either a needle and a gauge or with LEDs. Of course, the latter looks cooler! VU meters are more commonly known for their visual appeal, with LED lights lighting up to the sound of music!
BoM
![3iq2beDqSdqmCNtrvWnNmw_thumb_427.jpg](/proxy/?url=https://content.instructables.com/FQU/BAZD/J65G1HKM/FQUBAZDJ65G1HKM.jpg&filename=3iq2beDqSdqmCNtrvWnNmw_thumb_427.jpg)
- Arduino 101 or Arduino Uno
- Sound Detector Board
- 10 pieces of 5mm LEDs (your colour of choice)
- 100Ω Resistor
- Breadboard
- Jumper Wires
LED Pattern Design
![kdmpq%eLQQWylShzWlWMmw_thumb_428.jpg](/proxy/?url=https://content.instructables.com/FUF/AU3B/J65G1HKD/FUFAU3BJ65G1HKD.jpg&filename=kdmpq%eLQQWylShzWlWMmw_thumb_428.jpg)
I decided on ordering my LEDs based on the frequency spectrum (i.e. Rainbow - ROYGBIV) using red, yellow, green, and blue LEDs. I also added an extra pattern of incrementing by 1 LED for each colour. I encourage you to design your own pattern that suits your own creative style!
Hardware Hookup
![Screen Shot 2017-08-09 at 11.24.37 PM.png](/proxy/?url=https://content.instructables.com/F5O/93ZA/J65G1HM6/F5O93ZAJ65G1HM6.png&filename=Screen Shot 2017-08-09 at 11.24.37 PM.png)
![jJeEF3rPTy+Ut64QXoSkYw_thumb_42a.jpg](/proxy/?url=https://content.instructables.com/F79/17LK/J65G1HIX/F7917LKJ65G1HIX.jpg&filename=jJeEF3rPTy+Ut64QXoSkYw_thumb_42a.jpg)
![CiwZFdJFQeSHV+FQJ2LwIA_thumb_42b.jpg](/proxy/?url=https://content.instructables.com/FPN/6D05/J65G1HHD/FPN6D05J65G1HHD.jpg&filename=CiwZFdJFQeSHV+FQJ2LwIA_thumb_42b.jpg)
![h+gjmfu5RZCdDm0OctMypw_thumb_42c.jpg](/proxy/?url=https://content.instructables.com/FAT/7V4A/J65G1HFV/FAT7V4AJ65G1HFV.jpg&filename=h+gjmfu5RZCdDm0OctMypw_thumb_42c.jpg)
![VmAnSjvnSAyD4xLZ9qz1vw_thumb_42d.jpg](/proxy/?url=https://content.instructables.com/FVV/FRI6/J65G1HEK/FVVFRI6J65G1HEK.jpg&filename=VmAnSjvnSAyD4xLZ9qz1vw_thumb_42d.jpg)
LEDs
- Connect all the anodes (positive pins) of each of the LEDs to a 100Ω resistor.
- Connect all the cathodes (negative pins) of each of the LEDs to the ground rail on the breadboard.
- Then, connect this ground rail to the GND pin on the Arduino board.
- Connect the free-end of each of the resistors starting from the bottommost LED to pins 2 to 11 in consecutive ascending order.
Sound Detector Board
- Connect the GND pin on the sound detector board to the GND pin on the Arduino board.
- Connect the VCC pin on the sound detector board to the 3.3V pin on the Arduino board.
- Connect the Envelope pin on the sound detector board to the A0 pin on the Arduino board.
Calibrating the Volume
![Screen Shot 2017-08-09 at 11.27.11 PM.png](/proxy/?url=https://content.instructables.com/F6W/DMEG/J65G1HP0/F6WDMEGJ65G1HP0.png&filename=Screen Shot 2017-08-09 at 11.27.11 PM.png)
Calibrate the maximum volume that you want to listen to by recording the maximum analog input for that volume in Serial Monitor. The lower the threshold value, the more erratic the lighting patterns become. I chose a range of 0 to 60, since I am getting the sound from my computer speakers, you may want to increase this threshold if you are to play the instruments yourself.
As a reference, a clap is around 250 to 300.
The code I used to see the output of the sound detector board is the following:
void setup() {
Serial.begin (9600); }
void loop() { Serial.println (analogRead(A0)); }
Coding
![Screen Shot 2017-08-09 at 11.25.29 PM.png](/proxy/?url=https://content.instructables.com/F6T/0L0H/J65G1HNK/F6T0L0HJ65G1HNK.png&filename=Screen Shot 2017-08-09 at 11.25.29 PM.png)
const int led1 = 2;
const int led2 = 3; const int led3 = 4; const int led4 = 5; const int led5 = 6; const int led6 = 7; const int led7 = 8; const int led8 = 9; const int led9 = 10; const int led10 = 11;
void setup() { pinMode (led1, OUTPUT); pinMode (led2, OUTPUT); pinMode (led3, OUTPUT); pinMode (led4, OUTPUT); pinMode (led5, OUTPUT); pinMode (led6, OUTPUT); pinMode (led7, OUTPUT); pinMode (led8, OUTPUT); pinMode (led9, OUTPUT); pinMode (led10, OUTPUT);
}
void loop() { // put your main code here, to run repeatedly: int sound = analogRead(A0);
sound = map (sound, 0, 60, 0, 10);
if (sound >= 1) digitalWrite (led1, HIGH); if (sound >= 2) digitalWrite (led2, HIGH); if (sound >= 3) digitalWrite (led3, HIGH); if (sound >= 4) digitalWrite (led4, HIGH); if (sound >= 5) digitalWrite (led5, HIGH); if (sound >= 6) digitalWrite (led6, HIGH); if (sound >= 7) digitalWrite (led7, HIGH); if (sound >= 8) digitalWrite (led8, HIGH); if (sound >= 9) digitalWrite (led9, HIGH); if (sound >= 10) digitalWrite (led10, HIGH); delay (50); offAll(); }
void offAll (){ digitalWrite (led1, LOW); digitalWrite (led2, LOW); digitalWrite (led3, LOW); digitalWrite (led4, LOW); digitalWrite (led5, LOW); digitalWrite (led6, LOW); digitalWrite (led7, LOW); digitalWrite (led8, LOW); digitalWrite (led9, LOW); digitalWrite (led10, LOW); }
Downloads
Done!
![VU Meter Demo 1](/proxy/?url=https://content.instructables.com/FG3/KL6W/J65G1G2Z/FG3KL6WJ65G1G2Z.jpg&filename=VU Meter Demo 1)
![VU Meter Demo 3](/proxy/?url=https://content.instructables.com/F4V/MQL3/J65G1IW4/F4VMQL3J65G1IW4.jpg&filename=VU Meter Demo 3)
Play some music, the ones with more volume changes would result in a prettier light show. Turn off the lights and watch the music!
I played a variety of songs on the LEDs, I found that these two songs work quite well - Versace on the Floor by Bruno Mars and Wake me Up by Avicii due to their volume variation. More than This by One Direction also produced a pretty light show (though I didn't record it)!