4-20mA Current loop

Thread Starter

johndow

Joined Jan 16, 2016
29
Ah sry..

(Vin+ - Vsense)/(Vin - Vsense) = (0.5V - 0.2V) / (1V - 0.2V) =(R2/(R1+R2))=0.583

With R2=10k

=>R1=R2/(R2+0.583)

What do you say?
 

WBahn

Joined Mar 31, 2012
26,077
So you are just going to completely ignore everything I said about Vsense needing to be negative and go ahead and use Vsense = 0.2 V.

Why do you think you get to arbitrarily pick one of the two resistor values? You have two unknowns and two conditions that have to be met.

Have you checked your results with the equation you labored so long to produce?

Your governing equation:

Vin+=Vsense + ( (Vin - Vsense)/(R1+R2) )*R2

With Vin = 1V, R1 = ???, R2 = 10 kΩ what do you get for Vin+? What do you get for Vin+ when Vin = 5V?

I don't know what you plan to use for R1 because R2/(R2+0.583) is guaranteed to be wrong since 0.583 is just a number so it can't be added to R2, which is a resistance. Always track and check the units!

Once again, sloppiness is your undoing.
 

Thread Starter

johndow

Joined Jan 16, 2016
29
So you are just going to completely ignore everything I said about Vsense needing to be negative and go ahead and use Vsense = 0.2 V.
Oh yeah you said it right Once again, sloppiness is my undoing.. I meant:
(Vin+ - Vsense)/(Vin - Vsense) = (0.5V + 0.2V) / (1V + 0.2V)=(R2/(R1+R2))
Why do you think you get to arbitrarily pick one of the two resistor values? You have two unknowns and two conditions that have to be met.
Then I need two equations and can do equation 2 minus equation 1 , right?
 
Last edited:

WBahn

Joined Mar 31, 2012
26,077
You HAVE two equations. One for Vin+ when Vin = 1 V and Vsense = -0.2 V and another for Vin+ when Vin = 5 V and Vsense = -1.0 V.
 

Thread Starter

johndow

Joined Jan 16, 2016
29
Equation 1: 0.5=-0.2+((1+0.2)/(R1+R2))*R2

Equation 2: 0.5=-1+((5+1)/(R1+R2))*R2
then:
Rquation 1= Equation 2

-0.2+((1+0.2)/(R1+R2))*R2=-1+((5+1)/(R1+R2))*R2

is it right until here? Should I solve it for R2/(R1+R2) ?
 

WBahn

Joined Mar 31, 2012
26,077
First, learn to track units. We've already seen how doing so can catch errors.

Equation 1: 0.5 V =-0.2 V +((1 V +0.2 V)/(R1+R2))*R2

Equation 2: 0.5 V =-1 V +((5 V +1 V)/(R1+R2))*R2

Treat it as two equations in two unknowns. Do you know how to solve simultaneous equations? There are several ways to do it. One of the general ways is to write each equation in the form

a·R1 + b·R2 = c

and go from there.

These two equations lend themselves to solving one of them for (R1+R2) and then substituting that into the other equation. That will leave you with an equation that only have R2 in it. Then, once you have a value for R2, you can substitute that into either of the starting equations to get R1.

Don't forget to ask if the answer makes sense by checking it.
 

dannyf

Joined Sep 13, 2015
2,197
Equation 1: 0.5=-0.2+((1+0.2)/(R1+R2))*R2

Equation 2: 0.5=-1+((5+1)/(R1+R2))*R2
Two equations, ***ONE*** variable: R2 / (R1 + R2).

Generally, no solution in situations like this. No amount of math, not matter how fancy it is, can solve that problem.

:)
 

Thread Starter

johndow

Joined Jan 16, 2016
29
These two equations lend themselves to solving one of them for (R1+R2) and then substituting that into the other equation. That will leave you with an equation that only have R2 in it. Then, once you have a value for R2, you can substitute that into either of the starting equations to get R1.
If I convert equation 1:

Equation 1: 0.5 V =-0.2 V +((1 V +0.2 V)/(R1+R2))*R2

R1+R2=(1.2V/0.7V)*R2

then substituting in equations 2:
1.5V=(6V/(12 / 7)*R2)*R2

that looks not good..

Generally, no solution in situations like this. No amount of math, not matter how fancy it is, can solve that problem.

