Introduction: Arduino Vu Meter With Amplifier
Your four main parts for this project are an Arduino, a LoLshield, and an amplifier
The LoLshield is a circuit board that comes with a library that enables one to individually control a matrix of LEDs. Once you have the correct library installed you can use the code LedSign::Set(x,y,1); to individually choose one led to turn on with your limited number of pins on the arduino.
Instructions on how to construct the LoLshield can be found here (http://jimmieprodgers.com/kits/lolshield/makelolshield/).
For our amplifier we choose to use the O2 NwavGuy amp. For information on ordering and/or constructing follow this link, http://nwavguy.blogspot.com/2011/08/o2-details.html.
Step 1: Connections
Now that you have your two main components you need to start connecting them. You music signal need to go both to the amplifier. Solder two wires to the input jack of the circuit bored like so.
Step 2: Power Control
In order to ensure that you don’t over power the arduino you will have to solder in a 330 Ω resistor and a .01 μF capactor in series with the gray wire.
Then just connect the capacitor to pin A4 on the LoLshield and the black wire to the GND pin.
Step 3: Code
This is the code we used for the visualizer, just upload it to you arduino
/*
FFT for LoL Shield v0.9
by Andy Doro
http://andydoro.com/
based on FFT library and code from the Arduino forums and
the Charlieplexing library for the LoL Shield.
*/
#include <Charliplexing.h>
#include <fix_fft.h>
#define AUDIOPIN 4
char im[128], data[128];
char data_avgs[14];
int i=0,val;
void setup() {
LedSign::Init(); //Initilizes the LoL Shield
}
void loop() {
for (i=0; i < 128; i++){
val = analogRead(AUDIOPIN);
data[i] = val;
im[i] = 0;
};
fix_fft(data,im,7,0);
for (i=0; i< 64;i++){
data[i] = sqrt(data[i] * data[i] + im[i] * im[i]); // this gets the absolute value of the values in the array, so we're only dealing with positive numbers
};
// average bars together
for (i=0; i<14; i++) {
data_avgs[i] = (data[i*4] + data[i*4 + 1] + data[i*4 + 2] + data[i*4 + 3]); // average together
data_avgs[i] = map(data_avgs[i], 0, 30, 0, 9); // remap values for LoL
}
// set LoLShield
for (int x=0; x < 14; x++) {
for (int y=0; y < 9; y++) {
if (y < data_avgs[13-x]) { // 13-x reverses the bars so low to high frequences are represented from left to right.
LedSign::Set(x,y,1); // set the LED on
} else {
LedSign::Set(x,y,0); // set the LED off
}
}
}
delay (30);
}
Step 4: Power
If your creative side demands you can make an interesting box to house the whole set up in.
4 Comments
11 years ago on Introduction
In your video whats is up with the far right hand column of LEDs also after the music stops there is still some action from the other LEDs is this noise in the signal input or is it a bug in the coding?
Still great project, one of the few I've seen that uses an Arduino... Most use either the LM3915 or the LM3916.
Reply 10 years ago on Introduction
It was noise. The code is solid. For the start is was running perfectly however it started to show noise as it went on. We believe we joined a connection on our led board and decided it wasn't big enough a problem to find the bad connection.
10 years ago on Introduction
Why are you using an amp instead of a mic and gain control? That would give you better control over the sensitivity of the lights. But would it be more difficult?
Reply 10 years ago on Introduction
The amplifier is used to boost the quality of the music, and we don't need a microphone because the arduino is wired directly to the source