Op amp design help please!

MrAl

Joined Jun 17, 2014
11,396
Yes I DO understand HOW a summing (and differential) amp works. Do you?
What makes is SO difficult is when you try to add a bias offset to the differential amp.
The differential amp depends upon the the ratio of Rg and R2 being identical to the the Ratio of Rf and R1.
Any added resistor must not disturb this ratio.
Thus for example, in the circuit in Post #12 the equivalent parallel resistance of R3 and R4 must equal the value of RL.
The Value of R3 and R4 must also be selected to give the desired 5V offset at the output.
I don't see how to get R3 and R4 to satisfy both criteria without solving two simultaneous equations for their values.
If you can, than I would like to see how.
Hi,

If you use a floating voltage reference you can do it, but the OP claims that the negative rail is available so we can actually use that to bias the (other) input. It doesnt work as a 'summer' because we arent just summing as you know, but on the other input we can bias the 'ground' and that is not a summer. That's one way to do it, but not sure if you want to explore more ways too which would be interesting.
 

MrAl

Joined Jun 17, 2014
11,396
I get this far but then it becomes too difficult.....
View attachment 114612
Hi,

This is a linear circuit so you should be able to pick two criteria and set up two simultaneous equations. For example, one equation with V2=1 and V1=2 and one equation with V2=3 and V1=4, and the output must always satisfy Vout=(V1-V2)-5 for a gain of 1, or Vout=A*(V1-V2)-5 for a gain of A. Then it must also work with a third set of inputs.
See if you can work that out, but if you cant get both satisfied then there is no solution for that particular configuration. It does work with the floating reference though.

I can pretty much tell you though that with a resistor only on the inverting input it wont work because the non inverting input is not grounded.
 

crutschow

Joined Mar 14, 2008
34,285
Okay, I think I see a way out to simplify the calculations. :)
In RBR1317's circuit in Post #20, connect another resistor from the (+) opamp input to ground equal to the value of Rb.
That way, when you calculate the value of Rb to give the desired 5V output bias, the same resistor value connected from the (+) opamp will keep the plus and minus side resistor ratios balanced and won't upset the differential gain value between V1 and V2.

Alternately you could change the value of Rg to the parallel value of Rb and the original value of Rg but you likely won't end up with an exact 1% value, which will upset the ratios by the difference between the calculated value and the actual 1% value.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,396
Hello,

Well i found a solution to WBahn's suggestion, at least for a gain of -1 overall.
After solving for all resistors, the solution came out to Rg=R/2 and all other resistors equal to R, and the 'bias' voltage equal to +5v but of course we can change that if needed as i set that arbitrarily.

Because of this one solution that does work i have faith that there should be other solutions with other gains and other 'bias' voltages.

It did not look like it would work at first but it does. Someone could double check this in simulation. All resistors equal (say 10k) except that lower resistor Rg would be 5k.

The other solution however requires only 4 resistors total, and that is to bias Rg with a negative voltage. With a voltage of -5v it provides an output offset of -5v.
 

crutschow

Joined Mar 14, 2008
34,285
Here's my modification to RBR1317's circuit, which simplifies the calculations and requires no separate bias voltage source.
You just calculate the values of R1, Rf, R2 and Rg to give the desired differential gain, and the value of Rb to give the desired offset

upload_2016-11-1_13-37-5.png
 

WBahn

Joined Mar 31, 2012
29,979
Yes I DO understand HOW a summing (and differential) amp works. Do you?
That was a generic "you", as in, "the person designing the circuit," It was not a "you" and in , "crutschow".

As for your second "you", I assure you that *I* most definitely understand how both work -- and I can leverage that understanding to actually solve other problems that are not copy-the-circuit-from-some-reference type problems, such as this one.

What makes is SO difficult is when you try to add a bias offset to the differential amp.
Why? What is a bias offset other than an additional signal that is added along with the others?

If we understand that the summing action in the summing amplifier is actually accomplished by summing the currents the flow into a summing node and then forcing those currents to flow out through the feedback resistor to the output node, then we can add additional signals to the circuit by simply adding a resistor between the new signal and the summing junction. If we further understand that the individual input resistors do not have to be the same, then we can introduce individual scaling coefficients to each input. Thus our output becomes:

Vo = A·V2 - (B·V1 + C·Vs)

I don't see how to get R3 and R4 to satisfy both criteria without solving two simultaneous equations for their values.
So what is so horrible about the prospect of solving a couple of simultaneous equations?

But you don't even need to do that in this case.

If you can, than I would like to see how.
Fine. I'll go ahead and show how to solve it. If that lets the TS cheat on this one problem, it's not the end of the world.

