# 4-20mA Current loop

#### johndow

Joined Jan 16, 2016
29
I have this 4-20mA circuit. It works from 2.5V to 5V V_signal. R3 and R4 is a voltage divider sets the voltage at opamp to 0.5V because lt317_out is 5V. With R5 I set the initial current of 4mA. At v_signal 0V I get 4mA.

But how to calculate R1 and R2 to change v_signal maybe from 1V to 5V? How does it work?

#### Attachments

• 41.9 KB Views: 77

#### WBahn

Joined Mar 31, 2012
30,254
What is the voltage at the bottom of R_sense when 4 mA is flowing through it? When 20 mA is flowing through it?

What is the relationship between R1 and R2 that will put 0.5 V at In+ when Vin = 1 V and R_sense has 4 mA flowing in it?

What is the relationship between R1 and R2 that will put 0.5 V at In+ when Vin = 5 V and R_sense has 20 mA flowing in it?

What are the values of R1 and R2 that will satisfy both of these relationships at the same time?

#### dannyf

Joined Sep 13, 2015
2,197
With R5 I set the initial current of 4mA. At v_signal 0V I get 4mA.
That 4ma comes from the fact that current has to go from the 3-terminal regulator to R1/R2/Rsense back to the 30v source. At V_in < 2.5v, the opamp outputs a low and the npn is turned off.

But how to calculate R1 and R2 to change v_signal maybe from 1V to 5V? How does it work?
That's simple, once you know how the circuit works. The output current will crease a negative (to ground) voltage on R2's lower end (=Iout * R_sense). That voltage will be summed with V_signal to equate precisely to 0.5v (determined by R3/R4).

The question becomes: how to pick V_in / R1/R2 combination so that the opamp's non-inverting input is always at 0.5v? It is fairly easy.

Conceptually, the circuit is inverting the opamp's inputs: a positive variation on the non-inverting input actually serves as a negative feedback to correct itself.

Last edited:

#### johndow

Joined Jan 16, 2016
29
What is the voltage at the bottom of R_sense when 4 mA is flowing through it? When 20 mA is flowing through it?
its 0.2V at the bottom and 1V at 20mA flowing through it.
What is the relationship between R1 and R2 that will put 0.5 V at In+ when Vin = 1 V and R_sense has 4 mA flowing in it?
Dont know how to calculate it. I think that In+ is =Ur2=In- (+U_sense)=> 0.5V-0.2V ?

What is the relationship between R1 and R2 that will put 0.5 V at In+ when Vin = 5 V and R_sense has 20 mA flowing in it?
What are the values of R1 and R2 that will satisfy both of these relationships at the same time?[/QUOTE]
Hmm.. I dont realy know how to do this.
I have delta 4V and delta 16mA.

That 4ma comes from the fact that current has to go from the 3-terminal regulator to R1/R2/Rsense back to the 30v source. At V_in < 2.5v, the opamp outputs a low and the npn is turned off.

That's simple, once you know how the circuit works. The output current will crease a negative (to ground) voltage on R2's lower end (=Iout * R_sense). That voltage will be summed with V_signal to equate precisely to 0.5v (determined by R3/R4).

The question becomes: how to pick V_in / R1/R2 combination so that the opamp's non-inverting input is always at 0.5v? It is fairly easy.
.
Thats the question, I dont know have tried all I can, but nothing seems right.

Last edited:

#### dannyf

Joined Sep 13, 2015
2,197
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, .

#### johndow

Joined Jan 16, 2016
29
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.
the minus 0.5 is from in- ?
So r1's resistance must be 0.5v / 70ua = 7k, approximately.

You can confirm that via experiment or simulation, .
Thanks it works!

But the upper limit have to be 20ma for example at 5V, how can I adjust the upper limit?

Last edited:

#### WBahn

Joined Mar 31, 2012
30,254
its 0.2V at the bottom and 1V at 20mA flowing through it.
So if the bottom of the resistor is 0.2V and the top of the resistor is 0V, what direction is the current flowing in the resistor? Is that possible, given that the bottom end of the resistor is connected to the negative terminal of the 30 V source and that it is the only power source in the circuit?

Let's get this correct before we even attempt to go further.

#### johndow

Joined Jan 16, 2016
29
Yes V1 is the only one power source. V_in is the signal i can scale it how i want maybe 1V at the bottom and 4V at the top or 0.2V bottom and 1.2V top and so on. R1, R2, R3 and R4 is normaly not given, I have to decide which values I have to pick. That it work properly with 4mA at V_in bottom (for example 0.9V) and 20mA with V_in top (for erxample 4.5V)

#### johndow

Joined Jan 16, 2016
29
Here I have the equations maybe that helps. 5v is the voltage from the regulator from lt317. And V_signal is V_in and R_mess is R_senese.

#### Attachments

• 53 KB Views: 21

#### WBahn

Joined Mar 31, 2012
30,254
What is Umess?

Your equation #13 is wrong because you are trying to jump ahead instead of getting the first step correct.

Define Vsense as the voltage, with respect to the 0V reference (i.e., "ground") of the junction between Rsense and R2.

What is Vsense when Isense (the current flowing downward through Rsense) is 4 mA and when it is 20 mA? It is NOT 0.2 V and 1.0 V.

