Setting Gain

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Samuel Groner

Well-known member
Joined
Aug 19, 2004
Messages
2,940
Location
Zürich, Switzerland
Hi

Simple question: I need to set the gain of an opamp in inverting config to -10 dB, 0 dB and +10 dB by changing the feedback-resistor. How do I manage this with a two-pole on-off-on switch? Of course, the off-position should be the 0 dB gain...

Thanks
Samuel
 
Don't think you can have the 0dB in the mid position! Think you will have the +10dB in the mid position then add feedback resistors to lower the gain in the left/right position.
The highest gain resistor shall be connected all the time then you add parallell resistors to lower the gain (more feedback)
Also think that you have to switch both the feedback resistor and the resistor from the +in to ground to keep the CMRR high!
To get 0dB in the mid position you will have to use on/on/on switch or use relays for the resistor switching!
 
At start, -10db won't do in feedback loop or anything. You'd need to pad the input going to the op-amp by -10db, then get 20db of gain out of the op-amp and after this I think the simpliest and wisest way would simply to have a changable pad at the output

We get -10 dB with an inverting config. I'll use it for a headphone-driver with an OPA551, so an output-pad is not a good way, as it would give high output-impedance.

o get 0dB in the mid position you will have to use on/on/on switch
Where do I get such a beast?
Samuel
 
Is this any help? It uses an on-off-on switch.

[Oops! Diagram updated to connect switch to inverting input]

plus_or_minus_gain.gif


Steve.
 
A connection from the switch to the inverting input is missing. This circuit will work but it wil have different input impedence for 2 of the switch settings, also switching directly on the inverting input will cause very loud clicks.

An on-on-on toggle switch that can be wired as 1 pole 3 position selector is APEM type 5644AB
 
[quote author="VacuumVoodoo"]A connection from the switch to the inverting input is missing.[/quote]

Sorry about that. I've updated the diagram.

This circuit will work but it wil have different input impedence for 2 of the switch settings, also switching directly on the inverting input will cause very loud clicks.

The input impedance will change, yes. With the component values shown, it'll be about 6K8 in the +10dB setting, and 22K for 0dB or -10dB.

I confess that I've not actually listened for clicks with this circuit. I use it very successfully in a VU meter driver.

The most common cause of clicks is allowing the feedback path to become open-circuit as the switch is moved. By switching in parallel elements, this circuit avoids that. Is there another click causing mechanism that I'm missing?

Steve.
 
> I need to set the gain of an opamp in inverting config to -10 dB, 0 dB and +10 dB by changing the feedback-resistor. How do I manage this with a two-pole on-off-on switch? Of course, the off-position should be the 0 dB gain...

Steve's (revised) diagram does just what you asked, except it only uses one pole. Unless you get paid by how many poles you buy, this is "better than you asked for."

One possible re-revision: instead of two 10K on the throws, use one 10K between the pole and the (-) input. Save $0.12! This (if near the chip) also decouples stray capacity which may cause clicks or instability. But there may be practical reasons to use the "extra" $0.12 resistor to simplify construction.

> it will have different input impedence for 2 of the switch settings, also switching directly on the inverting input will cause very loud clicks.

Samuel didn't set a spec for impedance, or clicks, though we assume he would not want something horrible. Steve's impedances are reasonable in many modern systems. If 6K/20K shifts are a problem, try scaling everything up 10X or 100X. Few systems will object to 60K/200K load changes, though some op-amps may have bias-current offset issues.

If constant input impedance is vital:
10-0-10.gif


{edit... see below}

> I always thought -10dB with op-amps ment 10dB gain with inverted polarity..

When stating gain as a numeric ratio, such as "1:10" usually written just "10", you use mathematical Multiplication. 1 volt in, gain of 10, 10 volts out. Here, the "-" works as polarity or sign: 1 volt in, gain of -10, -10 volts out.

AudioFools be darned, in audio the Polarity is never as important as the Magnitude. There is no use having the "right" polarity if the magnitude is too small to hear or too large to stand. 99 times out of 100, even with trained listeners, polarity can be either way and nobody can say which is right by listening. The deciBel system simply specifies magnitude ratio, and has no way to specify polarity. deciBels are positive numbers for ratio greater than one (gain), and negative numbers for ratios less than one (loss).

Voltage
Ratio _____ dB
100 _____ +40
10 ______ +20
3.2 _____ +10
1 ________ 0
0.32 _____ -10
0.1 ______ -20
0.01 _____ -40
 
See revised drawing, with 2K2, 6K8, and 420 ohm values.

This really gives -9.897dB, 0dB, +9.9463dB, which is accurate to 0.6% error; i.e. better than you will get with 1% tolerance resistors, more accurate than any VU meter and most fancy meters, and far more accurate than you need in a headphone blast control.

BUT, that wastes a resistor. If you are building more than 100 of these, you can pay me another half-hour of design time to avoid that cost. (I work cheap.) This is what I'd tell you:
10-0-10-b.gif


0.4% accuracy will cost you more; this one really gives 0.330X or -9.63dB, 1.01X or 0.086dB, 3.25X or +10.24dB. But if you are building with 5% resistors, this is "perfect" within component tolerance. Trimming out that fractional-dB error will need odd resistor values with better than 2% tolerance, and usually isn't warranted in audio. If you must: make the 3K3 a little smaller, increase the 6K8 a smudge, and make the 1K a little bigger.
 
FWIW: Steve's plan with just 10K and 22K parts is "in error", 10.103dB instead of 10.000dB. That is only 1.157% error, so even 1% resistors will have practical errors larger than the theoretical error. Pretty frikkin neat for two standard values.
 
[quote author="PRR"]FWIW: Steve's plan with just 10K and 22K parts is...neat for two standard values.[/quote] Yes...but standard 1% values would actually be 10.0k and 22.1k...not that it will make that much more error. Solutions with standard values are highly regarded in my circles! :thumb:

Peace!
Charlie
 
Back
Top