Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Another Opamp Math Question

Status
Not open for further replies.
I don't follow your formulas at all, but that may be because we aren't on the same page with the numbers. The offset is the same as the sensors with no signal; 2.5V.

The formula is a sum-difference form of the function of your sensor inputs required to obtain your output, regardless of the op amp circuit resistor values. See attached. I assumed (perhaps incorrectly) you come up with something similar since you realise that you wanted to use a gain of four.

Untitled picture.png

To start, 1.9 has to be subtracted from your sensor A (1.9 to 2.5v) output so that the circuit output starts from zero volts, giving a range of 0 to 0.6V. 1.9 must likewise be subtracted from your sensor B output (2.5 to 3.1v) so that it starts off from where sensor A output ends, giving a sensor B output of (0.6 to 1.2V). You then have as a result, a new offset voltage of 0.6 volts. To summarise in math terms we have: (A-1.9) + (B-1.9) - 0.6. We are not done, because you want 0-5V output, not 0-1.2V output, so that means applying a gain factor of 5/1.2 or 4.167 (your gain of 4 factor?). So then we have 4.167*[(A-1.9) + (B-1.9) - 0.6] which boils down to 4.167*A + 4.167*B - 18.333.

The only point I am making is that you will have to increase your negative offset voltage or apply gain to it to effect a largely greater subtraction term than you currently have. In your circuit configuration, that can be accomplished one way, by reducing the value of R3, but that also means adjusting the values of other resistor(s) to maintain the gain of 4 factor. It's a balancing act.

There are a few ways to configure such circuits. Here is one that should work. The two + inputs each have a gain of 4.167 (10K/2.4K) and the 2.5 voltage offset voltage has a gain of 7.333 (10K/1363.6) for an minus term of 18.3333 (2.5*7.3333).
 

Attachments

  • Untitled picture1.png
    Untitled picture1.png
    8.6 KB · Views: 121
Last edited:
The A=2.V should be closer to 1V output, but you have the idea. My gain factor of 4 was derived from the 0.6V actual swing per sensor output versus the 2.5V (2.4 for an even number) desired output swing.

I mostly follow your logic, though I have no idea how to get to the starting point you used. Hopefully you can see how I got to where I was. When both sensors had the 2.5V input, I knew I had to subtract one out. Since the input range was 0-5 between the sensors, I didn't need much else. When the range dropped to 1.9-2.5 and 2.5-3.1 I could see that I needed to expand the range (apply gain) and hoped that I could apply gain to just the sensors. I know I could if I added an op amp with gain to each sensor before adding them, but I also knew that there should be a way to combine it into a single stage.
 
Last edited:
The A=2.V should be closer to 1V output, but you have the idea. My gain factor of 4 was derived from the 0.6V actual swing per sensor output versus the 2.5V (2.4 for an even number) desired output swing.

I don't understand why A=2 should be closer to 1V out. The attached graph shows that it should be less than 0.5.

Yes, that's another way of arriving at the same gain. 2.5/0.6=4.167
 

Attachments

  • Untitled picture2.png
    Untitled picture2.png
    38.4 KB · Views: 123
Quote ccurtis: There are a few ways to configure such circuits. Here is one that should work. The two + inputs each have a gain of 4.167 (10K/2.4K) and the 2.5 voltage offset voltage has a gain of 7.333 (10K/1363.6) for an minus term of 18.3333 (2.5*7.3333).

I did not follow the whole discussion (up to now) - however, the third sentence from ccurtis obviously is false.
The voltages at both + inputs are amplified by the factor

A=(1+10/1.36)*2.4/(2.4+2.4)=10.
 
ADWsystems,

