Maker Pro
Maker Pro

4-20mA to voltage conversion...

R

Rodo

Jan 1, 1970
0
Hi all...

I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

I can not load the 4-20mA line with any more resistance or divert any
current to GND. I tried an optoisolator but the 4mA is enough to turn on the
LED so I get very little voltage swing at the output (phototransistor).

I thought of an op-amp but I can't think (or find) the right configuration.
Any suggestions ?

Thanks
 
A

Andreas

Jan 1, 1970
0
Hi,

try an opamp, for example the LM358, to convert the current into a
representing voltage:

Uout = -Iin * R1

R1

+---||||-------+
| |
Iin | +-------+ |
-->-----+--| - | |
| Out |---+------ Uout
+-| + |
| +-------+
|
-+-
GND
 
F

Fritz Schlunder

Jan 1, 1970
0
Rodo said:
Hi all...

I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

I can not load the 4-20mA line with any more resistance or divert any
current to GND. I tried an optoisolator but the 4mA is enough to turn on the
LED so I get very little voltage swing at the output (phototransistor).

I thought of an op-amp but I can't think (or find) the right configuration.
Any suggestions ?

Thanks


The optoisolator solution should work if you wire it up properly and use the
correct output load resistance. 4mA is plenty to turn on the LED. Keep in
mind that the output phototransistor current is the LED current times the
CTR (current transfer ratio) of the device provided that the output
transistor is not operating in the saturated region. So make sure to size
your output pull up/down resistor properly to produce your desired voltage
range properly.

If I understand your problem statement correctly an op-amp solution could
also probably be used. Take a look at National's LM358 datasheet:

http://cache.national.com/ds/LM/LM158.pdf

And study the little circuit labeled "Ground Referencing a Differential
Input Signal" on page 16.
 
T

Tilmann Reh

Jan 1, 1970
0
Rodo said:
I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

I can not load the 4-20mA line with any more resistance or divert any
current to GND. I tried an optoisolator but the 4mA is enough to turn on the
LED so I get very little voltage swing at the output (phototransistor).

I thought of an op-amp but I can't think (or find) the right configuration.
Any suggestions ?

First, give some more detailed information about your signal
source and your available supplies. *Why* is the signal
a _negative_ current referenced to +32V? Isn't it possible to
connect it any other way? Where does that signal come from?

The two other mentioned approaches probably won't work, BTW.
Forget any (standard) optoisolator, unless you really enjoy
great nonlinearity, massive temperature dependence and aging,
and tolerance problems.
 
R

Roger Gt

Jan 1, 1970
0
: Hi all...
:
: I'm trying to convert a 4-20mA current to a voltage I can use
with an MCU. I
: thought a simple 250 ohms resistor could do the job but it
didn't .... the
: voltage across the resistor is fine (5v). The problem is with
respect to the
: common GND of the rest of the circuit, the resistor terminals
are at 32v and
: 27v.
:
: I can not load the 4-20mA line with any more resistance or
divert any
: current to GND. I tried an optoisolator but the 4mA is enough to
turn on the
: LED so I get very little voltage swing at the output
(phototransistor).
:
: I thought of an op-amp but I can't think (or find) the right
configuration.
: Any suggestions ?
: Thanks

Shunt the LED with a 220 ohm 1/4 Watt resistor.
The drop at 4mA is less than a volt, (About 0.9V)
Which will not light the LED,
at 20mA the drop across the resistor will climb to 4.4 volts
without the LED, but with the LED, current will mostly flow
through the LED and turn on the Isolator.

The 220 ohm resistor will consume (about 8mA) so the net current
to turn on the LED will be (about) 12 mA

Works for me!
 
R

Roger Gt

Jan 1, 1970
0
: Rodo schrieb:
:
: > I'm trying to convert a 4-20mA current to a voltage I can use
with an MCU. I
: > thought a simple 250 ohms resistor could do the job but it
didn't .... the
: > voltage across the resistor is fine (5v). The problem is with
respect to the
: > common GND of the rest of the circuit, the resistor terminals
are at 32v and
: > 27v.
: >
: > I can not load the 4-20mA line with any more resistance or
divert any
: > current to GND. I tried an optoisolator but the 4mA is enough
to turn on the
: > LED so I get very little voltage swing at the output
(phototransistor).
: >
: > I thought of an op-amp but I can't think (or find) the right
configuration.
: > Any suggestions ?
:
: First, give some more detailed information about your signal
: source and your available supplies. *Why* is the signal
: a _negative_ current referenced to +32V? Isn't it possible to
: connect it any other way? Where does that signal come from?
:
: The two other mentioned approaches probably won't work, BTW.
: Forget any (standard) optoisolator, unless you really enjoy
: great nonlinearity, massive temperature dependence and aging,
: and tolerance problems.

