This is an audio spectrum VU meter using the LoL Shield for Arduino .

The LoL Shield is a 14 x 9 LED matrix which fits onto the Arduino as a shield and is controlled through an efficient method known as Charlieplexing . It was designed by Jimmie P. Rodgers .

This project uses a Fast Fourier Transform library for Arduino to analyze an audio signal, break it up into frequency bands, and display that information on the LoL Shield.

The Arduino microcontroller is fast enough to calculate a fast Fourier transformation. It lives up to its name and is surprisingly fast and accurate.

Since all the work is done by the microcontroller, this project is completely portable if you use batteries.

The webpage for this project is located at http://andydoro.com/vulol/

Parts required:
  • LoL Shield
  • Arduino (Diavolino recommended)
  • audio jack (I used a male mono 1/8" phone plug)
  • Arduino code
  • power supply (DC power supply, USB cable, 9V battery, etc.)

Step 1: Assemble LoL Shield

Follow the instructions to assemble the LoL Shield here .

See, that didn't take long at all!

Step 2: Solder Wires to the Audio Jack

I am using a male mono 1/8" phone plug, as it's called at Radioshack, but you can use whatever audio cable is appropriate for your audio system setup. You could use a microphone if you wanted to.

For this type of plug, I soldered two wires. I used red and black.

The LoL Shield leaves analog pins 4 and 5 free for inputs. My code uses pin 5.

You can attach the red wire to analog pin 5 of the LoL Shield and the black wire to GND. You don't need to solder it in, I just put the wire through and bent it.

Step 3: Program Arduino

Now we need to program the Arduino to control the LoL Shield.

It is recommended to use the Diavolino to control the LoL Shield in order to prevent "ghosting" effects on the LEDs due to the green surface mount LED connected to pin 13 on the standard Arduino, but a standard Arduino will work fine.

This requires two Arduino libraries:
- the FFT library found on the Arduino forum
- the Charlieplexing library for the LoL Shield

Installing libraries for Arduino can be slightly daunting if you haven't done it before, but you'll do fine!

Follow the instructions on installing Arduino libraries here:


The FFT library breaks the audio signal in 64 frequency bands.
The LoL Shield is 14 x 9 LEDs. We average the 64 frequency bands together into 14 frequency bands. We're throwing away some data because 14 doesn't divide into 64 evenly, but whatevs.
The value of each frequency range is remapped from 0 to 9.

You can copy the Arduino code below, get the code from GitHub (recommended), or download the .ZIP file, which includes the libraries and Arduino code.

Here is the GitHub link:


Below is the Arduino code:

FFT for LoL Shield v0.9
by Andy Doro
based on FFT library and code from the Arduino forums and
the Charlieplexing library for the LoL Shield.
*/ #include
#define AUDIOPIN 5
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;


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


Step 4: Enjoy!!

Plug the audio jack to your stereo, iPod, computer, etc.

Power the Arduino with a DC power supply, USB from your computer or batteries- this is completely portable. You could put it into a hat or belt buckle.

The white LEDs are so bright it's difficult to capture on video. It looks like there is purple flame coming off of them!

Sit back and enjoy!

<p>Hello, i have this error:</p><p>Arduino: 1.6.5 (Windows 8.1), Board: &quot;Arduino Uno&quot;</p><p>In file included from LoLShield_FFT.ino:9:0:</p><p>C:\Users\Uporabnik\Documents\Arduino\libraries\FFT/fix_fft.h:4:22: fatal error: WProgram.h: No such file or directory</p><p> #include &lt;WProgram.h&gt;</p><p> ^</p><p>compilation terminated.</p><p>Error compiling.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p>
<p>hey, I'm using your code for a school project and it's not working for me. I'm using an electret microphone instead of the audio jack. </p><p><a href="https://www.sparkfun.com/products/8635" rel="nofollow">https://www.sparkfun.com/products/8635</a>. This is the one I'm using.</p>
<p>Hey, thanks for sharing! However, it seems like I'm not the only one getting this error and there doesn't seem to be a resolution online. I am quite used to adding new libraries and don't think I messed up here. I realize this was posted a while ago ... Appreciate your response! </p><p>Arduino: 1.5.8 (Mac OS X), Board: &quot;Arduino Y&uacute;n&quot;</p><p>sketch_feb23a.ino:11:21: fatal error: fix_fft.h: No such file or directory</p><p>Thanks! </p>
<p>hi! It seems like the fix_fft library isn't installed correctly. please follow instructions <a href="http://www.arduino.cc/en/guide/libraries" rel="nofollow">here</a>.</p>
<p>can you please provide the data sheet of the lol shield sir i could not order it</p>
<p>It shows the following error when I try to compile:</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp:31:22: error: WProgram.h: No such file or directory</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp:48: error: 'boolean' does not name a type</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp: In function 'void LedSign::Flip(bool)':</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp:185: error: 'videoFlipPage' was not declared in this scope</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp:189: error: 'delay' was not declared in this scope</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp: In function 'void __vector_9()':</p><p>C:\Users\Lenovo\Documents\Arduino\libraries\LoLShield\Charliplexing.cpp:290: error: 'videoFlipPage' was not declared in this scope</p>
When compiling I always get this error: &quot;fix_fft&quot; was not declared in this scope , can someone please tell me how to fix it?
<p>i have the same problem^^</p>
hi, i have one question: where do I buy a lol shield?
<p>I get stuff from here <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=467" rel="nofollow">:Blue,</a> <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=466" rel="nofollow">Red</a>, <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=468" rel="nofollow">White</a>.</p>
<p>I get stuff from here <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=467" rel="nofollow">:Blue,</a> <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=466" rel="nofollow">Red</a>, <a href="http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=35&products_id=468" rel="nofollow">White</a>.</p>
hi, when i try to vertify the code in arduino it says theres an error, this is what it high lights : LedSign::Init(); //Initilizes the LoL Shield what does this mean? it says led sign has not been declared, what do i do?
hi there! it sounds like perhaps the Charlieplexing LoL library hasn't been installed correctly- make sure the libraries are installed correctly!
Awesome project andydoro, got it working in a couple of days! <br> <br>Quick question: If I have it using Analog in 5, I hear a lot of electrical back noise (comes out as a high pitch noise on a speaker attached to a y-plug with the visualizer), but using Analog in 4, I don't get this. Any clue why?
if I were to make two of them and wanted one to be an exact mirror of the other, how could I do that?
Wait.When you plug the audio jack in then you cannot hear the music or? :/
According to your tutorial you are just running the positive lead of the audio from a headphone jack into the analog input, But doesn't the signal need to be scaled to a DC range first? In other projects it's done with a pair of resisters and a capacitor. Is this not necessary?
that depends if you would like to use an audio amplifier usually to amplify signal via an op-amp, which in these kind of applications the LM386 is very common.
I'm pretty new to arduino and electronics in general, but I have a project in mind I'd like to try out using this. I essentially want to do the exact same thing, but I want to have it more spread out and inside a frosted plexiglass box, creating a sort of glowing equalizer. My idea was to simply replace the LED's on the LoL shield with different sequential colors, to make it more like a typical equalizer. Then, since I needed them to be more spread apart, simply solder wires onto the LED leads to extend them, allowing me to place them around the box at my leisure, yet still have them function as normal. I also was wondering about power source, does this thing just run off the arduino's power? Is it possible to make an alternate power source for it, or even run it off a wall socket? If so, how would one do that, and are any of these ideas feasible at all?
Thanks for the project details. I had a question about the FFT algorithm do you know what frequencies your FFT is performed? I was looking into the details and saw that someone posted it was from 0-1khz and I was hoping to increase my scale farther (to about 3khz) but I don't see anyway to change the sampling frequency. Thanks!
Averaging to reduce the FFT data is inefficient. It would be better to only do a 16-point FFT and ignore the two unwanted bands. This would save a lot of computational bandwidth. eg. multiplications would drop from about 150 per sample to 32 multiplies per sample and additions would be reduced similarly. If an FFT library hasn't already been created to allow the specification of the number of points for the FFT, I'm sure one will be soon - certainly before I have time to get to it. <br> <br>In any event, I love this project. The next feature addition would be to add color gradations to reflect the sound level. Using RGB LED's would kill the Charlieplexing approach, but simply using different color LEDs would work: Green, Yellow, Red and Blue for the number of &quot;overs&quot;. Hmmm, i think I just added a project to my list.
Here is a thought. What if someone does not mount the LoL shield on the Arduino card, and being the fact that theres a lot of input and output Pins left unused, would it not be possible to connect a second LoL shield and instead of using the one mono audio input, use a stereo 3.5 mm jack to do a stereo vu meter (One LoL for the left channel and one for the right channel)? I understand that the code would have to be modified but would this be a possibility, or would one need two arduinos to achieve this?
Nice idea. You could do this with two LoLshields and two Arduinos without changing the code. You would just wire the left audio to one LoLshield and the right audio to the other.
That is good in itself, but I was wondering if the two LoLShields could be controlled with one Arduino. Use one input Pin for left channel and a different input pin for right channel. Use the other remaining Pins as output pins for the second LoL Shield and rewrite the code to perform double the work. Do you think thats possible?
I guess you would need an intermediate chip to multiplex the signals from the Arduino between the two LoL Shields, and then some really complicated wiring. It might be possible but hardly seems worth it.
Andy,<br><br>What are the two (red and black) wires connected to your LOL shield for (5V Power?)? In your video I noticed that USB is left connected. Does the USB cable need to be left connected at all times? I thought USB was only needed to upload the code to Arduino.<br><br>Also, once you upload a pde to Arduino, how to do you remove that pde from Arduino? For example if I upload codeA.pde to arduino and later decide I now want to upload codeB.pde, how would I do that? Would I need to remove codeA first and then upload codeB, or will codeB just simply overwrite codeA?<br><br>Thank you so much in advance.
That's not a USB cable, it's just a DC barrel plug powering the Diavolino.
Hi Andy,<br><br>My build is definitely not going smooth. Any help would be greatly appreciated.<br><br>The story so far: I ordered everything Diavolino, LoLShield etc. Once difference between your setup and mine is that instead of making my LoL shield, I ordered a pre-built LoL Shield from Olimex. So I built out the Diavolino, connected the LoL shield and run the basic test. All LEDs lit up sequentially in diagonal and horizontal fashion. Now I uploaded your code to the Diavolino and as soon as it finishes uploading, the LEDs start randomly glowing as if already connected to audio source. I connect the audio source to GND and A5 (Analog 5). Still the LEDs glow in the same pattern as without the audio source. So adding the audio source had absolutely no affect. I also tried GND and pin A4 and modified the code to use A4 instead of A5. Still nothing just random blinking LEDs no VU meter. Please help. I am at my wits end.<br><br>Thanks<br>rootNull
Andy,<br><br>what kind of values do you expect the variable &quot;val&quot; to get from the AUDIOPIN? In my case (I enabled serial monitor and wrote out the value of val) I am getting val in the range of 1016 to 1027. This is without connecting an audio source. Once I connect an audio source nothing changes. The board and LoL are perfectly okay as I have run all kinds of test including addressing each individual led one by one. Please help.<br><br>rootNull
Andy,<br><br>Please help. I want this to work so bad. I got a second Diavolino and a second LoL shield and still the same result. <br><br>rN
where o nthe diavolino would i solder this, i want this to be used for an mp3 player one wire going to the speakers and one to lol shield.
You want the audio wires coming from the MP3 player to split, with two going to the Diavolino and two powering speakers. You might have to splice some wires together to do this.
thats the part i dont understand, where do the wires go on the diavolino? what i was going to do is use a headphone jack splitter and have one wire going from that to the speakers and the other to the diavolino i just am not sure where the wires go :/
that &quot;wire&quot; or audio cable is actually a pair of wires attached to an audio jack. one wire goes to Analog Pin 5 and the other wire to GROUND, as described in Step 2.
I tried this with an arduino uno, and its not working as of yet. I have a couple questions..<br>1. What software version/platform are you doing this on?<br>2. How do I import the libraries into the code?<br>3. I seem to be getting some interference, it is flashing some signal when there is nothing connected. Is this due to led 13? It seems to be larger than that...<br>good project. Will be added to my desk soon hopefully :)
Never mind. I got it to work- turns of its sort of interference until you plug it in. Looks good. I set a delay(25); at the end of the code, which to me looks a little better. Ill send you a video clip of it if you want, or post a few more instructions on here if you want. Great, wonderful project :)
Cool, glad you got it working! I'll try the delay.
the code dosint work ive ben working on this for 2 days in my office and have only come out to eat. were it sas include is empty.and led sign has not ben declared. X( pleas respond within 2 days. becous then i wold have givin up.<br>
Can you use this with a mic (and maybe an op amp) or is direct audio needed?
A mic would work the same as any audio source, but it may need some amplification.
Has anyone thought about a large panel color organ. Something along the lines of the movie Close Encounters?<br>Just a thought,
This... means something! This is important!
Not sure how to take your reply? Yes it means something. Your understanding of separating out the frequency bands for your metering, brought to mind the movie &quot;Close Encounters of the third kind&quot;. <br>In the ending scene there is a large color organ type panel, each note played initially by the technician from ARP Instruments on a n ARP 2500, lit a lamp on the panel.<br>I had laid out the schematics using band pass filters back then to make a wall size panel. Sort of a home brew spectrum analyzer.<br>
I like your idea and would be interested in seeing the schematics. How many band pass filters did you use?
I'm not sure where they would be now being 20 yrs ago.<br>The panel in the film is 12 wide by 6 tall, 72 filters<br>I set it up as LM741 OP Amp and resistor/capacitor for the band.<br>I pysically only got 12 channels put together and dropped the project due to costs/College
Sorry, I was just quoting the film, as in <a href="http://www.youtube.com/watch?v=xqhE7ieH2R8">this scene</a>. I understood what you meant.
Hi. Good Idea.
Now I remember the scene... I feel like an Idiot.<br>Would the software be fast enough and selective enough to create a smaller panel?<br>The project never was built due to the cost of all the band pass filters.
Yes, the program runs very fast. The FFT library gives you 64 frequency bands, so for less I am just averaging them together. I have seen there are some ICs which have the audio band pass filters built in, such as <a href="http://www.sparkfun.com/products/10468">this one</a> from Sparkfun.
Hi. Could it be possible to hook-up a normal electric guitar, w/ 1/4&quot; jacks to this device? I want 1 , 14x9 LED board per string. Can it run 9 x14? Total 54x14. in 6 segments Frequency freak show lol. <br> <br>Thanks for any Input / reply.

About This Instructable




Bio: This space intentionally left blank.
More by andydoro:LoL Shield Audio Spectrum VU Meter Table for Electronic Dreams 
Add instructable to: