I don't think that's a VU meter, It looks like a spectrum analyzer (with meters for various frequency bands).
Take a look at the MSGEQ7
. This slick little chip has all of the analog electronics for a 7-band spectrum analyzer "effect". (I've never used it, but as I understand it the 7 analog outputs are multiplexed for one Arduino analog input... You just read it at the right time to read any particular frequency band.)
You can also find examples of Arduino spectrum analyzers with the frequency-filtering done in software, using FFT. That might be the way to go if you want more than 7 frequency bands.
1. In the original diagram, the previous stage (AC to DC) provides 0 to 12vdc, given that the analog inputs of the arduino only takes 0-5v, is as simple as making a voltage divider so the inputs can read the values?
You can use a voltage divider, run the op-amp circuits from 5V, or use a pair of protection diodes.
2. In the code below, there´s a reference voltage, Would be this the line level reference voltage, or one from the previous stage, or another decided by me?
That can be decided by you. The easiset way is to use the internal 1.1V or 5V reference. Then, if you need to "fine-tune" the reference, you can use an additional software reference.
And, you can make your logarithmic references in software too.
Just for example, one of my simple lighting effects keeps track of the 20-second moving average (reading the output from a peak detector, which basically follows the loudness). That moving average is my software reference. Whenever the signal is greater than average the light comes on. Whenever the input is less than average the light goes off. The light flickers to the audio and I don't have to change anything when I change the audio volume, or when a louder or quieter song comes along. Another thing I do is automatically switch between the 1.1V & 5V references depending on the signal level. (Every time I switch the hardware reference, I have to scale-up or scale-down the values in my 20-second buffer array.)
My VU meter effect also uses "automatic calibration". You can't be constantly changing the calibration/reference with a real
VU meter, but it works great with a VU meter effect
. And, I didn't bother making my meter effect logarithmic. It's just a variable linear scale with the bottom LED triggered whenever the signal is above the 20-second moving average, and the top LED is triggered whenever the signal is above the 20-second peak. (Actually, the top LED might be triggered with it's one "step" below
the peak.) The idea for my effect is just to get lots of "meter action" no matter what the overall volume.