The simple topology that results from taking the difference between one signal and the sum of two other signals by combining the key aspects of a summing amplifier and difference amplifier is:

sumdiff.png

Now we just analyze the damn circuit!

\(
V_i \; = \; V_2 \( \frac{R_g}{R_2 \; + \; R_g} \)
I_1 \; = \; \frac{\(V_1 \; - \; V_i\)}{R_1}
I_b \; = \; \frac{\(V_b \; - \; V_i\)}{R_b}
V_{out} \; = \; V_i \; - \; \( I_1 \; + \; I_b \) R_f
\)

That's all the EE stuff. Now it's just math.

\(
V_{out} \; = \; V_i \; - \; \( I_1 \; + \; I_b \) R_f
V_{out} \; = \; V_i \; - \; \( \frac{\(V_1 \; - \; V_i\)}{R_1} \; + \; \frac{\(V_b \; - \; V_i\)}{R_b} \) R_f
V_{out} \; = \; V_i \( 1 \; + \; \frac{R_f}{R_1} \; + \; \frac{R_f}{R_b} \) \; - \; V_1 \( \frac{R_f}{R_1} \) \; - \; V_b \( \frac{R_f}{R_b} \)
V_{out} \; = \; V_2 \( \frac{R_g}{R_2 \; + \; R_g} \) \( 1 \; + \; \frac{R_f}{R_1} \; + \; \frac{R_f}{R_b} \) \; - \; V_1 \( \frac{R_f}{R_1} \) \; - \; V_b \( \frac{R_f}{R_b} \)
V_{out} \; = \; V_2 \( \frac{1}{\frac{R_2}{R_g} \; + \; 1} \) \( 1 \; + \; \frac{R_f}{R_1} \; + \; \frac{R_f}{R_b} \) \; - \; V_1 \( \frac{R_f}{R_1} \) \; - \; V_b \( \frac{R_f}{R_b} \)
\)

So now, without even using Wolfram Alpha, we see that we have an equation for Vout that is of the form

\(
V_{out} \; = \; A \cdot V_2 \; - \; B \cdot V_1 \; - \; C \cdot V_b
\)

Our goal is to obtain the relationship

\(
V_{out} \; = \; 10\(V_2 \; - \; V_1 \) \; - \; 5 \, V
V_{out} \; = \; 10 \cdot V_2 \; - \; 10 \cdot V_1 \; - \; 5 \, V
\)

So all we have to do is just match up the coefficients term by term.

\(
C \cdot V_b \; = \; V_b \( \frac{R_f}{R_b} \) \; = \; 5 \, V
\)

If we use the +12 V supply rail, then we have

\(
\frac{R_f}{R_b} \; = \; \frac{5 \, V}{12 \, V} \; = \; 0.41667
\)

Next we equate the V1 coefficient to get

\(
B \cdot V_1 \; = \; V_1 \( \frac{R_f}{R_1} \) \; = \; 10 \cdot V_1
\frac{R_f}{R_1} \; = \; 10
\)

Finally we equate the V2 coefficient to get

\(
A \cdot V_2 \; = \; V_2 \( \frac{1}{\frac{R_2}{R_g} \; + \; 1} \) \( 1 \; + \; \frac{R_f}{R_1} \; + \; \frac{R_f}{R_b} \) \; = \; 10 \cdot V_2
\( \frac{1}{\frac{R_2}{R_g} \; + \; 1} \) \( 1 \; + \; \frac{R_f}{R_1} \; + \; \frac{R_f}{R_b} \) \; = \; 10
\( \frac{1}{\frac{R_2}{R_g} \; + \; 1} \) \( 1 \; + \; 10 \; + \; 0.41667 \) \; = \; 10
\( \frac{1}{\frac{R_2}{R_g} \; + \; 1} \) \( 11.41667 \) \; = \; 10
\frac{1}{\frac{R_2}{R_g} \; + 1} \; = \; \frac{10}{11.41667}
\frac{R_2}{R_g} \; + 1 \; = \; \frac{11.41667}{10}
\frac{R_2}{R_g} \; + 1 \; = \; 1.141667
\frac{R_2}{R_g} \; = \; 0.141667
\)

Notice that the hardest computation was dividing 5 by 12.

So, if we fix Vb = +12 V, we have three ratios that we need to satisfy:

\(
\frac{R_f}{R_b} \; = \; 0.41667
\frac{R_f}{R_1} \; = \; 10
\frac{R_2}{R_g} \; = \; 0.141667
\)

If we want, we can tie all of these together by requiring that R1 = R2 (so that the small signal input impedance is balanced). So let's set those equal to 10 kΩ, That means that we have

R1 = 10 kΩ
R2 = 10 kΩ
Rf = 100 kΩ
Rb = 240 kΩ
Rg = 70.6 kΩ