as mentioned before, I did not yet follow the whole discussion in this thread. Therefore, please ignore this posting in case I don`t meet the point.
However, one thing I do not understand:
All input and output voltages I have seen in your circuit description are positive. Nevertheless, your single-supply opamp always is biased with a positive dc voltage at the inverting input - leading to a negative dc output voltage (all signal voltages zero). Is this really your intention?
 
Winterstone,

Refer to the original design table and the note the sensors are never both zero at the same time (one is always 2.5V), thus the 2.5V at Vin- never drives the output less than zero, also take a read through the TI App Note I posted on the summing-subtracting opamp layout.
 
It was supposed to say 2.1V not 2.0. Typo, my bad. Math error on my part as well. I used 1.8V instead of 1.9V so I had the proportions wrong.

I see how you got there but I still can't figure out how I should have gotten to the same starting point. I guess I'm just that rusty.
 
Last edited:
hi ADW,
Have you tried the circuit I posted in Post #14.??

E.
 
Winterstone,

Refer to the original design table and the note the sensors are never both zero at the same time (one is always 2.5V), thus the 2.5V at Vin- never drives the output less than zero, also take a read through the TI App Note I posted on the summing-subtracting opamp layout.

OK, forget it. As mentioned, I didn`t go through your requirements in detail.
 
Quote ccurtis: There are a few ways to configure such circuits. Here is one that should work. The two + inputs each have a gain of 4.167 (10K/2.4K) and the 2.5 voltage offset voltage has a gain of 7.333 (10K/1363.6) for an minus term of 18.3333 (2.5*7.3333).

I did not follow the whole discussion (up to now) - however, the third sentence from ccurtis obviously is false.
The voltages at both + inputs are amplified by the factor

A=(1+10/1.36)*2.4/(2.4+2.4)=10.

As a matter of the output being a function of the inputs my "false" statement is correct. I don't understand the expression you provided to back up your claim either. Overall, the circuit most certainly does achieve the function (A*4.167) + (B*4.167) - 18.333 with 2.5V applied to the - input as shown in the figure provided, which is consistent with my supposed "false" statement.
 
Hi ccurtis, I am sorry for the misunderstanding - and a calculation error on my side.
As you can see the gain formula as mentioned in my former posting #24

(1+10/1.36)*2.4/(2.4+2.4)=4.176

