# Ideal operational amplifier circuit with variable voltage gain, how can I calculate the current?

#### dl324

Joined Mar 30, 2015
15,536
Now that I know that Vx=Vi*α the equation for Ix would then be:

Ix= (Vi-(Vi*α ))/R1=(Vi(1-α ))/R1
That's correct.

$$\small I_X = \frac{V_i-\alpha V_i}{R_1}$$
Vo should be Vx minus the voltage across R2 from left to right, shouldn't it?
Well, yes. But Vo is an unknown.
That voltage (across R2) would be equal to Ix*R2 where R2=R1 so then Vi(1-α)
Therefore Vo=(Vi*α)-(Vi(1-α)=Vi*α-Vi-Vi*α=-Vi
That doesn't seem right?

#### WBahn

Joined Mar 31, 2012
28,485
Now that I know that Vx=Vi*α the equation for Ix would then be:

Ix= (Vi-(Vi*α ))/R1=(Vi(1-α ))/R1

no more Rfreds!
Very good!

Vo should be Vx minus the voltage across R2 from left to right, shouldn't it?
That voltage (across R2) would be equal to Ix*R2 where R2=R1 so then Vi(1-α)
Okay so far.

Therefore Vo=(Vi*α)-(Vi(1-α)=Vi*α-Vi-Vi*α=-Vi

That doesn't seem right?
So, if it doesn't seem right, perhaps you should recheck your algebra.

NOTE: The fact that you spotted that it doesn't seem right puts you head and shoulders above most students and many professional engineers. Far too many people just accept whatever the answer happens to be. Instead, you did something that you should ALWAYS do -- you asked if the answer made sense. Good for you!

#### dl324

Joined Mar 30, 2015
15,536
That voltage (across R2) would be equal to Ix*R2 where R2=R1 so then Vi(1-α)
Therefore Vo=(Vi*α)-(Vi(1-α)=Vi*α-Vi-Vi*α=-Vi
That doesn't seem right?
Have you caught your math mistake yet?

Don't be in such a hurry to simplify the equation. Leave R1 and R2 unequal and write the general equation.

There are a couple lessons to be learned by making simplifications after you have the general equation.

#### Peterpan101

Joined Mar 4, 2017
20
I was just looking at it... I seem to have made mistake with the subtraction. Corrected it would then be
Vo=2Viα-Vi?

Unsimplified the voltage across R2 would be:
((Vi-αVi)*R2))/R1?

Then the general equation for Vo would be:
Vo=Viα-(((Vi-αVi)*R2))/R1)

thank you again for all of your help!

#### dl324

Joined Mar 30, 2015
15,536
I was just looking at it... I seem to have made mistake with the subtraction. Corrected it would then be
Vo=2Viα-Vi?
Very good. That's what I get too.

Then the general equation for Vo would be:
Vo=Viα-(((Vi-αVi)*R2))/R1)
Very good. That's what I get too. Your unnecessary parenthesis make the equation more difficult to read; rewritten in tex for readability:

$$\small V_o=\alpha V_i-\frac{(V_i-\alpha V_i)*R_2}{R_1}$$

I would write it this way to make it more apparent that it's $$\small \alpha V_i-I_XR_2$$:

$$\small V_o = \alpha V_i-(\frac{V_i-\alpha V_i}{R_1})R_2$$

Now for the lessons.

What happens if you set R1=R2 and $$\small \alpha=0$$?

And with R1 <> R2, relabeling R1 to Ri and R2 to Rf, and setting $$\small \alpha=0$$?

Last edited:

#### MrAl

Joined Jun 17, 2014
10,082
Hi,

The way the problem was presented it looks like R2 was always equal to R1.

#### dl324

Joined Mar 30, 2015
15,536
The way the problem was presented it looks like R2 was always equal to R1.
Agreed. But simplifying early would have deprived him of the opportunity to see for himself how the gain of an inverting amplifier was derived. I wanted to walk him through the process so it seemed less mysterious.

#### WBahn

Joined Mar 31, 2012
28,485
Another thing to note is that, with R1 = R2, the circuit allows the gain to be adjusted anywhere from -1 to +1, which is something that could be quite useful as a building block.

