Measuring 4 ... 20 mA from using 12 VDC, 2 Wire or 3 Wire

Hello Everyone,

I'm a newbie trying to figure out how to connect and read a pressure transducer on an Ardunio Uno or ESP32.

I have two options for the sensors, a two-wire loop or a three-wire.

Two-wire needs power supply of 8 .. 30 VDC max 25mA, with an Output signal of 4 .. 20 mA, 2 Wire (Positive Pin 1, Ground Pin 2) (I think this is the best option)

Three-wire needs power supply @ 14...30 V DC, with signal wire 0 ... 10 Volt. (Positive Pin 1, Ground Pin 2, S+ Pin 3)

I am thinking of the two-wire option and here is the schematic.
diagram-sensor

As a newbie, I'm also then trying to figure out how to use the two-wire loop to read the current signal through the Arduino GPIO(1) pin? I believe I need resisters in two different spots.

The sensor goes from 0 - 5000 psi, the current is 4 to 20 mA. I believe I would use a Map command to convert mA to Pressure:

int MyPressure = map(analogRead (A1), 4, 20, 0, 5000)

Any suggestions on the best way to make this happen? Does anybody have any code examples you might be able to guide me to?

I hope I provided enough information.

Thank you in advance,
Mike

Or if I use a three-wire I am guessing two wires drive the transducer and the third wire returns a voltage from

You have to run the 4 - 20mA through a resistor to generate a voltage that can be read with an ADC converter. For UNO, a 250Ω would produce 1 - 5V, I don't know the maximum ADC voltage for the ESP.
For the 0 -10V you would need a voltage divider to reduce to 0 - 5.

Welcome to the Forum . :raised_hand_with_fingers_splayed:

Your circuit is correct ,The resistor from the sensor to gnd is the measurement device and a normal value there is either 240 or 220 ohms. With 220 ohms the voltages across there @ 20mA = 4.4V and @ 4mA = 0.88V
these voltage will produce an analog reading of 180 to 900 assuming the 5V reference. Therefore your map will be : int MyPressure = map(analogRead (A1), 180, 900, 0, 5000)
good luck ......@JCA beat me to replying :roll_eyes:

PS. the resistor to the analog pin is safely 1-10kOhms

Both assume using the default (5volt) reference of an Uno/Nano/Mega's ratiometric A/D for 4-20mA sensor, which is wrong.
The 5volt supply is too unstable for this, and sensor values will vary with Arduino's supply variations.

Better to use a 51ohm resistor, and switch to the more stable internal 1.1volt Aref in setup().
A 4k7 or 10k pin protection resistor (arrow in the picure) is a wise addition that doesn't influence readout. A 100n ceramic cap from pin to ground can also be added if noise is present.

An ESP8266 (WeMos/NodeMCU), unlike the Uno, has an absolute A/D (with voltage divider).
There a 160ohm resistor (3.3volt/0.02A) can be used (no pin protection resistor needed here).

Not sure about the ESP32. It has AFAIK also an absolute A/D, like the ESP8266.
But with complicated gain settings.
Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.