Introduction: VU Meter: Music Reactive LEDs

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!

Step 1: BoM

  • Arduino 101 or Arduino Uno
  • Sound Detector Board
  • 10 pieces of 5mm LEDs (your colour of choice)
  • 100Ω Resistor
  • Breadboard
  • Jumper Wires

Step 2: LED Pattern Design

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!

Step 3: Hardware Hookup

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.

Step 4: Calibrating the Volume

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));
}

Step 5: Coding

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);  
}

Step 6: Done!

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)!

Comments

author
gm280 (author)2017-08-10

Nice project. You should also post the schematic diagram for everybody to see the connections you used.

And I am not sure if you know it or now, but they make resister DIPs (Dual Inline Packages) or resistors to simplify the current limiting resistor connections. One DIP chip would probably cover all the resistor you need for this setup. Check into it for a more simplistic layout. Just a thought.

author
TechMartian (author)gm2802017-08-10

Thanks! I didn't know they make those resistors, that would be so useful actually cause I have to tape and hold down all those resistors because of loose connections.

About This Instructable

993views

20favorites

License:

Bio: Aerospace Engineer working in Software Development with a passion for Hardware.
More by TechMartian:Flying Captain America's Shield - RC PlaneWide Angle ShotsLED Ping Pong With Shift Register
Add instructable to: