Introduction: LED VU METER
I like homemade gifts and if I have enough time for it, I'll surely grab the opportunity to make one for someone. I was a bit uninspired for this one so I started looking online and got a few ideas and this is what I came up with.
So essentially what I made is a LED sign that turns on it rows of LEDs according to the amplitude of the audio signal being put into it, or the audio signal that its built-in microphone is picking up.
I think it's very effective for its simplicity since all we are doing is amplifying the input signal, comparing it to some threshold values(both done with op-amps) and switching the rows accordingly with some transistors.
Step 1: Input Signals
There are two audio inputs to choose from, a built-in microphone, or just a signal of choice through the 3.5mm audio jack. Let's cover some basics about the mic first:
Electret mics are the cheapest and easiest solution in this case. Internally, they change their capacitance according to the sound waves hitting their membrane so we'll use that to "read the sound" by converting that changing capacitance to change in voltage. We'll supply it through a single resistor and we'll put a so-called "DC-blocking" capacitor to, well, block any DC offset that the output signal might have. In the datasheet, manufacturer recommended supply voltage of 5V but didn't specify the value of the pull-up resistor or the capacitor. So that's where you'll need to tweak the mic personally. I used a 10k resistor and a 100nF ceramic cap.
As far as the audio input signal goes, I used two female audio jacks and connecter their ground, left and right channels together and converted the stereo signal to mono by connecting both channels into one net through 10k resistors. The other jack is there so you can then connect headphones/speakers to the board and use the audio signal as you would. This way, it doesn't matter which one is input and which one is output.
Either of these two signals can now be used as input, which means that we'll need an amplifier with a wide adjustable gain range to accommodate both signals cause they can vary a lot in amplitude.
Step 2: Amp
As far as audio amps go.. this isn't one you want to use for some quality audio amplification. This is just a pure amplification of the amplitude of the input signal and that's it. No bells and whistles. But it does the job we need it to do.
We'll use one of the op-amps of the LM324 quad op-amp IC in the "non-inverting" configuration to amplify the signal. Since the gain depends on the value of the resistors used, by using two leads of a potentiometer we can virtually get a variable resistor and hence, a variable gain. Just so we don't go all the way down to 0 Ohms we'll put a 100Ohm resistor in series with the pot and that will change the gain from around 11 to around 1000.
Step 3: Comparators
Now that we've got our input signal amplified, we need a way to differentiate which levels it's amplitude is passing. For that, we'll use the rest of the three op-amps remaining in the first lm324 and add another lm324 which will give us 7 levels. All of those op-amps will be used in the same manner, as comparators. Comparator simply puts out a logical "HIGH" on its output if the potential of its non-inverting input goes higher than the potential of the inverting pin, and it puts out a logical "LOW" or GND otherwise. By adjusting these voltages of the inverting inputs, we can make our seven comparators compare the input signal with seven known levels.
We'll start with 1V as the first level and increment it by 1V for every next comparator. Of course, the easiest way to do this is with a voltage divider, or simply two resistors where one is connected to Vcc(R1), and one is connected to GND(R2).
Assuming a Vcc of 12V these are the value of the resistors:
- 1V: R1 = 100k, R2 = 10k,
- 2V: R1 = 33k, R2 = 6.8k,
- 3V: R1 = 100k, R2 = 33k,
- 4V: R1 = 68k, R2 = 33k,
- 5V: R1 = 47k, R2 = 33k,
- 6V: R1 = 10k, R2 = 10k,
- 7V: R1 = 33k, R2 = 47k
When the audio signal is higher than the threshold, the output of that comparator should be around 10,6V if the LM324 is powered with 12V.
Step 4: Transistors
The outputs of the comparators can now be connected to the bases of some NPN transistors through a resistor and that way, when the input signal crosses a certain threshold the corresponding transistor allows current to flow between its collector and emitter, with the emitter connected to ground and collector to the cathodes of the row of the LEDs we want to turn on.
I used BC639, but any transistor with high enough collector current(current will vary on the number of LEDs in the row) will do the job.
Step 5: LEDs
Onto the main thing. Use a stripboard with lines, that way all the LEDs placed in one row will automatically be connected in parallel, which is what we want. When you're done, connect all the anodes of every row together, and solder a wire to each cathode line of the row. These wires will then be connected to the matching transistor.
When it comes to powering these LEDs, the fastest way for me was to use an LM317 variable voltage regulator and set it's output to around 2,9V(which is a tiny bit higher than the forward voltage of the LEDs I used). This way we need no resistors to limit the current and while it may be more appropriate to use a buck converter since the LM317 is a linear regulator and will dissipate a lot of power (use a heatsink!) because of the high voltage drop from converting 12V to 3V. I had no problems with heat because LEDs are not continuously powered, they are just powered by quick bursts and that way they don't draw too much current from the LM317.
Step 6: Assembly
Since I used a 100*160mm stripboard for the LEDs, I used the same size dot stripboard for components. I started with components for which I knew would have to be on the edge, like potentiometer and audio jacks and worked my way from there. I used pin headers with a jumper to change the input signal from cable to mic and vice versa. The leads which I clipped off of the LEDs were helpful since I could use them to make jumpers or just to extend some connection on the bottom.Terminal block connectors to wire the rows of LEDs to the corresponding transistor and lastly, I added a DC jack for the 12V supply and it was done.