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 have run into a but of situation on my next project. The system has two sensors with an idle voltage of 2.5V. One sensor isn't enough to cover the range I need, so I was thinking of using two sensors. One for the top half, and one for the bottom. The from the middle down, the lower sensor decreases in value, from the middle and higher, the upper sensor increases in value. Thus only one sensor is active at a time. I have this result

Range S1 S2
0% 0V 2.5V
25% 1.25V 2.5V
50% 2.5V 2.5V
75% 2.5V 3.75V
100% 2.5V 5.0V

If I add the sensors together and subtract 2.5V I can get 0-100% to read 0-5V. I found the following circuit from a TI app note and tried the following circuit with less than thrilling results.

View attachment 64481

View attachment 64482

With Sensor 1 at 0V and Sensor 2 at 2.5V, the output is 800mV. With Sensor 1 at 0V and Sensor 2 increased to 5V (a situation that will never happen the output is 1.65V. The output voltage should be V2 + V3 - 2.5V. I'm not quite sure where I'm going wrong. Any insight is welcome.
 
Last edited:
At a quick read of the datasheet for the MC33172, the output voltage cannot swing to within 800mV of the supply rails.

So for your 0-5v supply, the lowest output voltage is 800mV, and the highest output voltage is 4.2v.

I think you need more supply volts.

JimB
 
hi ADW,

What do you calculate the Gain to be of the MC33172 with R3 connected to R1 and R2 junction.?

E.
 
hi ADW,

If I understand correctly, is this what you expect to measure on the output.?

Refer image... note I have used for the LTS Sim a rail to rail OPA.

Operation:
S1 increases from 0V to 2.5V, while S2 is at 2.5V

When S1 reaches 2.5V, it stops increasing and S2 starts increasing from its 2.5V point towards 5V.

The combined output due S1 and S2 increases from 0V to +5V

E.
 
hi ADW,

If I understand correctly, is this what you expect to measure on the output.?

Refer image... note I have used for the LTS Sim a rail to rail OPA.

Operation:
S1 increases from 0V to 2.5V, while S2 is at 2.5V

When S1 reaches 2.5V, it stops increasing and S2 starts increasing from its 2.5V point towards 5V.

The combined output due S1 and S2 increases from 0V to +5V

E.

BINGO! That's exactly what I'm looking for.

So what and why are you doing what you're doing to the 2.5V offset and Rf/Rin=2 on the op amp - input?
 
Last edited:
hi,
The point you have to consider is the output impedances of the two sensor sources, S1 and S2.

Assume for explanation that S1 and S2 have internal output impedances of say 1K, this would mean that on my diagram that R3 and R4 would be effectively 11K.

So the Vsum would not be exactly 1/3 division,, an easy way to get precise values would be to make R5, a 10K in series with a 2Kpot, then you could make R5 total =11K.

Likewise with the R6 and R7 Vref source, you could have a 50Kpot from R6 to R7 and take off the Vref from the pots wiper.

Using these pots you will able to 'tweak' the values to get the required output Vout ...OK.?
 
I just finished a wonderful project that required selecting pots to tweak the resistor values based on their tolerances. Thank you for the reminder/warning on R3/R4/R5.

My bigger question is why you have R6/R7 setup 3:1 and then R1/R2 setup 2:1; instead of having both R6/R7 and R1/R2 set 1:1. Plus why you used the follower YU2.
 
I just finished a wonderful project that required selecting pots to tweak the resistor values based on their tolerances. Thank you for the reminder/warning on R3/R4/R5.

My bigger question is why you have R6/R7 setup 3:1 and then R1/R2 setup 2:1; instead of having both R6/R7 and R1/R2 set 1:1. Plus why you used the follower YU2.

hi,
The gain relative to the -Vin of the OPA is R1/R2= 2, the gain relative to the +Vin of the OPA is 1+[R1/R2]=3.

With the R3,4,5 you have 1/3 division so effectively the the OPA gain relative to the S1 and S2 is 1.
The divider R6 and R7 gives a Vref of 5V* [330/1333]=1.25V, so the -Gain of 2 gives an offset of -2.5Vout, which is cancelled by the +2.5V due to 2.5V of S2, ie= 0 Vout

I use the low output impedance of the Vref OPA in order to to ensure the gains of the 'main' OPA are correct when using those resistor values for the gain.

E.
 
Last edited:
hi,
The gain relative to the -Vin of the OPA is R1/R2= 2, the gain relative to the +Vin of the OPA is 1+[R1/R2]=3.

With the R3,4,5 you have 1/3 division so effectively the the OPA gain relative to the S1 and S2 is 1.
The divider R6 and R7 gives a Vref of 5V* [330/1333]=1.25V, so the -Gain of 2 gives an offset of -2.5Vout, which is cancelled by the +2.5V due to 2.5V of S2, ie= 0 Vout

I use the low output impedance of the Vref OPA in order to to ensure the gains of the 'main' OPA are correct when using those resistor values for the gain.

E.

I see why and how the values for R6/R7 and R2/R1 are working, but why not use R6/R7 500k/500k so the ratio is 1:1 and then have R1/R2 10k/10k so that ratio is also 1:1?
 
I see why and how the values for R6/R7 and R2/R1 are working, but why not use R6/R7 500k/500k so the ratio is 1:1 and then have R1/R2 10k/10k so that ratio is also 1:1?

What would that make the gain relative to the +Vinp of the OPA and the 3 off , 10k's relative to the S1 and S2 sources.???

Remember you want 0V thru +5V for Vout
E

EDIT:
I think where you are going wrong is at the +Vin of the OPA.
When S1 = 0, R3 and R5 are effectively in parallel to 0V, so thats a divider ratio of 5k/15k ie: 0.33, this means the 2.5V due to S2 is only 0.833V at Vsum.
 
Last edited:
What would that make the gain relative to the +Vinp of the OPA and the 3 off , 10k's relative to the S1 and S2 sources.???

Remember you want 0V thru +5V for Vout
E

EDIT:
I think where you are going wrong is at the +Vin of the OPA.
When S1 = 0, R3 and R5 are effectively in parallel to 0V, so thats a divider ratio of 5k/15k ie: 0.33, this means the 2.5V due to S2 is only 0.833V at Vsum.

I'm following everything you said, but I'm having trouble reconciling your circuits with the TI App Note. The app note lists all resistors as equal values and the output has no scalar or gain included in the output voltage equation. Is the app note incorrect or missing something? Or am I missing something?
 
I'm following everything you said, but I'm having trouble reconciling your circuits with the TI App Note. The app note lists all resistors as equal values and the output has no scalar or gain included in the output voltage equation. Is the app note incorrect or missing something? Or am I missing something?

hi,
The TI d/s should not have the 10K to 0V from +Vin for the formula to work.

If you want to omit the 10K this will work.

E.
 
I'm following everything you said, but I'm having trouble reconciling your circuits with the TI App Note. The app note lists all resistors as equal values and the output has no scalar or gain included in the output voltage equation. Is the app note incorrect or missing something? Or am I missing something?

The App Note circuit is fine. By removing one of the inputs in your circuit, you modified the circuit in the App Note. If you had grounded the unused input in the App Note circuit rather than eliminating it, the App Note circuit would work as advertised.

Edit: If you want to remove the unused input in the App Note circuit (leave it open), rather than ground it, you can remove the 10K resistor connected between the junction of the two resistors at the + input of the opamp and ground. If you do that, your modified circuit will work.

Edit: Excepting that your Voffet has non-zero source resistance (by a large factor). That will cause a significant error that will would have to be accounted for, or use a buffer like Egibbs did to reduce the source resistance to near zero.
 
Last edited:
After ccurtis pointed out that I modified the circuit incorrectly, I went ahead and added the extra negative input and connected it to ground. Everything in regards to the amplifier worked as planned. Unfortunately, I can't get the sensor output I expected. Instead of 0-2.5 and 2.5-5, I can only achieve 1.9-2.5 and 2.5-3.1 for inputs but still need 0-5 output. My first thought was to change R7 (resistor from V+in to ground) from 10k to 30k to achieve a gain of 4 on the plus side, but that hasn't worked as expected. With R7=10k and both sensors at 2.5V, V+in=1.66V. With R7=30K, V+in=2.14V. From one of Mr. Gibbs posts, I understand why (simple resistor divider math). With R7=30K and the sensor outputs as listed, the output travels 3.15 to 4.69V. What am I missing? (or perhaps more appropriately, messing up)

I know this might be a heck of an answer to post, in advance, I thank you for your time.
 
I haven't figured out what you are expecting instead of the results you are getting, or what circuit you are now using, but if you apply gain to the two sensors inputs as you mentioned you will also have to apply gain to the - input of the opamp to compensate for it and you did not mention that.

With your new values for the sensor inputs, call them A and B, the math for your output (for 0-5 volts) is:

4.167* [(A-1.9) + (B-1.9) - 0.6]

Thus I see where you get the gain of 4 figure (4.167 to be exact), well enough I think. Combining terms in tht equation, we have for your output:

4.167*A + 4.167*B - 18.333

You can see the large minus factor there required.
 
This is the ciruit I'm using currently:

View attachment 64705

It has your correction putting the second subtractive input but connected to ground (as you mentioned I omitted from the tech note) and Eric's follower as the offset source. I opted to ground the second subtractive input, so I can set the offset directly, and not have to remember to set it to half.

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.

I was hoping that increasing R7 from 10k to 30K would add a gain of 4 (1+30k/10k) to the sensor inputs at V+in. Obviously that doesn't work (or isn't that simple). I tried increasing R4 to 30K and 40K and decreasing the offset voltage as Eric did, but could not effect the change I desired.

What I looking for is:
S1 S2 Output
1.9V 2.5V 0V
2.5V 2.5V 2.5V
2.5V 3.1V 5.0V
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top