Generally, no solution in situations like this. No amount of math, not matter how fancy it is, can solve that problem
That means my equations are false?:(
 

WBahn

Joined Mar 31, 2012
26,077
dannyf is pointing out what I was hoping you would discover on your own shortly.

The basic problem is that, given a one value of Vsense and the corresponding value of Vin, the voltage divider topology forces a ratio of R1/R2 that you are stuck with. Using the other value of Vsense and its corresponding value of Vin, you need a different ratio of R1/R2. You can't satisfy both at the same time.

So what can you do?

Hint -- if you have a different value of Vin+ that you are shooting for, then the needed value of R1/R2 changes for both conditions, but they don't change in the same way. So the question is whether this is a magic value of Vin+ such that you need the same ratio of R1/R2 to satisfy both conditions. To find out, treat Vin+ as one variable and the ratio R1/R2 as the other.

Let me save you a bit of time, however. The particular values you are trying to use require a Vin+ value of 0V. That's a problem since your opamp is single-supply powered.

But by choosing a different value for Rsense, you can move the voltage around.
 

Thread Starter

johndow

Joined Jan 16, 2016
29
Two equations, ***ONE*** variable: R2 / (R1 + R2).
But this are 2 variables, R1 and R2!?

Generally, no solution in situations like this. No amount of math, not matter how fancy it is, can solve that problem
et me save you a bit of time, however. The particular values you are trying to use require a Vin+ value of 0V. That's a problem since your opamp is single-supply powered.
But by choosing a different value for Rsense, you can move the voltage around.
Dont understand what I have to do, for which variable I have to convert the equation?

And I am not stuck with Vin,1V and Vin 5V. Best of all I want to leave Rsense=50ohm. But I can change Vin,min and Vin,max. But how can I find out the values of Vin, min and Vin, max that it works?

And Vin- =0.5V I can change too if necessery, to a value that it better for our calculating for R1 and R2.
 
Last edited:

WBahn

Joined Mar 31, 2012
26,077
But this are 2 variables, R1 and R2!?
That's actually a bit of illusion. For the problem here, R1 and R2 always appear as the ratio of the two. To see that this is the case, consider

\(
\frac{R_2}{R_1 \: + \: R_2} \; = \; \frac{1}{\frac{R_1}{R_2} \: + \: 1} \; = \; \frac{1}{\alpha \: + \: 1}
\)

and you see that you really only have a single variable to play with.

[/QUOTE]
Dont understand what I have to do, for which variable I have to convert the equation?

And I am not stuck with Vin,1V and Vin 5V. Best of all I want to leave Rsense=50ohm. But I can change Vin,min and Vin,max.
[/QUOTE]

This is the answer to the next question I was going to ask -- what can be changed and what can't. That greatly narrows the parameter space.

But how can I find out the values of Vin, min and Vin, max that it works?

And Vin- =0.5V I can change too if necessery, to a value that it better for our calculating for R1 and R2.
With the constraint you've given, I would say the best way would be to plot Vin_min and Vin_max as a function of Vin-.

I know this is getting more complicated than you had bargained for. So later today or possibly tomorrow I will try to walk you through it.
 

Thread Starter

johndow

Joined Jan 16, 2016
29
I thought it would be complicated. Okay thank you very much, I will wait. I will accent that that R3 and R4 we can change too, to get another Vin-. And as said Vin,min and Vin,max.

Thank you for your time!
 

WBahn

Joined Mar 31, 2012
26,077
Once we know what Vin+ needs to be, then we will know what Vin- needs to be. Then we can find out what the ratio of R3/R4 needs to be.
 

Thread Starter

johndow

Joined Jan 16, 2016
29
Hey, have you found time to look at? dannyf said he have a solution!?

The same equation that governs the kneeing in point of V_signal governs the "gain":

(V_signal - 0.5) / R1 = (0.5 + Iout * R_sense)/R2.

You have two pairs of boundary conditions: Iout = 4ma @ V_signal = 1v; and Iout=20ma @ V_signal = 5v;

Solve for any combinations of R1/R2/R_sense.
can you solve it for 20mA?
 

Thread Starter

johndow

Joined Jan 16, 2016
29
It is simple.

The key is that the opamps inverting and non inverting inputs sit at the same potential (0.5v) once q1 starts to conduct.

R_sense has 4ma going through it. So r2's lower side sits at 0.2v below ground. That means r2 has a voltage drop of 0.5v - (-0.2v) = 0.7v.

That means the current flowing through r2, thus r1, must be 0.7v / 10k = 70ua.

If you want the curve starts to bend at v_signal = 1v, that means the voltage drop over r1 is 1v minus 0.5v = 0.5v.

So r1's resistance must be 0.5v / 70ua = 7k, approximately.

You can confirm that via experiment or simulation, :).
The same equation that governs the kneeing in point of V_signal governs the "gain":

(V_signal - 0.5) / R1 = (0.5 + Iout * R_sense)/R2.

You have two pairs of boundary conditions: Iout = 4ma @ V_signal = 1v; and Iout=20ma @ V_signal = 5v;

Solve for any combinations of R1/R2/R_sense.
Can someone help me to set the equations right? I think with Iout = 4ma @ V_signal = 2.6v and Iout=20ma @ V_signal = 5v; it should work.

I understand the math for bending. but not how to get it to 20mA.
 
Top