Now consider whether this behavior holds for R2 not equal to R1. What is the range of gains obtainable.

Next would be to look at the input resistance of the circuit as the pot is varied over its range.

#### Peterpan101

Joined Mar 4, 2017
20
$$\small V_o=\alpha V_i-\frac{(V_i-\alpha V_i)*R_2}{R_1}$$

I would write it this way to make it more apparent that it's $$\small \alpha V_i-I_XR_2$$:

$$\small V_o = \alpha V_i-(\frac{V_i-\alpha V_i}{R_1})R_2$$

Now for the lessons.

What happens if you set R1=R2 and $$\small \alpha=0$$?

The two resistors (R1 and R2) would cancel out and all parts involving α would become zero, making Vo=-Vi so we would just have a simple inverter?

And with R1 <> R2, relabeling R1 to Ri and R2 to Rf, and setting $$\small \alpha=0$$?
The way I understand it now the input Resistance is simply R1? So the pot doesn't matter in terms of the input resistance?
Doing it this way we still have all parts involving α disappearing so we would get:

$$\small V_o =-(\frac{V_i}{R_i})R_f$$
I've never tried tex before so I hope this works out, in case it doesn't:

Vo=-(Vi/Ri)*Rf

#### dl324

Joined Mar 30, 2015
15,536
$$\small V_o =-(\frac{V_i}{R_i})R_f$$
Rearranging slightly gives:

$$\small V_o =-\frac{R_f}{R_i}V_i$$

Which you'll recognize as the "text book" expression for the gain of an inverting opamp, which you derived yourself.

#### Peterpan101

Joined Mar 4, 2017
20
wow, that's really cool! I'm quite impressed. Thank you.

#### dl324

Joined Mar 30, 2015
15,536
wow, that's really cool! I'm quite impressed. Thank you.
When I was a technician at HP Labs, my Boss liked to have me derive text book formulas when I was building or designing circuits so I'd have a better understanding of my book learning. Just trying to pass it along...

#### WBahn

Joined Mar 31, 2012
28,485
The way I understand it now the input Resistance is simply R1? So the pot doesn't matter in terms of the input resistance?
Why do you think that?

What is the definition of input resistance?

Consider the case where the pot wiper is at ground. Now apply a voltage, Vtest, to the input and determine what the current flowing into the input, Itest, will be. Is the ratio R1? What about when the wiper is all the way at the top. How much current will be flowing in R1 then?

#### WBahn

Joined Mar 31, 2012
28,485
wow, that's really cool! I'm quite impressed. Thank you.
Look at the circuit and see if this makes sense to you. A habit you should get into is looking at the limiting cases of circuits. If the wiper is all the way at the bottom, then it is connected to ground and the pot is not part of the opamp circuit at all -- it is just a resistor connected to the signal source in parallel with a classic inverting amplifier. This observation does two things; it give you a sanity check for whatever gain equation you come up with and it also gives you an easy way to see the input resistance at this extreme -- and to see that it is NOT just R1.

Now look at the other extreme -- the pot all the way to the top. Again the pot is isolated from the opamp portion of the circuit and is in parallel with it. But now you have a virtual short across R1, meaning no current will flow in it. If no current flows in it, then no current flows in R2. Hence there is not voltage drop across either, meaning that the right side of R2 (Vout) must be equal to the left side of R1 (Vin), making a gain of +1, regardless of what R1 and R2 happen to be. So, again, you have a sanity check to use with whatever gain equation you come up with. If it doesn't reduce to an inverting amplifier at one extreme and a unity-gain buffer at the other, you know the answer is wrong.

Had you done this off the bat, then you would have been in a position to spot that your earlier result that had the effect of the pot dropping out was wrong, instead of having to rely on your gut feeling. Intuition is great and should be used as much as possible, but it is far from infallible and can easily lead us astray. So we want to back up our intuition with hard reasoning whenever possible.

#### MrAl

Joined Jun 17, 2014
10,082
The way I understand it now the input Resistance is simply R1? So the pot doesn't matter in terms of the input resistance?
Doing it this way we still have all parts involving α disappearing so we would get:

