# Creating a “Sharp” Turn on for LEDs

I'm building an analog audio VU meter just for fun (no microcontroller). I already have the basic functionality of the circuit working. However, I would like the LEDs that I'm using to have a sharp, almost digital turn on.

I know how I could accomplish this using a comparator. Since I'm going to be using a lot of LEDs, I was trying to think of alternate ways of turning the LEDs all the way when a specific threshold voltage has been reached and completely off when it hasn't.

Anyone out there have any clever ways of doing this, maybe using zeners and/or some cheap BJTs? I can include a quick schematic of what I currently have, but it really isn't too important to the brunt of the question.

• For what it's worth, the "standard" VU Meter IC LM3914/5/6 does this. Internally, it's just a set of comparators. ti.com/lit/ds/symlink/lm3916.pdf – Passerby Jun 4 '13 at 5:18

Without a schematic it is impossible to say exactly what you can do. While a darlington pair or Schmitt might help, I believe that there is more to it than that.

For starters, do you want a peak or an RMS meter? If you are just running the audio to a bunch of comparators, maybe with an op-amp type buffer in the middle, then you have a peak meter. Peak meters are the easiest to make of the two, but not super easy to do right.

A simple peak meter would have just a bunch of comparators that turn on their respective LED when a voltage level is reached. RMS meters give you more of an average level over some time window. The difference between the peak level and the RMS level is called the crest factor. The crest factor varies depending on what the audio is, but it is not uncommon to see a crest factor as high as 15 dB.

What this means for you is that your peak meter will only light up top LED for a short time, and not super frequently. And by top LED, I do not mean LED 1 of 8. I mean the highest LED that should be illuminated. As the audio gets louder, that top LED might appear to start out dim and then get brighter. An LED that is on for a short time and not very frequently (say, 80 Hz) will appear dim.

But let's complicate this a little. Let's say you are feeding your VU meter with a 1 KHz sine wave. All of the LED's will be on 1,000 times a second. The lowest LED should be lit about 50% of the time. The highest LED will be lit maybe 5% of the time and appear dimmer than the lower LEDs. I am going to guess that is not what you want to see.

The correct behavior for a peak VU meter is that the highest LED (the peak) stays lit for several seconds after a peak, then decays down. The circuit you want to use for this is an envelope detector. Here's the circuit (roughly):

simulate this circuit – Schematic created using CircuitLab

The first thing to note is that I completely made up the component values and didn't test them. They are probably wrong! I also spent zero time picking an appropriate diode and opamp. This is only to show you the general idea, and that is all.

The first thing is the buffer (with gain). We need a buffer because we're charging a fairly large cap directly from the audio. We have some gain because the gain plus the voltage drop across the diode is going to determine the MINIMUM audio level that we can detect. You could bias the opamp output to a higher voltage to overcome this better. Even with a bias on the opamp output, you probably want at least some gain to make your VU meter thresholds more accurate.

When the audio peak comes out of the opamp, the cap is charged to that level. When the audio goes back down the cap does not discharge because of the diode. The cap is slowly discharged through R3, which provides your peak decay function.

You want another buffer on the "output" of the cap (not drawn) so that your comparators don't load down the cap too much and cause it to discharge before you want it to.

This type of envelope detector will only measure audio peaks in one direction, the positive direction. But because the input buffer+gain is an inverting buffer, we are actually only detecting the negative peaks. For 98% of all audio, this is perfectly acceptable. If you want to get super perfect, then you just add a second buffer in parallel to the first that doesn't invert the signal. Then take the output of that buffer, through a second diode, and into the cap.

I believe that doing this will not only make your VU meter useful, but also make the LEDs look correct.

To do an RMS meter, it gets complicated to do in the analog domain. For that I suggest using a microcontroller with an ADC on it. Then you can do the proper true-RMS metering and correct control over the time window.

• You want another buffer on the "output" of the cap (not drawn) so that your comparators don't load down the cap too much Doesn't a comparator have high-impedance inputs? – m.Alin Jun 5 '13 at 14:19
• @m.Alin A comparator does have high impedance inputs, but it gets a little iffy when you are feeding a bunch of comparators, have long wires picking up noise, etc. It is entirely possible to get away without another buffer, but you have to be a little careful and dot all I's and cross all T's. – user3624 Jun 5 '13 at 14:23
• Fair enough; I haven't thought of that. Also: We have some gain because the gain plus the voltage drop across the diode [...] (not sure if I'm right on this, but) couldn't you mitigate the diode's voltage drop by tying the R3 resistor to the cathode of the diode to make it an 'ideal diode'? – m.Alin Jun 5 '13 at 14:26
• @m.Alin I assume you mean R2, not R3. It might be possible, but it could also cause the opamp to basically "negatively clip" or "negatively saturate" the output because it can't bring the cap voltage negative. While this doesn't sound bad, many op-amps take time to recover from this state and this could effect things. Of course, most opamps do not describe this behavior in the datasheets so you'd just have to try it and see if your opamp happens to work fine. Odds are that it will work fine, but you never know until you try it. – user3624 Jun 5 '13 at 14:37
• Yep, I meant R2. I wasn't aware of that behavior on op-amps. Thanks and +1. – m.Alin Jun 5 '13 at 14:41

For a sharper turn on I've used Darlington pair transistors as switches in the past. The extra gain leaves a very small range for the 'not quite fully on linear range' of a single transistor.

• This is smart, and you can get DIP packaged arrays of darlington pairs, so it's perfect for driving a bunch of LEDs. – Void Star Jun 5 '13 at 2:46
• @BigEndian Thank you. Also if you use a dual supply you can set the turn on voltages to run from 0V and can have a linear or log response by selecting the resistor values. – JIm Dearden Jun 5 '13 at 6:49
• The outputs of the comparators are unlikely to be in the linear region for very long (in the uS range or less), so a Darlington pair is unlikely to improve the LED turn on speed by a noticeable amount. – user3624 Jun 5 '13 at 14:07
• @DavidKessner True, but I was responding to Big Endian's comment. If you are driving the LED straight from a comparator (say a 339) output you won't need a single transistor never mind a darlington. The linear /log comment was for the input voltage rather than the linear region of the transistor. Sorry for any confusion. – JIm Dearden Jun 5 '13 at 16:37
• @JImDearden I was commenting on your answer, not anything that you or Big Endian were talking about in the comments. – user3624 Jun 5 '13 at 17:02

I'd look at using a Schmitt trigger with minimal hysteresis for this. The Wikipedia article shows a few implementations that use only discrete components.

Maybe I'm misunderstanding your project, but why can't you just control the LEDs directly through resistors on the digital output pins? If you need to drive more LEDs than you have pins just use a shift register.