Feynman137
Posts: 3
Joined: Fri Sep 06, 2019 7:42 pm

Help with 4-20mA and Raspberry Pi 3B+

Fri Sep 06, 2019 10:14 pm

Hello

I have been attempting to read a pressure transmitter, which outputs a 4-20mA signal, with my raspberry pi 3b+. Because the PI doesn't read analog the first step has been to take the 4-20mA and convert it to a 0-5 VDC signal using a DROK voltage converter. Once the signal has been converted to analog voltage it will then be the single input into an Adafruit ads1115 module, which will take it to digital and communicate with PI via I2c. See below.
RPI Overview.PNG
RPI Overview.PNG (13.37 KiB) Viewed 311 times
Before adding the pressure transmitter to the circuit I opted to use a current signal generator to make sure things were working so that I don’t wreck my pressure transmitter.

I am having the following problem:

The current to voltage converter will not output a voltage greater than zero. The input current to the module has been verified by measuring the voltage drop across an inline resistor. I also separately verified my analog to digital converter is working correctly using a voltage signal generator. Below is a diagram of the set-up I am using to verify/calibrate my current to voltage converter. Are there any potential issues with this set-up? I have attached the datasheet for the converter below. Any help would be much appreciated!
SetupDiagram.PNG
SetupDiagram.PNG (17.93 KiB) Viewed 311 times
IMG_0256.jpg
IMG_0256.jpg (138.8 KiB) Viewed 311 times

Thanks
Alex

JohnsUPS
Posts: 112
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Help with 4-20mA and Raspberry Pi 3B+

Sat Sep 07, 2019 5:04 am

You didn't provide any details about the pressure transmitter.
I am referencing this two wire pressure sensor wiring diagram, using the "4-20ma Output Wiring Diagram with Integral Cable", which appears to be wired similarly to what you have shown:
https://cdn.automationdirect.com/static ... itters.pdf

Double check the datasheet for your sensor to verify that the above referenced wiring matches what you have....
To test the output of the sensor, connect the V+ lead to your +12V source. Connect a 250 ohm resistor as shown for RL in the above diagram in series with the Com (-) lead, and then to the negative side of the 12v source. Put your meter across the resistor. Because the sensor has a 4ma minimum output, you should read a minimum of one volt across the resistor (because ~4ma should now be flowing through the resistor). It is this voltage you want to feed to the AD.

You should be able to forego the current to voltage converter all together. Because the sensor output is a current source, you have flexibility. You can scale the resistor to achieve the output voltage you need.

What I would do is use a 165 ohm resistor. This will provide 0.66 - 3.3 volts across the resistor with 4-20ma through it. Because the ADS1115 will run on 3.3 volts, power it with 3.3v instead of 5v. The AD will be happy and the I2C lines to the Pi (SCL/SDA) will no longer need voltage level conversion. Just be careful how you connect the 12v source to the sensor and AD.

Your diagram didn't show voltage level conversion between the AD and the Pi, and this will be necessary if you still need to power the AD from 5 volts.
The Pi won't like any input greater than 3.3V, or you may find yourself purchasing another Pi.

User avatar
Burngate
Posts: 6005
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Help with 4-20mA and Raspberry Pi 3B+

Sat Sep 07, 2019 9:16 am

Just a couple of thoughts.

Top diagram: the only connection between the current-to-voltage convertor and the ADS1115 appears to be a single wire - no ground connection.
Bottom diagram: the current-to-voltage convertor has a pretty red wire between its GND and its power supply negative, but it's only connected to the measuring part by a single wire - you haven't drawn any connection between the two grounds.

If that's really what you've got, you need to connect all the grounds together.

Feynman137
Posts: 3
Joined: Fri Sep 06, 2019 7:42 pm

Re: Help with 4-20mA and Raspberry Pi 3B+

Sat Sep 07, 2019 5:52 pm

Thanks Johns and BurnGate.

Had I done this project again I probably would've just stuck with the resistor, because the current to voltage converter was a hassle with not much benefit. According to the suggestions I made the following changes:

1. Changed the AD's VDD source to 3.3V from 5V to prevent damaging my PI.
2. Connected the grounds of the current signal converter, AD, PI, 12V source. After doing this, I was able to read 0V at 4mA and 3.3V at 20mA and the corresponding min and max digital values with the AD. Diagram below:
Update1.PNG
Update1.PNG (20.28 KiB) Viewed 219 times
I have not tested the transmitter yet but the set-up I inferred to use is as shown below. But, I am unsure on what resistor to use between the pressure transmitter - and the current signal converter +. Any suggestions?
Update2.PNG
Update2.PNG (17.04 KiB) Viewed 219 times
Below are the specs of the transmitter
Transmitter.PNG
Transmitter.PNG (185.4 KiB) Viewed 219 times

User avatar
scruss
Posts: 2477
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Help with 4-20mA and Raspberry Pi 3B+

Sat Sep 07, 2019 6:51 pm

Feynman137 wrote:
Sat Sep 07, 2019 5:52 pm
… After doing this, I was able to read 0V at 4mA and 3.3V at 20mA
I know you're going for maximum ADC range here, but by having 0 V at 4 mA you're getting rid of current loop's one great advantage¹: if it ever outputs less than 4 mA, you know your sensor's broken.

---
¹: and 3–15 psi pneumatic control has it too, but that's pretty rare now.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

JohnsUPS
Posts: 112
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: Help with 4-20mA and Raspberry Pi 3B+

Mon Sep 09, 2019 2:00 am

If you still want to use the current to voltage converter board, then you don't need a resistor in series with the output of the sensor as the board provides this series resistor for you. The board is expecting to be connected to a current source directly.

It appears as though you're making sure that the voltage input to the ADS1115 does not exceed 3.3V, and everything is grounded together, so you should be good to go in the bottom diagram.

Feynman137
Posts: 3
Joined: Fri Sep 06, 2019 7:42 pm

Re: Help with 4-20mA and Raspberry Pi 3B+

Tue Sep 10, 2019 1:47 am

I tried the set-up yesterday and it worked just fine, will likely scale the 4mA signal to something slightly above 0V as suggested to detect failures and remove the resistor as suggested by scruss and Johns. Thanks guys!

Return to “Troubleshooting”