So let's check our work with a couple of simple cases.

First, let V2 = V1 = 0. We want the output to be -5 V.

By inspection, Vi = 0 V, so Ib = 0 and I1 = 12 V / 240 kΩ = 0.05 mA.
This means Vout = 0 V - (0.05 mA · 100 kΩ) = - 5 V.

Now let's pick V2 = 4 V, V1 = 3 V. The output should be +5 V.

Vi = 4V (70.6 kΩ / (70.6 kΩ + 10 kΩ)) = 3.504 V
Ib = (12 V - 3.504 V)/240 kΩ = 0.0354 mA
I1 = (3 V - 3.504 V)/10 kΩ = -0.0504 mA
Vout = 3.504 V - (-0.0504 mA + 0.0354 mA)(100 kΩ) = 5.004 V
 

MrAl

Joined Jun 17, 2014
11,396
But how are you generating this "bias" voltage?
Hi,

You mean where does it come from?

In the five resistor version it comes from the positive +Vcc rail. If the rail is not +5v then we have to recalculate that's all. If the positive rail is not stable though then we cant use that.

For the four resistor version, the bias is negative and comes from the negative rail with same idea.

One of the main points to the five resistor circuit is we cant just throw a resistor on the inverting input in the 'normal' way which is to provide a current V/R we have to do a little more work. Simultaneous equations should not be viewed as too difficult though unless it's a very early introduction to electric circuits.
 

crutschow

Joined Mar 14, 2008
34,285
That was a generic "you", as in, "the person designing the circuit," It was not a "you" and in , "crutschow".
I don't think so.
In your Post #17 you made that condescending statement in reply to one of my posts, so it certainly seemed directed to me.

Okay, I see after a shitload of calculations you generated an answer for the "damn circuit".
You may consider those calculations trivial but the OP may not. :rolleyes:

I prefer my approach in post #26.
It only requires a couple of simple calculations and generates no odd value resistances such as Rg=70.6k.
Of course it actually gives the same answer since 100k in parallel with 240k just happens to be ≈70.6k.
 
Last edited:

WBahn

Joined Mar 31, 2012
29,979
I don't think so.
In your Post #17 you made that condescending statement in reply to one of my posts, so it certainly seemed directed to me.
I certainly did not mean to direct it at you, specifically. The discussion is about a student being able to solve the problem and so it is the student's comprehension I was referring to. You are wearing your feelings on your shirtsleeves -- something we all do more often than we should. In fact, I was offended by you coming back and very pointedly questioning whether I understood it when I had made no disparaging remark concerning your personal understanding of it. But now that I understand that you thought I WAS calling your personal understanding into question, I understand your response better.

A better phrasing of the statement you have found so condescending might be (image calm, conversational tone of voice), "If someone understands HOW a summing amplifier works, what is SO difficult about seeing how to add a fifth resistor to the diff amp such that it is taking the difference between V2 and the sum of two other signals?" The question of "what is SO difficult" WAS directed at you because you were the one claiming that it would be difficult for them to do so, but it was simply a question asking what is it that should be seen as so difficult for someone that understands how a summing amplifier works.

Okay, I see after a shitload of calculations you generated an answer for the "damn circuit".
You may consider those calculations trivial but the OP may not. :rolleyes:
Look carefully and you will see that there aren't a "shitload of calculations". The calculations and steps are presented in extreme detail because so many people (at least three) appeared to be having a hard time seeing how to solve it based on the description of the approach I was recommending, so I opted to (hopefully) ensure that I didn't inadvertently skip over some step that was key to someone not only following the work, but grasping the concept behind the approach.

Here is a scan of the actual work I did to solve the problem. The problem itself was solved in about a ten lines -- six equations dealing with the EE and six dealing with the math. Again, the ONLY one that a calculator was used on was dividing 5 by 12. It took less than five minutes to do everything to get the three ratios. Can you really say that this qualifies as "a shitload of calculations"?

Then a set of actual values for a prototype circuit were obtained in, literally, less than one minute (I just did them from scratch and it took 40 seconds).

The test case was completely done (again, I just redid it from scratch) in only three minutes.

I just went and completely reworked the solution on a clean sheet of paper with no reference and it took 38 seconds to draw the diagram, 2:07 to perform the EE analysis, and then 1:10 to solve the math to the point of having the three ratios. The total time from drawing the circuit to having the test case results verified was less than eight minutes total. This is very consistent with how long it took the first time since I did everything during a single ten-minute passing period between classes.

