EmbeddedRelated.com
Forums
Memfault Beyond the Launch

4-20ma Analog Current Loop to Pic A/D

Started by kg4pid January 20, 2009
I'm trying to find a way to interface a pressure sensor that uses a 4-
20ma analog current loop and I would like to read it using a Pic A/D
converter. I have tried using google but have not found what I'm
looking for. There will be about 30 feet of cable between the sensor
and the Pic / interface circuit. The sensor is currently connected to
a device called a Labjack which is loaned to me and must be returned.
If possible I'd like to tap in to the loop and read the current and
compare it to the Labjack readings before disconnectomg the Labjack
completly. Looks like I'll need a sutable power supply also. Anyone
here have any experience in this area?

Thanks Max
Assuming the pressure transducer isn't powered, you'll need a voltage
source to power it. A 12v wall wart should do. Voltage level, or
regulation isn't critical. Isolation from ground IS, but that should be
easy. Just put a resistor in the current loop, whose value will drop 20 ma
to give the voltage you want. e.g. if you are feeding a 0-1 volt input,
use R = 1 / 0.020 = 50 ohms; if your input is 0-5 volt, then R = 5 / 0.020
= 250 ohm. Any wattage is OK. When you scale the pressure value, don't
forget that 4 ma (1/5 of the full input voltage, not zero) represents the
bottom pressure value). But that's only software ;=)
Don (CA)
Unless you really want to re-invent the wheel, why not just buy a
Labjack and keep using what you have, Max? They're not but about $120
or so and ship from stock in the Denver, CO area. We use them here and
have been quite pleased with their performance.

So far as the power supply, most current loops use a 24 volt DC supply
as the standard. If you interface with a Labjack you might want to
lower that to what ever is the lowest for rated use with your
transducer. Stick a temperature stable resistor, probably wire wound
would be best, in the line and then measure the voltage drop. Just be
sure that you don't exceed the ratings of either your transducer or your
Labjack.
REB
Well the Labjack is nice, but, Labjack + software + PC (for 24 hour
monitoring) = big $. If I can interface to this pressure sensor with
a Pic, then I can build a datalogger and only use a PC to view the
data. Using just a resistor seems too easy.

Max
> Using just a resistor seems too easy.

What is a resistor but a device for translating current into a voltage drop?
You can measure voltage with the PIC, so all it takes is sizing a resistor
to give you a range of voltages you can deal with. Ohm's Law is your friend.

72/73 de WB8RCR http://www.qsl.net/wb8rcr
didileydadidah QRP-L #1446 Code Warriors #35
The reason I said "Using just a resistor seems too easy." is because
all the current loop equipment I have found is expensive. I doubt
they use JUST A RESISTOR. The pressure sensor cost about $500 and
it's not mine. I don't want to burn up this pricy sensor! Wish I had
something cheap to experiment on.

Max
2009/1/21 kg4pid :
> The reason I said "Using just a resistor seems too easy." is because
> all the current loop equipment I have found is expensive.

anything is expensive if they can get away with it.

if it says it works at say 5k to 100k over its range it designed to
measure a, then choose a voltage and series resistor to give say 15ma
when its at like 5k, and thats the most current it will ever pass and
you shuold not 'burn it up'

personally i'd go with a small psu, and fit a 20ma fuse on its output
to be safe, and an overcurrent trip cicuit, google should turn one up
You should use a metal film 1% resistor. This will minimize the effect of
temperature on your measurement. If this is a loop powered 4-20 ma device
you wont burn it up. It will never draw more than 20ma. Just check the specs
to see what your voltage range is. If you want to check things first, just
use your DVM on the ma setting without a resistor. That is one of the
reasons 4-20 is used everywhere in industry. 1) it can be easily debugged
with a current meter and 2) It won't suffer from drops due to long cable
runs. 3) it is noise immune.

Regards

Dave Duley

BMT Scientific Marine Services
You seem to be comparing apples to baseballs here. The sensor itself
is expensive because they're probably using a high precision trimmed
sensor with electronics to filter and convert the voltage output into
the 4-20ma current loop standard.

If you read the specs on the sensor, it may state that the output is
also protected against "dummy" accidents: short circuiting,
over-voltage, etc. Unless you plug it in to a wall socket, it should
not be possible to destroy it with bad wiring.

If you go to the company's web site, they may have some app notes on
interfacing the sensor which would make you feel more secure about
using a resistor. And they would most likely also have support
engineers on staff that could answer questions for you. If you follow
their advice and something blows, you'll probably get a freebie from them.

The reason why they use 4-20ma is to allow for LOOOONG cable lengths
without the IR drop in the wire affecting the reading presented at the
other end. By using a relatively high voltage at the sensor (24VDC),
the sensor electronics can vary the output voltage to get the required
current flow regardless of the drop across your sensing resistor. You
can scale the resistor voltage to 5 or even 10VDC without affecting
the operation.

Good luck.
Quoting kg4pid :

> The reason I said "Using just a resistor seems too easy." is because
> all the current loop equipment I have found is expensive. I doubt
> they use JUST A RESISTOR. The pressure sensor cost about $500 and
> it's not mine. I don't want to burn up this pricy sensor! Wish I had
> something cheap to experiment on.

Using a resistor costs you 20% resolution for a 0-5vdc A/D input.
As previously stated your input range is now 1-5 vdc.
One leg of your resistor has to be ground referenced to your A/D.
Another concern is some(many?) 4-20 ma transmitters are connected to more than
one device(receiver). Should you pick a location in the middle of the loop and
ground one leg you may cause unintended ground loop problems on the system.
This is probably more of a problem with switchmode power supplies for your pic
vs isolated(transformer or battery) operated device.
Below is a nice application from Maxim that takes the power right off the 4-20
ma loop and gives you a full 0-5VDC for your A/D.
Your insertion resistor is only 10 ohm.

Maxim app note
http://www.maxim-ic.com/appnotes.cfm/an_pk/823

Burr Brown has a RCV420 that also gives you 0-5VDC out
Notice the ground reference needed for the input sense resistor.
focus.ti.com/lit/ds/symlink/rcv420.pdf

Dennis

Memfault Beyond the Launch