: --
: Dipl.-Ing. Tilmann Reh
: Autometer GmbH Siegen - Elektronik nach Maß.
: http://www.autometer.de


So use it as a switch, which avoids most problems of the sort
described.
Select the part for the temperature range you need to operate over
and for an input maximum current of about 20mA The pull up on the
transistor can be selected for the transfer ratio of the device.
 
T

Tilmann Reh

Jan 1, 1970
0
Roger said:
: The two other mentioned approaches probably won't work, BTW.
: Forget any (standard) optoisolator, unless you really enjoy
: great nonlinearity, massive temperature dependence and aging,
: and tolerance problems.
So use it as a switch, which avoids most problems of the sort
described.
Select the part for the temperature range you need to operate over
and for an input maximum current of about 20mA The pull up on the
transistor can be selected for the transfer ratio of the device.

Seems like you don't know that 4-20 mA is an *analog* interface.
Don't confuse it with 20 mA current loop (TTY).
 
T

Tilmann Reh

Jan 1, 1970
0
Roger said:
Shunt the LED with a 220 ohm 1/4 Watt resistor.
The drop at 4mA is less than a volt, (About 0.9V)
Which will not light the LED,
at 20mA the drop across the resistor will climb to 4.4 volts
without the LED, but with the LED, current will mostly flow
through the LED and turn on the Isolator.

The 220 ohm resistor will consume (about 8mA) so the net current
to turn on the LED will be (about) 12 mA

Works for me!

No, you are talking about a digital interface (TTY), while the
OP is talking about an *analog* signal.
 
B

Bill Sloman

Jan 1, 1970
0
Rodo said:
Hi all...

I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

I can not load the 4-20mA line with any more resistance or divert any
current to GND. I tried an optoisolator but the 4mA is enough to turn on the
LED so I get very little voltage swing at the output (phototransistor).

I thought of an op-amp but I can't think (or find) the right configuration.
Any suggestions ?

A differencing or subtracting amplifier, or an instrumentation amplifier.
Analog Devices and Linear Technology sell high-class parts. National
Semiconductor will have an application note that tells you how to do the job
more cheaply.

Horowitz and Hill's "The Art of Electronics" covers this in their chapter on
precision circuits and low noise techniques. Any decent book on using op
amps will have a similar section.
 
S

Syd Rumpo

Jan 1, 1970
0
Rodo said:
Hi all...

I'm trying to convert a 4-20mA current to a voltage I can use with an MCU.

[Snip]

There are many modules available at a price which will give you an
isolated voltage output from a 4-20mA input. Farnell 767-281 will give
0-10V for 4-20mA for example - there are several more for around GBP100.
Signal isolators/signal conditioners/signal converters with the word
'process' thrown in somewhere.

A DIY solution could be a coil for the current and a linear Hall-effect
sensor for the isolated output with appropriate gain and offset. Maybe
use a second Hall sensor in the coil at right angles to compensate for
temperature drift. Or something.
 
W

Wouter van Ooijen

Jan 1, 1970
0
I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

- analog: make a current mirror, so you can attach a grounded resistor
to the mirror

- digital: put a microcontroller (a PIC12F675 or a similar AVRtiny
would do) at the high end, sharing the positive rail. Let the
microcontroller output a digital signal, which can be coupled for
instance using an optocoupler.


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
PICmicro chips, programmers, consulting
 
S

Spehro Pefhany

Jan 1, 1970
0
Hi all...

I'm trying to convert a 4-20mA current to a voltage I can use with an MCU. I
thought a simple 250 ohms resistor could do the job but it didn't .... the
voltage across the resistor is fine (5v). The problem is with respect to the
common GND of the rest of the circuit, the resistor terminals are at 32v and
27v.

I can not load the 4-20mA line with any more resistance or divert any
current to GND. I tried an optoisolator but the 4mA is enough to turn on the
LED so I get very little voltage swing at the output (phototransistor).

I thought of an op-amp but I can't think (or find) the right configuration.
Any suggestions ?

Thanks


