Maker Pro
Maker Pro

Op amp calculations for ramps!

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hello,

In attachment below, I have an op amp which takes in 4 vdc and outputs 5vdc. The circuit has been calculated by using the non-inv op amp formula:

vo = [1 + rf/ri] v2
5 = [1 + 15k/10k] x 2

However, if I ramp up the input from 4vdc to 6 vdc, I measure 7.5vdc at the output when the input reaches 6vdc. Which for me.. its a nice ramp. :)

But my question is, in the world of op amps, what if one wants the output to be 5 to 10 vdc when the input ramps from 4 to 6 vdc respectively???

I don't seem to be able to do this intuitively or by any of the formulas I know.

Can someone please help me achieve this and by showing a simple circuit... ?

thanks
24v
 

Attachments

  • op11.jpg
    op11.jpg
    48 KB · Views: 138
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
YOur calculations are not quite correct.
Zhe equation for the non-inverting OpAmp is
Vout = (1+rf/ri) * Vb (note: Vb= voltage at the non-inverting input
Vb = 1/2*V2 (since R1=R2)
Therefore
Vout = (1+rf/ri) * 1/2 * v2 = 1.25 * V2

if I ramp up the input from 4vdc to 6 vdc, I measure 7.5vdc
How's that? If you vary the input voltage, the output voltage should vary, too. According to above calculation from 5V...7.5V.

in the world of op amps, what if one wants the output to be 5 to 10 vdc when the input ramps from 4 to 6 vdc respectively
You need a combination of gain and offset.
Offfset to set the point where an input of 5V gives an output of 1V (i.e. 1V offset voltage).
Gain to control the rise in output voltage when the input is >4V.

Your circuit is already set up for this. Google 'difference amplifier'. It is the same circuit but V1 <> 0V. By setting V1 to a negative voltage, you can create a positive offset at the output. Use the equations for the difference amplifier to calculate the resistors and the required V1.
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hello Harald Kapp,

YOur calculations are not quite correct.
Zhe equation for the non-inverting OpAmp is
Vout = (1+rf/ri) * Vb (note: Vb= voltage at the non-inverting input

aaarh!!! your right Harald Kapp... I am sorry! Its my typo.... yes in this
case it's:

vo = [1 + rf/ri] vb

How's that? If you vary the input voltage, the output voltage should vary, too. According to above calculation from 5V...7.5V.

Yes, If I ramp up the input from 4vdc to 6 vdc, when the input reaches 6 vdc, I measure 7.5vdc! In other words, the output makes a ramp from 5 to 7.5vdc when I ramp the input from 4 to 6vdc.

Your circuit is already set up for this. Google 'difference amplifier'. It is the same circuit but V1 <> 0V. By setting V1 to a negative voltage, you can create a positive offset at the output. Use the equations for the difference amplifier to calculate the resistors and the required V1.

God I'm hopeless... I tried all day doing this, and every time I tried, the voltage wouldn't pass 7.5VDC?? :confused:

Okay, tomorrow, I will try and use the op amp as a difference amplifier and by setting v1 to a negative voltage.... which ... but wait a minute, aaaarrhh, I need another power supply for the negative voltage!!!

I have a dual power supply for the rails, I have another power supply giving the 4VDC for v2 and now I need another power supply for the negative voltage for v1.... its getting expensive to try out stuff with these little op amp buggers!!!! :eek::D

Okay, let me get back to you... I think I have another power supply lying around here and I will put it in series with the power supply for v2 and try to get my negative volts from there.

thanks for your help!
 
Last edited:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
and every time I tried, the voltage wouldn't pass 7.5VDC
Increase gain by increasing Rf.

need another power supply for the negative voltage!!!
No, you don't. You already have -15V. Use a voltage divider (or a potentiometer for adjustability) to create e.g. -1V from -15V by division /15.
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
But my question is, in the world of op amps, what if one wants the output to be 5 to 10 vdc when the input ramps from 4 to 6 vdc respectively???

Make a graph of Vout versus Vin, with Vout on the Y-axis and Vin on the X-axis. Plot the two points (4,5) & (6,10). Note the slope of the line (which is the gain from input to output). Now extend that line to where Vin=0V. Do you get Vout=-5V? That is the offset when the input is zero. So the problem is how to get the offset.

Circuit analysis gives the following equation for the output:

Vout = (R2/(R1+R2))(RF/Ri +1)V2 - (RF/Ri)V1

Note that the design equations should never use the voltage at the op-amp input terminals (Va & Vb). The purpose of the circuit analysis is to eliminate those terms from the equation.

By making V1 a positive voltage instead of GND, the required negative offset can be made available. It is not necessary to add another power supply, just add a potentiometer from +15VDC to GND and adjust for the necessary value of V1, then buffer the voltage with one of the op-amps in the LM324 to connect to Ri. That is a fairly common practice.
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Make a graph of Vout versus Vin, with Vout on the Y-axis and Vin on the X-axis. Plot the two points (4,5) & (6,10). Note the slope of the line (which is the gain from input to output). Now extend that line to where Vin=0V. Do you get Vout=-5V? That is the offset when the input is zero. So the problem is how to get the offset.

Please view attachment. I don't think if I make v1 = 1vdc and rf equal to 50K will produce me the ramp mentioned in previous post? I am lost ... Am I on the right track ?

I see the slope is 2.5.

Sorry to let you down Laplace... but I don't know how to do this....

Can you please show me the calculations....
dicouraged!

24v
 

Attachments

  • op12.jpg
    op12.jpg
    22 KB · Views: 167

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
For a change in input voltage of 2V (6V-4V), you want a change in output voltage of 5V (10V-5V), right? That makes for a gain of g=5V/2V=2.5.
So far your original intent was o.k.

With a gain of 2.5 and an input voltage of 4V, you'd get 10V, however, not the 5V you want. Therefore you have to subtract an offset from the input voltage which will reduce the 10 V to the desired 5V. Therefore:
(4V+Voffset)*2.5=5 or
Voffset=-2V

The full transfer function of the difference amplifier now is:
Vout=(Vin-2V)*2.5

Look up the equations for a difference amplifier here and calculate the required resistor values.
 

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
With a gain of 2.5 and an input voltage of 4V, you'd get 10V,

You meant:
at v2 at 4v and v1 at 0 volts makes a difference of 4 v multiplied by 2.5 is 10 vdc out ... yes!

Therefore you have to subtract an offset from the input voltage which will reduce the 10 V to the desired 5V

So to subtract an offset, we need to raise v1 right?

The full transfer function of the difference amplifier now is:
Vout=(Vin-2V)*2.5

What do we mean when we say the transfer function??

Slowly getting a little clearer!
Thanks
 
Last edited:

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Hello BobK....

Okay now its getting clearer... you did a differential amplifier.

You took the difference of (4-2)*2.5 =5 and (6-4)* 2.5 =10

So first we take the desired slope as Harald Kapp suggested and then we apply it to:
vout = (vin-2)*2.5

Thanks that helped me a lot... I will try to calculate it now with the differential formula.

This would not be possible if we wouldn't of done:

Ri/R1 = Rf/R2

right?

In other words it would still work
if Ri = 10k and R1 = 2k and rf = 25k and R2 = 5k .... we would get the same result right?


Thanks
 
Last edited:

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
As long as the ratios are the same and the inputs are driven a low impedance source, compared to the input resistor, the results would be the same.


Bob
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
I don't think if I make v1 = 1vdc and rf equal to 50K will produce me the ramp mentioned in previous post? I am lost ... Am I on the right track ?

This is an algebra problem with two equations and five variables, so there is no single solution. See attached pdf for a method to produce a graph that will help find a solution.

The graph below shows a plot of (R1/R2) vs (RF/Ri) along with a plot of (V1) vs (RF/Ri). The dotted lines show three possible solutions.

The dashed green shows BobK's solution with (RF/Ri)=2.5, (R1/R2)=0.4, V1=2, RF=25K, Ri=10K, R1=10K, R2=25K.

The dashed orange shows a solution with (RF/Ri)=4, (R1/R2)=1, V1=1.25, RF=40K, Ri=10K, R1=10K, R2=10K.

The dashed blue shows a solution with (RF/Ri)=5, (R1/R2)=1.4, V1=1, RF=50K, Ri=10K, R1=14K, R2=10K. (R1/R2=1.4 could be approximated with 5% resistors as R1=130K & R2=91K)

attachment.php
 

Attachments

  • Diff-Amp-Gain.pdf
    84.4 KB · Views: 101
  • Diff-Amp-Gain-3.png
    Diff-Amp-Gain-3.png
    66.3 KB · Views: 174

24Volts

Mar 21, 2010
164
Joined
Mar 21, 2010
Messages
164
Thanks Laplace,

Yes I figured it out as for my requirements to work out, I need a differential op amp configuration with gain plus offset.

I am working on this ...

Thanks for your help, If I have other question I will come back!

Thanks
24v
 

Similar threads

Top