#### johndow

Joined Jan 16, 2016
29
Umess is the Voltage across R_mess (R_sense in our circuit).

What is Vsense when Isense (the current flowing downward through Rsense) is 4 mA and when it is 20 mA? It is NOT 0.2 V and 1.0 V.
Then I dont know. Can you explain it to me how to calculate? I have tried everything. Post Number #5 from dannyf was helpfull but the upper limit 20ma miss.

#### WBahn

Joined Mar 31, 2012
30,254
Whenever you specify a voltage or a current, you MUST indicate it's polarity. Just saying that Umess is the voltage across R_mess isn't enough. It is the voltage of the top with respect to the bottom, or the bottom with respect to the top? The sign of a quantity is the THE most significant part of it. If you don't think so, then try jump starting one car with another without paying attention to polarity.

Because V1 is the only power source in the circuit, current has to be flowing INTO the negative terminal, right? Otherwise it would be receiving power from the circuit and not delivering power to the circuit.

That means that current is flowing out of the bottom of R_sense and over into the negative terminal of V1, right?

So if current is flowing downward through R_sense, which end of R_sense is at the higher voltage, the top of the bottom?

#### johndow

Joined Jan 16, 2016
29
Whenever you specify a voltage or a current, you MUST indicate it's polarity. Just saying that Umess is the voltage across R_mess isn't enough. It is the voltage of the top with respect to the bottom, or the bottom with respect to the top? The sign of a quantity is the THE most significant part of it. If you don't think so, then try jump starting one car with another without paying attention to polarity.
Ah, I see.
Because V1 is the only power source in the circuit, current has to be flowing INTO the negative terminal, right? Otherwise it would be receiving power from the circuit and not delivering power to the circuit.
Yes, right!
That means that current is flowing out of the bottom of R_sense and over into the negative terminal of V1, right?
Right!
So if current is flowing downward through R_sense, which end of R_sense is at the higher voltage, the top of the bottom?
The top of R_sense ist at higher voltage..

But what do you want say me? I want to know how to calculate the resistors.

#### WBahn

Joined Mar 31, 2012
30,254
How can you calculate the resistors until you know what the voltages are on each end of the R1,R2 resistor chain? THAT'S the point I am trying to get you to.

Let's tackle it from the other direction.

If Vin is the voltage at the top of R1 and Vsense is the voltage at the bottom of R2, what is the value of Vin+?

#### johndow

Joined Jan 16, 2016
29
If Vin is the voltage at the top of R1 and Vsense is the voltage at the bottom of R2, what is the value of Vin+?
I would say

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

#### WBahn

Joined Mar 31, 2012
30,254
What is the polarity of VR2? ANY TIME you refer to a voltage or a current, the polarity of that voltage or current MUST be unambiguous.

You also need to be careful about order of operations. (R2/R1+R2) is the same as (R2/R1) + R2 and (R1+R2/R1+R2) is the same as R1 + (R2/R1) + R2.

If what you meant was Vin+ = (Vin+Vsense)*(R2/(R1+R2))-Vsense*((R1+R2)/(R1+R2)), then express that.

Now ask if this result makes sense.

If R1 = 0, what will Vin+ be? According to your equation it would be (Vin + Vsense) - Vsense. That looks good.

If R2 = 0 what will Vin+ be? According to your equation it would be -Vsense. Does that make sense?

#### johndow

Joined Jan 16, 2016
29

#### WBahn

Joined Mar 31, 2012
30,254
Okay, so you know that something is wrong and don't have to waste any time pursuing something that is guaranteed to yield a wrong answer. Get in the habit of tracking your units and asking if the results make sense -- including intermediate results along the way.

Take a step back to basics. The voltage at Vin+ is going to be the voltage at the bottom of R2 (namely Vsense) plus the voltage drop across R2 (from top to bottom). The voltage drop across R2 is the current going downward through R2 times the resistance of R2. The current going through R2 is the current through the R1+R2 chain which is the voltage across the R1+R2 chain divided by the resistance of R1+R2. Now just put all of that together.

#### dannyf

Joined Sep 13, 2015
2,197
But the upper limit have to be 20ma for example at 5V, how can I adjust the upper limit?
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.

#### johndow

Joined Jan 16, 2016
29
The voltage at Vin+ is going to be the voltage at the bottom of R2 (namely Vsense) plus the voltage drop across R2 (from top to bottom).
=> Vin+=(V_in+Vsense)*(R2/(R1+R2))
The current going through R2 is the current through the R1+R2 chain which is the voltage across the R1+R2 chain divided by the resistance of R1+R2. Now just put all of that together.
I acros R2=V_in/(R1+R2)
The voltage drop across R2 is the current going downward through R2 times the resistance of R2.
VR2=(V_in/(R1+R2))*R2
Right? But how I can now get the values of R1 and R2 at a specific V_in, to geht 4ma and 20ma?

Solve for any combinations of R1/R2/R_sense.
R2/(R1+Rsense)=(0.5+Iout)/(V_signal-0.5)

with V_signal=1V and I_out=4mA I get 1,008 for R2/(R1+Rsense) and for V_signal=5V and I_out=20mA I get 0.115.. hm?

Last edited: