Why does 4-20mA Input from my IO drop below 0 within my program?

Why does 4-20mA Input from my IO drop below 0 within my program?
none 0.0 0

Have an IR-AI04-VI card that is setup via the easyRemote IO for 4-20mA.

With nothing wired into the the Vx+ or Ix+ spots, have floating values that slight change from 65462 to 65466.

We are using a 2-wire sensor, 4-20mA output, that we wire per the documentation to V0+ and I0+, with the V0- going to 0Vdc.
However, in CodeSys the values the still float within the same range occasionally dropping down to 15600 range.
We confirmed this sensor is working with an external mA meter.

I am struggling to know if this is a CodeSys issue, settings issue, or Hardware issue.
I am assuming CodeSys due to this issue is happening on a second setup too in different location.

Apologies if this is in the wrong section of the forum.

Hi @jonmarc91,

What upper and lower limit did you configure for channel 0 within EasyRemote IO? The value 65462 and 65466 surpass the limits defined for analog input: Link

Also, can you please advise the datatype of the variable you’ve mapped to this IO point within Codeys? Here is an example:

Hey @Brendon.S, I have left the factory settings as soon as the mode was changed to 4-20mA.
This would be 0-32000, as what the Easy Remote IO setup and datasheets accompany.

In the Logic, I have both the original (WORD) and a TO_INT, which neither make sense. It should be at 32000, as the sensor is sending almost 20mA.


Hi @jonmarc91,

The WORD data type in Codesys is unsigned meaning its range extends from 0 to 65535. So it would appear that this issue is due to the data type in use. However, can you also post a picture of the IO modules tab in Codesys so that we can see what the current value is as read by the IO?

If the lower and upper limits set within EasyRemote IO are configured to 0 and 32000 respectively, I would suspect that the issue is caused by sensor output that is less than 4mA. This would cause Codesys to display values that are not within the accepted range.:

Example: My sensor input is 2.59 mA and the range in EasyRemote IO is 0 ~ 32000.

Hi @Brendon.S,

Is this what you were requesting?



Please see the information I added to my response above:

My assessment is that the current input from your sensor is around 3.96mA. Can you confirm if this is the case with a multimeter?

Hi @Brendon.S,

That does seem to be the issue.

We tried 3 different sensors, all are outputting just under the 4mA.

Changing sensors got us the desired results, making a bit more sense. Is there a way that if there is a value less than 4mA to have the card output become 0? Using as a diagnostic to know if the sensor went bad?


If the sensor input is below the minimum threshold the iR-AI04-VI will indicate an input error has occurred via the “detect” settings and the “Error code” address:

The error code will need to be added manually via the following steps:

  1. Within Codesys, navigate to the “Modbus Slave Channel” tab:

  2. In the bottom right corner select “Add channel”:

  3. Configure the “Access type” to “Read Holding Registers (Function Code 3)”:

  4. Configure the offset to the hexadecimal address displayed with the prefix “16#”

  5. Here is an example of the finished configuration:

  6. Then, map an variable to this address and reference it within the POU to monitor the current error status:

The potential module error codes are defined at the bit-level as shown:
Example: If bit 8 is on, an input error has occurred for channel 0.

The IO module cannot output a value of 0 when the value is less than 0, but if the output is negative this can be handled programmatically so that the operator interprets the current value as 0:
Note: If the integer value from the module is negative it may be that the senor is at fault.