4-20mA into 5V PIC A/D inputs

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Post Reply
Fixxer
Posts: 6
Joined: Sat Mar 22, 2008 11:23 pm
Contact:

4-20mA into 5V PIC A/D inputs

Post by Fixxer »

I was wondering if anybody here might have some tips for connecting a 4-20mA sensor to the A/D input(s) of a PIC running at 5 volts.

The sensor is a two-wire type run off of a 10-30 VDC supply. I have already got an op-amp circuit built, but I was looking for any pitfalls which might occur if, say, the cable to the sensor gets shorted and sends full input voltage to the PIC input. I suppose I could run the output of the op-amp into a voltage follower with a 5V supply, but I'm not sure this is the best way to do it.

Using zeners on the inputs seems too obvious, and I am not sure how good of a solution zeners are.

I know that the circuit could be as simple as a 250 Ohm resistor, but I need this thing to be reliable and robust.

I am not looking for you to do my work for me, I'm just asking if anybody here has any tips, tricks, or chips for interfacing to the analog inputs on a typical MCU, specifically a PIC, that is fault-tolerant (with respect to preventing overvoltage to the MCU).

TIA, -bry
reloadron
Posts: 519
Joined: Sat Jun 28, 2008 8:57 am
Location: Cleveland, Ohio
Contact:

Re: 4-20mA into 5V PIC A/D inputs

Post by reloadron »

Something you could try is the use of an AD627 and the data sheet CAN BE FOUND HERE. Look at page 23 of the data sheet.

Now for a quick and dirty home brew project I would just place a 250 Ohm resistor in your 4-20 mA loop and get the drop which would actually be 1 to 5 Volts. The obvious downside is as you mentioned. If the 250 ohm resistor were to open your pic A/D input will see well over 5 Volts as in whatever your loop supply voltage is and it will toast. I never tried shunting the resistor with a Zener but it may work as protection. The professional method would be the use of an op amp I believe. Using any op amp will obviously require more parts and powering the op amp. Additionally any of several op amps could be used. I suggested the AD627 because it can be used with a single 5 volt supply. Likely a 741 or OP7 could also be used.

Just My Take
Ron
Fixxer
Posts: 6
Joined: Sat Mar 22, 2008 11:23 pm
Contact:

Re: 4-20mA into 5V PIC A/D inputs

Post by Fixxer »

I like it- thanks! I'm going to order a few from Digikey to experiment with.

BTW, reloading makes good sense these days :cool:
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Re: 4-20mA into 5V PIC A/D inputs

Post by MrAl »

Hi,

Another idea that is used is when starting the design of the system a shunt type regulator ic is used rather
than a series type. The shunt type can often sink rather largish currents (up to 20ma sometimes) whereas
the series type can not shunt any current. The shunt regulator working with the PIC protection diodes
can then shunt some current when an input tries to go too high. There is a limit of course, and the spec
is on the PIC data sheet, the spec for the max protection diode current level.
If a series regulator is used, the requirement is that you have to ensure that there is always a load for
that regulator that is always drawing at least the expected overload current (such as 10ma, 20ma, etc.).
This is because if there is only a small load like 1ma and the overload source tries to source 10ma that
will force the regulator out of regulation and the supply voltage (normally 5v) will jump up to some
higher level which will not be good for the PIC chip. The conduction path becomes through the protection
diode into the +5v supply, which is the problem. With a good sized load though like 200 ohms a 20ma
overload current probably wont bother the 5v supply line, although it's a good idea to test this out.
200 ohms draws 25ma at 5v and so with a 20ma overload the regulator with switch from "putting out"
20ma plus the PIC load to putting out only maybe 5ma, with the overload supplying 20ma.
With the shunt regulator however the only requirement is that it is fully capable of handling a current
that is 20ma higher than with the PIC chip load alone.

Zeners work ok too, as long as you figure in the little wiggle room that the tolerance suggests.
This means you have to use a resistor or two and it is probably a good idea to test it too.

You can also use a Schottky from the PIC input to the +5v supply, which will bypass the input
protection diode for that input. This type of diode has less voltage drop than the internal diode.
The power supply still has to be able to handle the extra 20ma of input overload current however,
but now the limit is based on the size of the Schottky and the power supply shunt current rating.
LEDs vs Bulbs, LEDs are winning.
Post Reply

Who is online

Users browsing this forum: No registered users and 64 guests