4
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ 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 \$\endgroup\$ – Passerby Jun 4 '13 at 5:18
3
\$\begingroup\$

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):

schematic

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.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 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? \$\endgroup\$ – m.Alin Jun 5 '13 at 14:19
  • \$\begingroup\$ @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. \$\endgroup\$ – user3624 Jun 5 '13 at 14:23
  • \$\begingroup\$ 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'? \$\endgroup\$ – m.Alin Jun 5 '13 at 14:26
  • \$\begingroup\$ @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. \$\endgroup\$ – user3624 Jun 5 '13 at 14:37
  • \$\begingroup\$ Yep, I meant R2. I wasn't aware of that behavior on op-amps. Thanks and +1. \$\endgroup\$ – m.Alin Jun 5 '13 at 14:41
4
\$\begingroup\$

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.

enter image description here

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is smart, and you can get DIP packaged arrays of darlington pairs, so it's perfect for driving a bunch of LEDs. \$\endgroup\$ – Void Star Jun 5 '13 at 2:46
  • \$\begingroup\$ @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. \$\endgroup\$ – JIm Dearden Jun 5 '13 at 6:49
  • \$\begingroup\$ 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. \$\endgroup\$ – user3624 Jun 5 '13 at 14:07
  • \$\begingroup\$ @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. \$\endgroup\$ – JIm Dearden Jun 5 '13 at 16:37
  • \$\begingroup\$ @JImDearden I was commenting on your answer, not anything that you or Big Endian were talking about in the comments. \$\endgroup\$ – user3624 Jun 5 '13 at 17:02
1
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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.

http://learn.adafruit.com/adafruit-arduino-lesson-4-eight-leds/the-74hc595-shift-register

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I didn't specify, I apologize. I'm doing this all analog, no micro. \$\endgroup\$ – Jay Greco Jun 4 '13 at 5:02
  • \$\begingroup\$ Ahh, okay. That makes sense. I don't have an actual solution for you but I can point you to something which may be similar. littlebits-production.s3.amazonaws.com/uploads/supporting_file/… \$\endgroup\$ – Void Star Jun 4 '13 at 5:05
  • \$\begingroup\$ No problem, that's actually very similar to the circuit I cooked up with comparators. It's always nice to know I was thinking in the right direction. \$\endgroup\$ – Jay Greco Jun 4 '13 at 5:06
  • \$\begingroup\$ Yeah... I got like 3 hours of sleep last night. I probably read "analog" as "Arduino" or something. \$\endgroup\$ – Void Star Jun 4 '13 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.