If you feel up to it, buy or design an ADC (or VFC or PWM) circuit
that will operate on a mA or two. You must derive the power from the
4~20mA signal (need an efficient power supply, no 78L05s) and measure
it both. You can use another microcontroller if it makes things easier
for you. Then pass the signal over an isolated (optical will work, but
there are other options) interface (there goes another mA or two) to
your main MCU, in the digital domain.

You can just buy an industrial module that does essentially this, but
where's the fun in that, eh?

Best regards,
Spehro Pefhany
 
M

mikem

Jan 1, 1970
0
Based on the OP and the responses, it looks like folks are
confused about the Common Mode requirement.

If the 4-20ma flows in a "loop", then the receiver cannot
"divert" any current into/out-of the loop, so none of the
single-ended current-to-voltage OpAmp circuits are suitable.

The opto-isolator satisfys the current balance requirement. The
opto-isolator has low capacitive coupling, and will withstand
a Common Mode voltage rating of +-1500V, preventing the need
to explicitly tie the "ground" of the receiver to the "ground"
of the current-loop transmitter. This also precludes any Common
noise or DC offsets between the two grounds from being mixed
with the output of the receiver, thereby contaminating it.
The opto provides a CommonModeRejection CMR of +-1500V.
Its biggest problem is that it is not a stable, linear
device.

If you know that both "grounds" are implicitly tied to
the same water-pipe earth ground, or if you can provide
a third-wire (like the shield on the current loop wires)
as a tie between the transmitter and receiver grounds,
then you can get by with a more resonable CMR requirement
at the reciever.

A standard integrated circuit differential amplifier, like
a INA114, running on +15 and -15V supplies, provides a
CMR at its inputs of something like +-12V, which may be
sufficient.

If you break the current loop and insert a 1 Ohm resistor,
the drop across the resistor ranges from 4mV to 20mV.
Use the INA114 with its gain set to 250 to amplify the "drop"
across the 1 Ohm resistor.

Note that the INA114's output will be between 1 and 5V,
which is within the range of the PIC's A/D input.
Also notice that the diffamp subtracts any noise or
dc offsets which exist between the current loop wires and
the shield.

You can also build your own diff amp out of a single OpAmp
and some matched (better than 0.01%) resistors.

MikeM
Years of fighting CommonMode noise problems.
 
M

mikem

Jan 1, 1970
0
Here is a simple Diff amp which will pick off
the drop across a 10 Ohm resistor even if there
is +-12V of common-mode noise between the sender
and receiver grounds...

Cut and paste everthing below the ____________
into a text file named "LoopAmp.asc".

Download and install LTspice/SwitcherCAD III from

http://www.linear.com/software/

File/Open LoopAmp.asc (from where ever you saved it)

Click on the LittleRunningMan

Select V(Out) for plotting, look at it, then add V(minus) and
V(plus) to the plot.

This will show that with good matching of R1/R2 and
R3/R4, you can get a resonable CMRR with even a
single OpAmp.

Try unbalancing the R1/R2 or R3/R4 ratios, and see what
effect it has on the CMRR

MikeM

________________________________________________________

