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.
Answer
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.
No comments:
Post a Comment