I prefer my approach in post #26.
It only requires a couple of simple calculations and generates no odd value resistances such as Rg=70.6k.
Of course it gives the same answer since 100k in parallel with 240k just happens to be ≈70.6k.
I prefer your approach, too, if only for the better symmetry. But I still contend that my approach is something that should not be unreasonable to expect someone that has seen and understands the classic summing and difference configurations to be able to synthesize a combination that solves the problem. Your approach, while a more elegant topology, is NOT one that I would expect a student at that level to be able to come up with.
 

Attachments

RBR1317

Joined Nov 13, 2010
713
This was an excellent problem! I learned a few new things about working with Maple. Previously I had gotten only as far as Eqn (5) in the attachment - the expression for Vout. Note: the exact value for Rg is 1200/17.
 

Attachments

MrAl

Joined Jun 17, 2014
11,396
Hi,

Just a quick note...

Simultaneous equations are usually required right after Ohm's Law because that's when we have to deal with more than one node usually, and that often requires simultaneous equations. They are not hard to generate most of the time either after finding the correct transfer function. I set mine up by knowing that the difference between E1 and E2 was a constant 'V' for a constant output, and the constant output would then be simply V*A-Voffset. So E1=E2-V and the output was V*A-Voffset and that got me the equations i needed (A was the desired gain).

It is a little interesting though that a long time ago i was giving an online course in circuit analysis and everybody on the site loved it and was following along very nicely, until we got to simultaneous equations. I was very sad to see that everyone dropped out at that point. I think that was because for someone who never used them before it seems rather strange and difficult that we have to find the solution to two or more variables at the same time.
I cant remember far enough back to remember what it was like for me to learn them as it was just too long ago. It has long become second nature. Unfortunately that also means i lost my insight into how hard it is for newer people to grasp, but i guess i've seen first hand that it must be hard at first coming from straightforward algebra like "c=x+a solve for x".
 

WBahn

Joined Mar 31, 2012
29,979
It is a little interesting though that a long time ago i was giving an online course in circuit analysis and everybody on the site loved it and was following along very nicely, until we got to simultaneous equations. I was very sad to see that everyone dropped out at that point. I think that was because for someone who never used them before it seems rather strange and difficult that we have to find the solution to two or more variables at the same time.
I cant remember far enough back to remember what it was like for me to learn them as it was just too long ago. It has long become second nature. Unfortunately that also means i lost my insight into how hard it is for newer people to grasp, but i guess i've seen first hand that it must be hard at first coming from straightforward algebra like "c=x+a solve for x".
Like you, I can't even remember at what point I was introduced to simultaneous equations. I know it was after sixth grade and before ninth grade. In fact, I'm pretty sure it was eight grade. I remember loving them from the start -- it was like having a whole new world opened up to me. I remember making up my own problems (simple, to be sure). One of the first that I came up with was finding the width and height of a triangle such that the area and perimeter both had desired values. In the process I discovered the notion of bounds since there are combinations of values that you can't obtain. What really made this particular example stick in my mind is that after conjuring it up on my own, we actually used it as an example in class the next day.

When I was in high school and an undergrad, I don't recall any of my peers (though there had to be numerous exceptions) that were intimidated by solving simultaneous equations. It was just something that you dug in and did. We didn't have any calculators or software tools to do it for us, either. So if you had five or six equations that needed to be solved, you simply accepted that you had a few pages of algebra ahead of you that had to be done very carefully.

Today most grad students don't know how to handle three equations and many of them are stumped by two. But this probably shouldn't be surprising since the basic skills of solving a single equation for a single variable are almost non-existent any more.
 

MrAl

Joined Jun 17, 2014
11,396
Hi again,

Very interesting, that must have been rewarding to see your example used as an actual course example.

I tried to figure out how to present simultaneous equations in the simplest way but the simplest way i could think of was geometrically starting with only two variables, where the solution is the intersection of two straight lines. That's of course if there had been some previous light geometry work done.
That's because it seems that some students at first cant believe that it is possible to solve for two variables at the same time so they enter it with some disbelief right at the start. I guess it could vary with each student though depending on how they view things in general.

If it were up to me everyone would be doing this on a regular basis, but then again if it were up to me everyone would be analyzing circuits on a regular basis too :)
 

WBahn

Joined Mar 31, 2012
29,979
I remember making up my own problems (simple, to be sure). One of the first that I came up with was finding the width and height of a triangle such that the area and perimeter both had desired values. In the process I discovered the notion of bounds since there are combinations of values that you can't obtain. What really made this particular example stick in my mind is that after conjuring it up on my own, we actually used it as an example in class the next day.
I think my memory is faulty on this. I remember coming up with this problem and then it being used the next day, but the more I think on it I'm pretty sure it wasn't related to simultaneous equations. Perhaps the quadratic equation?
 
Top