Version 4
SHEET 1 880 680
WIRE 224 208 224 96
WIRE 224 96 320 96
WIRE 320 96 320 112
WIRE 208 128 272 128
WIRE 272 128 272 240
WIRE 272 240 256 240
WIRE 192 224 112 224
WIRE 192 256 112 256
WIRE 112 256 112 304
WIRE 112 304 96 304
WIRE 224 304 224 272
WIRE 224 384 224 432
WIRE 224 432 112 432
WIRE 224 432 320 432
WIRE 320 432 320 192
WIRE 272 240 352 240
WIRE 96 192 112 192
WIRE 112 336 112 304
WIRE 112 192 112 128
WIRE 112 128 128 128
WIRE 112 224 112 192
WIRE 112 432 112 416
WIRE 16 192 -16 192
WIRE 16 304 -16 304
WIRE -16 288 -16 304
WIRE -16 304 -80 304
WIRE -16 208 -16 192
WIRE -16 192 -80 192
WIRE -656 208 -656 192
WIRE -656 288 -656 304
WIRE -656 336 -656 304
WIRE -656 416 -656 432
WIRE 224 464 224 432
WIRE -80 304 -656 304
WIRE -80 192 -656 192
WIRE -256 432 -656 432
WIRE -176 432 112 432
FLAG 352 240 Out
IOPIN 352 240 Out
FLAG 224 464 0
FLAG -80 304 plus
FLAG -80 192 minus
SYMBOL Opamps\\1pole 224 240 R0
SYMATTR InstName U1
SYMBOL Misc\\battery 320 96 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 15
SYMBOL Misc\\battery 224 400 M180
WINDOW 0 24 104 Left 0
WINDOW 3 24 16 Left 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 15
SYMBOL res 0 208 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 10k
SYMBOL res 112 288 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL res 224 112 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R3
SYMATTR Value 250.0K
SYMBOL res 96 320 R0
SYMATTR InstName R4
SYMATTR Value 250k
SYMBOL res 0 304 R180
WINDOW 0 36 76 Left 0
WINDOW 3 36 40 Left 0
SYMATTR InstName R5
SYMATTR Value 10
SYMBOL current -656 208 R0
WINDOW 3 37 43 Left 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value PULSE(4m 20m 0.25 0.25 0.25 0.25)
SYMATTR InstName I1
SYMBOL voltage -656 320 R0
WINDOW 3 40 60 Left 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value SINE(0 12 50)
SYMATTR InstName V3
SYMBOL res -160 416 R90
WINDOW 0 0 56 VBottom 0
WINDOW 3 32 56 VTop 0
SYMATTR InstName R6
SYMATTR Value 1k
TEXT -328 136 Left 0 !.tran 1
TEXT -360 96 Left 0 !.OPTION itl1=2000
TEXT -872 240 Left 0 ;Signal Current, \n4-20mA
TEXT -768 360 Left 0 ;Noise\nOffset
TEXT -160 224 Left 0 ;Current \nSense
TEXT -488 48 Left 0 ;Simple Differential Amplifier used to convert
4-20mA current to voltage.
TEXT -360 504 Left 0 ;Look at V(Out), V(minus), and V(plus)
TEXT -360 536 Left 0 ;Change R3 to 249K, and notice effect on V(out)
TEXT -360 568 Left 0 ;Change R2 to 9.98K and notice effect on V(out)
 
R

Roger Gt

Jan 1, 1970
0
X-No-Archive: yes
: Roger Gt schrieb:
:
: > : The two other mentioned approaches probably won't work, BTW.
: > : Forget any (standard) optoisolator, unless you really enjoy
: > : great nonlinearity, massive temperature dependence and
aging,
: > : and tolerance problems.
:
: > So use it as a switch, which avoids most problems of the sort
: > described.
: > Select the part for the temperature range you need to operate
over
: > and for an input maximum current of about 20mA The pull up on
the
: > transistor can be selected for the transfer ratio of the
device.
:
: Seems like you don't know that 4-20 mA is an *analog* interface.
: Don't confuse it with 20 mA current loop (TTY).
:

Gee, I couldn't read his mind, and he didn't mention Analog!
 
R

Roger Gt

Jan 1, 1970
0
X-No-Archive: yes
: Hi all...
:
: I'm trying to convert a 4-20mA current to a voltage I can use
with an MCU. I
: thought a simple 250 ohms resistor could do the job but it
didn't .... the
: voltage across the resistor is fine (5v). The problem is with
respect to the
: common GND of the rest of the circuit, the resistor terminals
are at 32v and
: 27v.
:
: I can not load the 4-20mA line with any more resistance or
divert any
: current to GND. I tried an optoisolator but the 4mA is enough to
turn on the
: LED so I get very little voltage swing at the output
(phototransistor).
:
: I thought of an op-amp but I can't think (or find) the right
configuration.
: Any suggestions ?
:
: Thanks
:
Use an instrumentation Amplifier to differentially resolve the
signal and reference it to circuit ground.
 
R

Roger Gt

Jan 1, 1970
0
X-No-Archive: yes
"Tilmann Reh" wrote
: Roger Gt wrote
:
: > Shunt the LED with a 220 ohm 1/4 Watt resistor.
: > The drop at 4mA is less than a volt, (About 0.9V)
: > Which will not light the LED,
: > at 20mA the drop across the resistor will climb to 4.4 volts
: > without the LED, but with the LED, current will mostly flow
: > through the LED and turn on the Isolator.
: >
: > The 220 ohm resistor will consume (about 8mA) so the net
current
: > to turn on the LED will be (about) 12 mA
: >
: > Works for me!
:
: No, you are talking about a digital interface (TTY), while the
: OP is talking about an *analog* signal.
:

Since you clearly don't know what you talking about your getting
irritating! The interface I referred to was for a "Lenkirk"
analog reading system which was common in water distribution
systems. The data was a PWM signal with a fixed repetition
rate.
The OP didn't specify the instrument nor the format for the data,
so I expected it was a common interface! 50% possibility of
being right!
 