$$\small V_o =-(\frac{V_i}{R_i})R_f$$
I've never tried tex before so I hope this works out, in case it doesn't:

Vo=-(Vi/Ri)*Rf

Hi,

At the very least, the input resistance is the input voltage divided by the total input current.
The total input current in this case is the current through the pot plus the current through R1. See how an input current will flow through both of those?

You know the current through R1 is Vin/R1, and from your exercise you should know the current Ix. Knowing those two, you can sum them and then calculate the input resistance knowing the input voltage is Vin. You then end up with an expression for Rin.
Is it dependent on the pot setting? If you can eliminate the variable 'alpha' from the expression then it does not depend on the pot setting, but if you cant then it does In any of these problems you should always through a few numerical values in and do the full calcuation and see if the results work out. You calculate both voltages and currents and knowing the resistances see if your results obey Ohm's Law.
For example, if you calculate 2v across a 1 ohm resistor and you calculate 1 amp, you know you did something wrong. If you calculate 1v across 1 ohm and calculate 1 amp, then you go on to check the same for other resistors in the circuit and possibly other components too. if you find a contradiction, you know something still isnt quite right #### Peterpan101

Joined Mar 4, 2017
20
So looking at the circuit and the currents again I know from the nodes that Iin should be Ix+ the current going into the pot. At first sight I thought that could also be Ix making Iin=2Ix because Iin entering the node while the two other currents are leaving it. However, looking at different pot positions that doesn't make sense anymore. Should I approach the question using a current divider or am I overcomplicating things?

Thanks again to all of you, I think I'm learning more here than I have from my teacher.

#### WBahn

Joined Mar 31, 2012
28,485
Let's say that Vi is 10 V, R1 is 1 kΩ, the pot is a 10 kΩ pot, and the wiper is at position α?

How much current is flowing in the pot?

Did you need to know what R1 was to answer this?

Did you need to know the resistance of the pot to answer this?

Did you need to know the pot position to answer this?

Did you need to know what Ix was to answer this?

Did you need to know what R1 was to answer this?

Did you need to know the resistance of the pot to answer this?

Did you need to know the pot position to answer this?

Did you need to know what the current in the post was to answer this?

#### Peterpan101

Joined Mar 4, 2017
20
Let's say that Vi is 10 V, R1 is 1 kΩ, the pot is a 10 kΩ pot, and the wiper is at position α?

How much current is flowing in the pot?
So the current through the pot is just Vi multiplied by the overall pot resistance ?
Did you need to know what R1 was to answer this?
Did you need to know the resistance of the pot to answer this?
If I am correct, then yes.
Did you need to know the pot position to answer this?
Not really, if I am looking at the overall resistance of the pot, but if it is all the way at the top then it would virtually short circuit R1 meaning that all of the current would flow through it, wouldn't it?
Did you need to know what Ix was to answer this?
Well if we say that the total resistance of the pot is Rpot(1-α)+Rpot(α)=Rpot-Rpotα+Rpotα=Rpot Rpot=R (not Rfred but the value of R1) so the current would then be Ix again?

#### dl324

Joined Mar 30, 2015
15,536
At first sight I thought that could also be Ix making Iin=2Ix because Iin entering the node while the two other currents are leaving it. However, looking at different pot positions that doesn't make sense anymore. Should I approach the question using a current divider or am I overcomplicating things?
You're ignoring what you already know.

In solving for Vo, we've already established that Ix depends on pot wiper position:

$$\small I_X = \frac{V_i-\alpha V_i}{R_1}$$

What is the current flowing through the pot? Does it vary with pot wiper position?

With what you already know, you should be able to write the equation for Iin. So do that now...

#### dl324

Joined Mar 30, 2015
15,536
So the current through the pot is just Vi multiplied by the overall pot resistance ?

If I am correct, then yes.

Not really, if I am looking at the overall resistance of the pot, but if it is all the way at the top then it would virtually short circuit R1 meaning that all of the current would flow through it, wouldn't it?

Well if we say that the total resistance of the pot is Rpot(1-α)+Rpot(α)=Rpot-Rpotα+Rpotα=Rpot Rpot=R (not Rfred but the value of R1) so the current would then be Ix again?
Quoting for your response to @WBahn is messed up.