gain control

Thread Starter

bug13

Joined Feb 13, 2012
2,002


Hi guys

I want to control the gain of the op amp in a current sensing application, what is the practical way to do that? thanks.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Sorry I should have mention in my OP, I want to control it electronically, considering cost and part count ect, there is a MCU in other part of the circuit.

PS: the output of the op amp is fed to the ADC of a MCU
 

crutschow

Joined Mar 14, 2008
34,285
Depends upon how many gain steps you need. If only a few, you could use a multiplexer or analog switch and several R2 resistors in series. The mux/switch selects the tap point off the resistor string that goes to the minus (-) input which determines the gain. That configuration avoids any effect the mux/switch resistance has on the gain.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
The mux/switch selects the tap point off the resistor string that goes to the minus (-) input which determines the gain. That configuration avoids any effect the mux/switch resistance has on the gain.
I am not quite understand this configuration here, can you explain it a little bit more please, thanks!
 

crutschow

Joined Mar 14, 2008
34,285
I am not quite understand this configuration here, can you explain it a little bit more please, thanks!
Below is a simplified schematic of the scheme.

The switch can be any multiplexer or analog switch. Three gain steps are shown but it's limited only by the number of resistors and the number of switches or analog mux I/O's.

Since no current goes through the switch (except for the op amp bias current) the gain is little affected by the switch ON resistance.

The gain will be the ratio of the sum of the resistors above the switch position divided by the number below, plus 1. Thus, in the switch position shown, the gain is 1 + (R1 / (R2 + R3 +R4). The resistor values are selected to give the gain sequence you want and each resistor can have a different value depending upon the gains you need.

Vari Gain Amp.gif
 
Last edited:

crutschow

Joined Mar 14, 2008
34,285
Below is a simulation for the three switch positions with equal value resistors and a 1V pulse input.

Vari Gain Amp.gif

Edit: Here is the simulation with resistors selected to give gains of 2, 4, and 8.

Vari Gain Amp2.gif
 
Last edited:

Ron H

Joined Apr 14, 2005
7,063
One more switch position could be unity gain.
Also, a 1 Meg resistor from output to inverting input would prevent the gain from being open loop if the switch if break before make.
 

Ron H

Joined Apr 14, 2005
7,063
Can you explain more about the use of this resistor?
Some analog multiplexers have make-before-break switching. This means that, for a brief instant during switching, the "wiper" on the switch will be connected to the input it is leaving AND the input it is going to. In this case, feedback always exists between output and input. This is probably the best choice, if one can be found.
Other MUXes have break-before-make switching. This means that, for a brief instant during switching, the "wiper" on the switch will be connected only to the op amp -input, so there is no feedback path. The -input will have no current path to ground, so the output will have a "glitch" as the output attempts to go to one of the rails.
If you add a large value resistor (e.g., 1 MegΩ) from output to -input, then, while the switch is open, the op amp will run in unity gain mode, and the output will attempt to go to the voltage on the +input pin.
With slow op amps, the difference is probably unimportant. With wideband op amps, you might see an improvement.
The 1Meg resistor will cause a slight gain error due to the fact that it shunts the selected feedback resistance.
If individual analog switches are used, then the switch timing could be arranged to provide make-before-break switching, and the 1Meg resistor would be unnecessary.
 

screen1988

Joined Mar 7, 2013
310
Thanks, that is completely new to me.
This part is not quite clear to me.
Other MUXes have break-before-make switching. This means that, for a brief instant during switching, the "wiper" on the switch will be connected only to the op amp -input, so there is no feedback path. The -input will have no current path to ground, so the output will have a "glitch" as the output attempts to go to one of the rails.
Do you refer a circuit like this?

Then the output will be V+ or V- which depends on tapping point?
 

Attachments

crutschow

Joined Mar 14, 2008
34,285
Thanks, that is completely new to me.
This part is not quite clear to me.

Do you refer a circuit like this?

Then the output will be V+ or V- which depends on tapping point?
That is a very simplified diagram of an op amp. It doesn't really show the open-input condition being referred to. When one of the inputs of an op amp is open-circuit then there is no place for the bias current to go and the input will drift in voltage. As soon as that occurs, the high open loop gain of the op amp will drive the output to one of the rails. If you add a high resistance from the output to the negative (-) input, then there is always a path for the bias current and the output won't saturate if the negative feedback path is momentarily interrupted.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
So I just one or two switch, the mux I found are usually 8 channels, can I do that with transistor or something?

The gain I'm interested in are unity gain and x10
 

Ron H

Joined Apr 14, 2005
7,063
What is the output voltage range, i.e., does it swing ± around ground, or is it unipolar? What are the maximum voltages?
 
Top