Y

YD

Jan 1, 1970
0
X-No-Archive: yes
"Tilmann Reh" wrote
: Roger Gt wrote
:
: > Shunt the LED with a 220 ohm 1/4 Watt resistor.
: > The drop at 4mA is less than a volt, (About 0.9V)
: > Which will not light the LED,
: > at 20mA the drop across the resistor will climb to 4.4 volts
: > without the LED, but with the LED, current will mostly flow
: > through the LED and turn on the Isolator.
: >
: > The 220 ohm resistor will consume (about 8mA) so the net
current
: > to turn on the LED will be (about) 12 mA
: >
: > Works for me!
:
: No, you are talking about a digital interface (TTY), while the
: OP is talking about an *analog* signal.
:

Since you clearly don't know what you talking about your getting
irritating! The interface I referred to was for a "Lenkirk"
analog reading system which was common in water distribution
systems. The data was a PWM signal with a fixed repetition
rate.
The OP didn't specify the instrument nor the format for the data,
so I expected it was a common interface! 50% possibility of
being right!

4 to 20 mA is the standard protocol for industrial instrumentation
loops, and is linear. It's being gradually substituted for digital
multi-drop protocols such as Profibus. Adoption has been slow because
of a multitude of proposed protocols none of which is compatible with
any other and once you've adopted one you're stuck with that vendor.

- YD.
 
S

Spehro Pefhany

Jan 1, 1970
0
4 to 20 mA is the standard protocol for industrial instrumentation
loops, and is linear. It's being gradually substituted for digital
multi-drop protocols such as Profibus. Adoption has been slow because
of a multitude of proposed protocols none of which is compatible with
any other and once you've adopted one you're stuck with that vendor.

- YD.

Yes. The industrial fieldbus area is a massive "dog's breakfast".
There is also HART as a hybrid method (digital communications riding
on top of standard (usually) 2-wire 4~20mA).


Best regards,
Spehro Pefhany
 
R

Roger Gt

Jan 1, 1970
0
X-No-Archive: yes

"YD" wrote
: "Roger Gt" wrote:
: >"Tilmann Reh" wrote
: >: Roger Gt wrote
: >:
: >: > Shunt the LED with a 220 ohm 1/4 Watt resistor.
: >: > The drop at 4mA is less than a volt, (About 0.9V)
: >: > Which will not light the LED,
: >: > at 20mA the drop across the resistor will climb to 4.4
volts
: >: > without the LED, but with the LED, current will mostly flow
: >: > through the LED and turn on the Isolator.
: >: >
: >: > A 220 ohm resistor draws (about 8mA) so the net current
: >: > to turn on the LED will be (about) 12 mA
: >: > Works for me!
: >:
: >: No, you are talking about a digital interface (TTY), while
the
: >: OP is talking about an *analog* signal.
: >
: >Since you clearly don't know what you talking about your
getting
: >irritating! The interface I referred to was for a "Lenkirk"
: >analog reading system which was common in water distribution
: >systems. The data was a PWM signal with a fixed repetition
: >rate.
: >The OP didn't specify the instrument nor the format for the
data,
: >so I expected it was a common interface! 50% possibility of
: >being right!
:
: 4 to 20 mA is the standard protocol for industrial
instrumentation
: loops, and is linear. It's being gradually substituted for
digital
: multi-drop protocols such as Profibus. Adoption has been slow
because
: of a multitude of proposed protocols none of which is compatible
with
: any other and once you've adopted one you're stuck with that
vendor.
:
Hi JCL: Stating an opinion is interesting, for politics.
The problem for 4-20mA is a LACK of standards.
Old TTY was one in common use.
"Lenkirk" was a common method for single or multi drop long range
communication.
A straight proportional analog 4-20mA (or 10-50mA) loop is used
for short range purely analog communication with a sensor. But is
not used for multi drop, like the Lenkirk.

There are of course many others methods using the basic 4-20mA
format in a one off or one product application.

Lenkirk hardware is no longer available to buy, but we program the
communications method in the interface embedded CPU for
compatibility. It's slow, but then it is reliable! Like a train!
When the customer wants triple redundant communications the slow
links MUST be reliable and simple.

Try a 4-20 loop over a three hundred mile distance some time.
Even with lenkirk we used 300Volt compliance for it. But a volt
per mile was not all that bad (two repeaters.)
 
Top