Incorrect values coming from 4-20mA

This is what I have.

My set up

  • Raspberry Pi image with latest image
  • shield on the GPIO pins of the RPi
  • I2C cable between the Shield and the 1-Channel 4-20mA Current Loop Receiver
  • I2C Cable hooked to the “IN” port on the Current Loop Receiver.
  • I am using this example code.

Two things I found wrong with the above code is that it is written for Python2. The Rpi comes standard with Python3.

  • I swapped out the “import smbus” for “import smbus2 as smbus” which says its full Python implementation of smbus. So barring that is the problem.
  • The CONFIG_REG value was unassigned so I assigned it as “CONFIG_REG = list()” (after line 80)

Barring those two changing impacting anything…this is what is happening.

When I execute I get prompted for the channel.

For channel 0 I get numbers in the range of 198-205 when my sensor is hooked up, and 227-235 when there is nothing hooked up at all. Varying the sensor output doesn’t seem to change these number. For example, sensor will output 3.49mA when its in an “unknown” state. When it gets a good state it will output 3.98mA. When I increase the volume the sensor will go up to 4.9mA (based on a multi-meter reading it)
For channel 1-3 I get numbers in the range of 4200-4250.

I have validated with a multi-meter that my sensor is putting out 4ma (like 3.98mA) and then when I give it some load it will go up to like 4.9mA.

So my questions are:

  1. If I hooked ground to ground on the 1-Channel 4-20 receiver roughly what values should I get?
  2. Does the roughly 200 values give any indication What might be the problem?
  3. Could my device be putting out the wrong voltage level on the 4-20mA? What should it be?


You have the wrong 4-20mA receiver device. You should be using this one

Sorry, can you explain why?

I’m using a bench top PSU to supply voltage to the sensor.

The 4-20mA board you have also supplied power 4-20mA wires ( active devices, also known as two-wire).
In your case, the sensor has an external power supply and doesn’t need power over 4-20mA lines.

Ok so I’m understanding correctly (mainly trying to figure out what to google so I can understand it better).

  • The sensor I have is supplying power over the IN and GND wires (e.g. the 24V)? And that is called an “active” device? You are calling this a two-wire?
  • The NCD board I have is SUPPLYING 16V over the IN and GND wire? And that is for passive devices? Can you give an example of some?

Is there sample code for the device you link? Would this sample code work? GitHub - ncdcommunity/Raspberry_Pi_MCP3428_16Bit_4Channel_ADC_Python_library: MCP3428 16Bit 4Channel Analog To Digital Converter Interfacing with Raspberry Pi

Since this sensor I have is an “active” device, is there a more simplistic alternative?

this will work with your sensor

this code will work

In short, the onboard power supply and your external power are fighting each other.

@Anil_Bhaskar sorry, I’m struggling to understand your statement here and the differences between “2 wire” vs “3 wire”.

The 4-20mA board you have also supplied power 4-20mA wires ( active devices, also known as two-wire).
In your case, the sensor has an external power supply and doesn’t need power over 4-20mA lines.

If I’m understanding you correctly…

The 1-Channel 4-20mA Current Loop Receiver 16-Bit ADS1115 I2C Mini Module will work with “2-wire” devices, correct? This device SUPPLIES power over the two wires (that’s also used for 4-20mA).

The “4-Channel I2C 4-20mA Current Receiver with I2C Interface” you mentioned would be used for a “3-wire” devices, correct?

Your statement seems to be backwards from my statement implying my device is a 2-wire?

“active devices, also known as two-wire”

I also noticed that the “4-Channel I2C 4-20mA Current Receiver with I2C Interface” wants a 12VDC input voltage to power it up but my sensor wants 24VDC won’t be a problem since they wouldn’t be using the same ground?

I called the sensor manufacturer and they stated that it is a 3 wire configuration.

The 12V supply is to power up the board. You can use 24V to power your sensor. Please checkout the wiring diagram on the product page under the drawing section.

So it seems that this new ADC is able to read our 4-20mA signal. But have a followup questions…

  1. The issue I’m running into is that I’m having to rerun the configure register def config_command(self): function to get a different value even though the device should be in continuous mode. Should I not be able to just call the “read_adc()” function over and over to get a new value?

Just for confirmation, I moved Raspberry_Pi_MCP3428_16Bit_4Channel_ADC_Python_library/ at master · ncdcommunity/Raspberry_Pi_MCP3428_16Bit_4Channel_ADC_Python_library · GitHub out of the loop and it has the same exact problem. It doesn’t read a “new” value if you change the sensor to a different gain, or anything else really. Raspberry_Pi_MCP3428_16Bit_4Channel_ADC_Python_library/ at 3e3f2e61c4931fdb169c9468fbcbcd39f1a24589 · ncdcommunity/Raspberry_Pi_MCP3428_16Bit_4Channel_ADC_Python_library · GitHub