Automatic gain control for LM386 amp based on source volume

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
Hello,

I'm trying to build a VU meter, or a VU tower. As of right now, I have LM386 wired to LM3914 in the usual way. The both have a 10k potentiometer, one for fine tuning LM3914, and another for volume control of LM386. Here's the issue: the LEDs are working fine when source audio volume (PC, in this case) is at 80%. If it's 100%, all of them light up and pulse, but not go up and down, like they are supposed to. I can tune this with the potentiometer on the LM386. If the source audio volume is 40%, only the first few LEDs light up, and I can control this as well with the potentiometer on LM386. However, there is no setting that makes LEDs work fine on both 40% and 100%, which got me thinking I may need an automatic potentiometer of some sort, or anything else that may solve this problem for me? I'm open for any ideas, as long as they don't require interaction each time the volume is changed. I understand that below 30% source audio volume, the LEDs simply don't work, and they can't, but I need something to regulate the volume based on source volume, so I can "simulate" the way they work when source is at 80%.

In case anyone needs this, here are the schematics used for both:

LM386 http://cdn.instructables.com/FDW/YM1V/GD2JJSYJ/FDWYM1VGD2JJSYJ.MEDIUM.jpg
LM3914 http://i.stack.imgur.com/4RpJ0.png

That's the layout, except instead of connecting LM386 to speakers, it's output is connected to LM3914.

Thank you for taking time to read this,
Have a great day!
 

AnalogKid

Joined Aug 1, 2013
8,227
It sounds like you want the LEDs to display relative volume rather than absolute volume. You can google 'agc schematic' and get lots of ideas about how to do this.

Beware - *many* circuits on Instructables are incorrect.

ak
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
Maybe like this:

@Dodgydave you're right, I had it wired differently, but I just dropped the wrong schematic here. Thank you

@AnalogKid Awesome! I didn't know the AGC name, so I didn't know what to search for. Mostly, I use instructables for ideas, never to carbon copy work from there

@#12 would you have an idea what to put instead of J176? Both electronics shops in my town never even heard of it, let alone offer a replacement?

Thanks a bunch for the help guys,
Have a great day!
 

#12

Joined Nov 30, 2010
18,167
would you have an idea what to put instead of J176?
Not right off the top of my head, but I can tell you its a pretty sloppy IDss range from 2ma to 25ma and the cutoff voltage is -4V.
j-fets aren't as mysterious as they seem after you play with a few. I'd say, just pick a p type j-fet with IDss of at least 2ma and check the cutoff voltage.
There's almost no DC voltage applied to it and the schematic requirement is that you have a positive supply just about large enough to turn the j-fet off.
I have only worked with n-type j-fets because I started when you basically couldn't buy a suitable p-type.
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
I don't think so. The bs250 is an enhancement mode transistor. J-fets are depletion mode.
But the idea of using a mosfet is interesting.
Hello,

Of course, the bs250 is readily available for almost free >.> As of right now, I have the lm386 set to boost like mad, and a 10k trimmer to set the top limit. Not the best solution, but it works. I'm going to surf through the two shops tomorrow asking them if they have a P-type JFET. If not, I guess the trimmer + decent amplification will have to do the trick.

Thanks a lot for the help, I'll keep you updated
Have a great day!
 

ian field

Joined Oct 27, 2012
6,539
It sounds like you want the LEDs to display relative volume rather than absolute volume. You can google 'agc schematic' and get lots of ideas about how to do this.

Beware - *many* circuits on Instructables are incorrect.

ak
AFAIK: the LM3915 with logarithmic response was the usual thing to use for audio work.

An alternative to the LM386 is the TDA7052 BTL amplifier - the type with A suffix has DC volume control and isn't too difficult to rig for AGC.

You can use the BTL amp single ended, but at reduced power output.
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
AFAIK: the LM3915 with logarithmic response was the usual thing to use for audio work.

An alternative to the LM386 is the TDA7052 BTL amplifier - the type with A suffix has DC volume control and isn't too difficult to rig for AGC.

You can use the BTL amp single ended, but at reduced power output.
Hey Ian,

I'm actually open for any suggestions, but it would be nice to keep in mind limited availability of products here and my very limited knowledge. For comparisons sake, I'd know how to hook up the AGC setup posted by #12, if I could find a P-type JFET. As long as it's not super expensive or supercomplicated, I'm open for suggestions!

Thank you so much for the help,
Have a great day!
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
AFAIK: the LM3915 with logarithmic response was the usual thing to use for audio work.

An alternative to the LM386 is the TDA7052 BTL amplifier - the type with A suffix has DC volume control and isn't too difficult to rig for AGC.

You can use the BTL amp single ended, but at reduced power output.
Hey Ian,


Is this literally all it takes? I could use LM7805 or something to tune 12v to 5 for the TDA, and add all this parts and that's it?

Thanks,
Have a great day!
 

ian field

Joined Oct 27, 2012
6,539
Hey Ian,


Is this literally all it takes? I could use LM7805 or something to tune 12v to 5 for the TDA, and add all this parts and that's it?

Thanks,
Have a great day!
Why drop the supply down to 5V? - The TDA7052A will work better than most audio chips at such low voltage, but its upper limit is higher than 12V.
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
Why drop the supply down to 5V? - The TDA7052A will work better than most audio chips at such low voltage, but its upper limit is higher than 12V.
Hey Ian,

Oh that's awesome! Well if I can do agc with so little parts and 12v which I already have, I'm definitely making the switch. LM386 started shorting my circuit for some reason, and nothing has changed, so the TDA sounds like a dream.

Thank you,
Have great day!
 

ian field

Joined Oct 27, 2012
6,539
Hey Ian,

Oh that's awesome! Well if I can do agc with so little parts and 12v which I already have, I'm definitely making the switch. LM386 started shorting my circuit for some reason, and nothing has changed, so the TDA sounds like a dream.

Thank you,
Have great day!
The maximum is 18V - 12V leaves a good safety margin.

The LM386 varies with version - with some its 15V, some types can take 22V.
 

Thread Starter

Predrag Beočanin

Joined Mar 20, 2016
8
The maximum is 18V - 12V leaves a good safety margin.

The LM386 varies with version - with some its 15V, some types can take 22V.
Hey Ian,

The whole circuit is ran by 12, so it should be fine. I'm having some trouble figuring out the components on the schematic I linked tho. There's a unmarked diode there, a "garden variety npn transistor" and an unmarked capacitor. Got the slightest clue what I may want to put there?

Thanks,
Have a great day!
 

dannyf

Joined Sep 13, 2015
2,197
The behavior you described is the correct behavior.

To avoid that, you can try to wire the lm3914 to the line in signal, before the lm386s volume control. If the line in doesn't have enough swing, put an amplifier to it.
 
Top