Friday, July 8, 2011

[DIY] Arduino VU Spectrum Analyzer

While searching on the Internet on interesting way of approaching the purpose of doing Fourier transform and why we need FT for my teaching.

I came across a fellow arduino user (http://andydoro.com/vulol/) that posted his toy project on using Fast Fourier Transform (FFT) to make a VU meter. Couple of years back, I did played with my home made wireless VU using electronic components that is available from the store. I am quite surprised that  an 8bit Arduino is capable of doing FFT, never did I thought of using it because usually I am using a PIC32dsp for transforming from time domain to frequency domain for signal manipulation purposes. Arduino did gave me the WOW moment for a while.

From the detailed explanations on his website , i downloaded his code and hook up my LOLshield on my laptop playing some song to enjoy the geekness of arduino LOL shield VU meter.... To my dismay, it doesn't work "out of the box". It just display a 1 liner.... both plug in to my laptop and plug out from my laptop. Seems that the VU only picking up white noise from the ambiance. The connections are correct, pin A5 for +ve signal from the left channel and ground to common ground of the mini stereo jack. 


To further complicate the issues, I tried on a variety of input of devices ranging from my android phone, my speakers with a BIG ASS amp etc. Suddenly IT hit me, probably the analog signal read in at pin A5 is too low to be detected as a usable base band signal where the FFT would chop up the signal in time domain to be put into frequency domain and the harmonics combined as 14 outputs (LOL shield only have 14 columns of LED).

There are 2 ways to put the analog in on steroids. The hardware method, I would use a TIP31C or TIP41C audio amplifying circuit OR the software method by scaling up the data read in on A5. I choose the software method, it requires little time to prove my hypotheses compared to the hardware method.....

It is kind of worrying.... the VU is more sensitive now ,picking up ambiance noise which is reflected in the below picture. The LEDs are lighting up ....More work needed to change part of the code to filter AWGN....

But once I plug the mini stereo jack to a Y connector with the headphone stereo jack into my laptop, the noise signal disappear.
Played one of my favorite songs with rich sound texture... Sorry for poor sound quality... I am playing it through my headphone.... still office hour and I can't turn on the LOUD music...


enjoy the code. you would need to place the FFT and charlieplexing libraries in your arduino\lib\ folder to compile successfully.

3 comments:

Deirdra Eden-Coppel said...

WOW that's amazing! You have a fabulous blog! I want to award you the Brilliant Writer Blog Award for all the hard work you do!

Go to http://astorybookworld.blogspot.com/p/awards.html and pick up your award.
~Deirdra

Dan Eisinger said...

I'm trying to do something similar, except with an addressable LED strip instead of a LOLshield. What was the Y connector you used that eliminated the noise?

sjteo said...

the Y connector is not a noise cancelling cable. It is just an audio cable with the gnd and RHS connected to the +ve and -ve respectively on the lolshield as inputs.