is, of course, correct as it reflects the gain of a classical non-inverting opamp. However, there was a simple calculation error on my side which has led to the false result of "10" (see my posting '24).

However, I was (and still I am) somewhat confused about the resistor ratio 10k/2.4k you have mentioned at the end of your post#21.
Surprisingly, this ratio leads also to the correct gain of 4.176.
Please, can you explain the background of this ratio? I cannot recall any formula which supports this calculation.
Thank you
W.
 
However, I was (and still I am) somewhat confused about the resistor ratio 10k/2.4k you have mentioned at the end of your post#21.
Surprisingly, this ratio leads also to the correct gain of 4.176.
Please, can you explain the background of this ratio? I cannot recall any formula which supports this calculation.
Thank you

I think the surprising result lies in the fact that this particular combination of resistor values is a special case. The parallel combination of the two 2400 resistors just so happens to be equal to the parallel combination of the 10K resistor and the 1.3636K resistor. For this particular function of the inputs that are given and the output the original poster desires, the resistor values just turn out that way. Most often it doesn't work out that way and my earlier statement explaining the gain and offset would indeed break down and not hold true.

Later, I will post a straightforward design procedure for the generalized case of this sum-difference circuit that I learned and use.
 
Hi ccurtis, thanks for the reply and the explanation of the "mystery". .....although I wonder how you could arrive at this (correct) result without using the classical gain formula. Nevertheless - its not to important.
 
This is a design procedure for the attached general form of the circuit. Remove/add inputs as desired first and then follow the procedure, including or ignoring those inputs as appropriate.

1. Select a value for Rf.
2. Select resistors R1 thru R6 as if the gain for each of the corresponding inputs is Rf/Rx. Inputs connected to the - input subtract and inputs connected to the + inputs add. Thus:

Vout = V4*Rf/R4 + V5*Rf/R5 + V6*Rf/R6 - V1*Rf/R1 - V2*Rf/R2 - V3*Rf/R3

3. Calculate the equivalent parallel resistance of R1, R2, R3, and Rf. Call it Ra.
4. Calculate the equivalent parallel resistance of R4, R5, R6. Call is Rb.
5. If Ra > Rb, do not use Rp. Choose Rn such that Ra=Rb, where Rn is now included in the parallel resistance calculation for Ra above.
6. If Ra < Rb, do not use Rn. Choose Rp such that Ra=Rb, where Rp is now included in the parallel resistance calculation for Rb above.
7. If Ra=Rb, neither Rn or Rp is needed, but Rn and Rp can be included as long as they are equal in value. Including Rn and Rp in this case can provide a way to control the input resistance seen by the inputs to a degree.
 

Attachments

  • Untitled picture3.png
    Untitled picture3.png
    7.9 KB · Views: 113
Last edited:
I have tried the circuit in post 14. The circuit works exactlt as prescribed. Unfortunately the sensor range expected and noted on the bench (0-2.5 and 2.5-5) do not occur in the test setup for the actual application. The actual sensor outputs realized are 1.9-2.5 and 2.5-3.1V.
 
I have tried the circuit in post 14. The circuit works exactlt as prescribed. Unfortunately the sensor range expected and noted on the bench (0-2.5 and 2.5-5) do not occur in the test setup for the actual application. The actual sensor outputs realized are 1.9-2.5 and 2.5-3.1V.

hi,
OK, no problem.

Do you need a modified circuit based on post #14.?

E.
 
Hi ccurtis,
thanks for the reply, however, I still cannot follow you.
Up to now I was of the opinion to be rather familiar with opamp circuits (since 25 years), but now I feel confused.
I kindly ask you to answer the following question:

I understand that the equation

Vout = V4*Rf/R4 + V5*Rf/R5 + V6*Rf/R6 - V1*Rf/R1 - V2*Rf/R2 - V3*Rf/R2

gives the output voltage for the circuit (shown in your last posting) as a superposition of all 6 amplified input signals.

Assuming that the signals V1...V3, V5 and V6 all are zero the equation reduces to

Vout=V4*Rf/R4.

Do you agree?
Now my question:
1.)Do all the other resistors have no influence on the output voltage for this simple case?
2.) What about the classical formula for non-inverting gain: Vout=Vin+/Hr (Hr=feedback factor, resp. inverse noise gain)? The signal Vin+ is at the pos. opamp terminal (after input voltage division).
Thank you.
W.

Added later: Possibly, now I can follow you. Is it correct that the formula for Vout as given by you - and, therefore, also the reduced formula (only V4 present) - are specialized formulas, which are suited only for the specific case that the condition Ra=Rb (as defined by you) is fulfilled?
 
Last edited:
Added later: Possibly, now I can follow you. Is it correct that the formula for Vout as given by you - and, therefore, also the reduced formula (only V4 present) - are specialized formulas, which are suited only for the specific case that the condition Ra=Rb (as defined by you) is fulfilled?

Yes. The classical equations we know and love for inverting gain and non-inverting gain still apply. The OP's circuit requirements just so happens to result in a special case, where the classical equations combine and reduce down to a form such that the gain is Rf/Rx for both inputs of the opamp, which, admittedly, looks odd at a glance, since the classical form for the gain of an non-inverting amp is A(1+Rf/Rx), not just Rf/Rx; where A is a factor calculated using all of the various other resistors in the circuit.
 
Last edited:
Yes. The classical equations we know and love for inverting gain and non-inverting gain still apply. The OP's circuit requirements just so happens to result in a special case, where the classical equations combine and reduce down to a form such that the gain is Rf/Rx for both inputs of the opamp, which, admittedly, looks odd at a glance, since the classical form for the gain of an non-inverting amp is A(1+Rf/Rx), not just Rf/Rx; where A is a factor calculated using all of the various other resistors in the circuit.

Ccurtis, thank you. As mentioned already I am involved in opamp applications since more than 25 years (I was even teaching in this area), but - up to now - I never have heard about this method to design adding/subtracting circuits. However, I remember a contribution in EDN (or Electronic Design) several years ago, which might have described such a simplified method. But I didn`t see any advantages - thus, I didn`t read it in detail.
Thanks again.
W.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top