SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By 8Volts
#164957
Hello,

Please forgive me... :( still having problems!
My problem is in reference to a solution provided by a very helpful gentleman known as "Mee_n_Mac".

Mee_n_Mac, if you are there, I got to say that I need your help! I am sure you remember the previous few post where we discussed about op amp ramps and that you have gracefully provided your help along with other fellows. Well, okay, I now changed the values to actually do the circuit I need for a project, and I don't get why it doesn't seem to work. I have followed your instructions of calculating the vo/vin gain, followed by plugging that gain in as K1 (In this case) in the following formula:

Vout=K2V2-K1V1

And then solving for K2... and then the rest to solve for the resistors. I am really upset at myself.... I tried several attempts and when I check the values they never work out for both Vouts. :x :x :x

The circuit is an inverting op amp with 2.5 to 2.0 volts ramp at V1 and a steady 5Vdc at V2. Vout should be 0.531Vdc to 1.45Vdc. Therefore, when V1 is 2.5Vdc, the output should be 0.531Vdc. And when V1 goes to 2.0Vdc, the output should be 1.45Vdc.
Please view attachment!

I try and I try and I try just to never be able to prove my findings ... very frustrated... Your help is very appreciated!
Thank you!
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
#164959
Again you've made a simple sign error. K1 is a positive number hence the k2V2 - k1V1.
You've properly computed the gain, G1 = -k1, k1 being the ratio of the 2 resistors.
I tell you what, from now on (since you've got the underlying theory down) use that understand to know the output is always the sum of the voltages (be they + or -) times their respective gains (be they + or -) for that circuit path. So use, as a general formula,
Vout = G2V2 + G1V1
Compute the gain as you did and try again. Solve for 1 set on input voltages, check using the other set.
By 8Volts
#164990
Hi Mee_n_Mac,

After much calculations and reading over your post several times I was able to compute the problem correctly
Let me run the steps by you one at a time:

STEP#1
K1 is a positive number, so:
K1 = (1.45-0.531)/(2.0 - 2.5) = +1.838 <<<<< "K1 is a positive number hence..."

STEP#2
Again you've made a simple sign error. K1 is a positive number hence the k2V2 - k1V1.
Let's use the formula to solve for K2:
Vo = K2V2- K1V1 <<< Using the equation with a "-" (The difference of ...)
Vo = K2V2- (+K1)(V1)
1.45 = K2(5)-(+1.838)(2) <<<<< "... hence the k2V2 - k1V1"
1.45 = K2(5)-(+3.676)
1.45= K2(5)-3.676
1.45+3.676 = K2(5)
5.126=K2(5)
5.126/5 = K2
K2=1.0252

STEP#3
always the sum of the voltages (be they + or -) times their respective gains (be they + or -)
for that circuit path. So use, as a general formula, Vout = G2V2 + G1V1
So let's check K1 and K2 when V1 is 2.0V
Vo = K2V2 + K1V1
Vo = (1.0252)(5) + (-1.838)(2)
Vo = 5.126 - 3.676
Vo = 1.45 <<<< Correct !

STEP#4
Let's check K1 and K2 when V1 is 2.5V
Vo = K2V2 + K1V1
Vo = (1.0252)(5) + (-1.838)(2.5)
Vo = 5.126 - 4.595
Vo = 0.531 <<<< Correct !


******** QUESTION *********
1) Mee_n_Mac, can we just always use the same formula throughout all the calculations which is:

Vo = K2V2 + K1V1

instead of using:

Vo = K2V2 - K1V1

As I have noticed the result will always come to the same!! I find it confusing using this formula at times with a "-" and at other times with a "+". Why not leave K1 as the calculated values of: -1.838 and always use the formula with a "+"... Let me show you what I mean as the result is exactly the same:

STEP#1
K1 = (1.45-0.531)/(2.0 - 2.5) = -1.838 <<< Let K1 stay the way it was calculated ... as a negative

STEP#2
Let's use the formula to solve for K2:
Vo=K2V2 + K1V1 <<< We always use the equation with a "+" (The sum of...)
1.45 = K2(5) + (-1.838)(2)
1.45 = K2(5) - 3.676
1.45+3.676 = K2(5)
5.126 = K2(5)
5.126/5 = K2
K2=1.0252

STEP#3
Let's check K1 and K2 when V1 is 2.0V
Vo = K2V2 + K1V1 <<< We always use the equation with a "+" (The sum of...)
Vo = (1.0252)(5) + (-1.838)(2)
Vo = 5.126 - 3.676
Vo = 1.45 <<<< Correct !

STEP#4
So let's check K1 and K2 when V1 is 2.5V
Vo = K2V2 + K1V1 <<< We always use the equation with a "+" (The sum of...)
Vo = (1.0252)(5) + (-1.838)(2.5)
Vo = 5.126 - 4.595
Vo = 0.531 <<<< Correct !


In anycase, I thank you for your generous help!
8v
By Mee_n_Mac
#164991
8Volts wrote: ******** QUESTION *********
1) Mee_n_Mac, can we just always use the same formula throughout all the calculations which is:

Vo = K2V2 + K1V1

instead of using:

Vo = K2V2 - K1V1
I think you'll find it easier to remember
Vo = G2V2 + G1V1
where G stands for the gain for that circuit path. Later on you may learn about circuit theory and the principle of superposition applied to linear circuits. In fact you're using it now, just w/o the fancy name. You'll want to think gain and not resistor ratios. And you can always use that, just remember some gains are negative.
By 8Volts
#164998
And you can always use that, just remember some gains are negative.
I think I am starting to see this as a convention when calculating... I just have to be careful as to weather I decide to subtract or add and assign the opposite to the K1 gain....

Anyways, thanks for your help... the more I do these the more I am catching on...

Thanks again!
You do not have the required permissions to view the files attached to this post.
By 8Volts
#165165
Hi Mee_n_Mac,

I seem to be doing it to myself here!!!! :x :x :x

After all the theory I reviewed and equations I calculated, boffff.... and now this.... please view attachment!

I don't get it.... By calculations, if the DC gain of V1 is 0, then how could this be??? Also, if I make G2 gain as 1.0 (as calculated in attachment), then how can (1+G1) = to 1.0 ???? (G1 can never be zero) right?

I'm really confused.... Can we define something here.... is this correct:

G1 = rf/ra
G2 = (1+ (rf/ra))
Gn = (r2/(r1+r2))
G' = (Gn)(G2) which is: G' = (Gn)(1+ (rf/ra))

So with the above definitions, we should be able to solve for the circuit right? I tried and I tried and couldn't do it... the heck is wrong with me...... :cry: :cry: :cry: :cry:

help!
You do not have the required permissions to view the files attached to this post.
By Mee_n_Mac
#165170
G1 = -Rf/Ra
G2 = (r2/(r1+r2))*(1+ (rf/ra)) = deltaVout/deltaV2 = (4 - 2)/(6 - 4) = 1
Vout = G1V1 + G2V2
V1 = 0

Take it from here.
By 8Volts
#165188
Hi Mee_n_Mac:
G1 = -Rf/Ra
G2 = (r2/(r1+r2))*(1+ (rf/ra)) = deltaVout/deltaV2 = (4 - 2)/(6 - 4) = 1
Vout = G1V1 + G2V2
V1 = 0
Okay, so what's this called then:

(1+ (rf/ra))

In anycase, based on what you have shown, I do:
Vout = G1V1 + G2V2
2=G1(0) + 1(4)
2-4=G1(0)
-2=G1(0)
G1 = 0 <<<< how could this be :(


so going on.... if:
G2=(r2/(r1+r2))*(1+ (rf/ra))
and assuming I select ra and rf as 10K:
1 = (r2/(r1+r2)) * (2)
(r2/(r1+r2)) = 0.5 no?

:cry: :cry: :oops:

PS sorry Mee_n_Mac, I seem to have the same difficulty understanding
ramps as when I first started ramps with v1 and v2 being not equal to 0.
And now that I tried ramps when setting v1 or v2 to 0 as shown in last
example things got me confused. I really appreciate your support.

thanks
By Mee_n_Mac
#165201
You've got a minor math problem and a major circuit problem.

You had ;
Vout = G1V1 + G2V2
2=G1(0) + 1(4)
2-4=G1(0)
-2=G1(0)
G1 = 0 ???

But the last line should really be ;
-2 = 0 ???

Since that can't be true, and after rechecking the math, the conclusion should be that you can't make that function with this circuit as it's configured. Look at it this way, you know for a 1v change at the non-inverting path input you must get a 1v change in the output. That's obvious from looking at the "ramps". Yet there's a constant 2v difference btw the output and that input. Since you've grounded the other input path, there's no way for this circuit to do what you've asked. Not every function of inputs and outputs can be done using this particular op-amp configuration.
By 8Volts
#165207
Okay Mee_n_Mac, I see.
Since that can't be true, and after rechecking the math, the conclusion should be that you can't make that function with this circuit as it's configured. Look at it this way, you know for a 1v change at the non-inverting path input you must get a 1v change in the output. That's obvious from looking at the "ramps". Yet there's a constant 2v difference btw the output and that input. Since you've grounded the other input path, there's no way for this circuit to do what you've asked. Not every function of inputs and outputs can be done using this particular op-amp configuration.
Bof.... It's funny though how boggling to me this stuff is..... because, if we do an input ramp of 4-6Vdc but with an output of 2-3Vdc, this is very well achievable by assigning, r1 to 7500, r2 to 2500, ra to 10K and rf to 10K :think:

Just that we change the output spec to 2-4Vdc, this problem becomes impossible to do. :? :?

One last thing.... if I may! For my personal knowledge and definitions, if:
G1 = -Rf/Ra
G2 = (r2/(r1+r2))*(1+ (rf/ra)) = deltaVout/deltaV2 = (4 - 2)/(6 - 4) = 1
Then what can I call the following:

(1+ (rf/ra))

I can't call it G1, I can't call it G2, so what do we call it. In other forums, fellows told me that it is G1 ???
But that can't be... as G1 = -Rf/Ra !!! Some other fellows told me that G2 = (1+ (rf/ra)), but others as yourself say that G2 is:

G2 = (r2/(r1+r2))*(1+ (rf/ra)) ???? I feel really messed up with this :|

Thanks for your help! :)