## Knowledge Base: Processing

• See the list of other topics for category Processing

Other topic categories:

Q10017 Correcting offsets from 4-20 mA inputs

Tags: Help, DAP, DAPL, 4-20 mA, current loop, processing, scaling

Applies to: DAP applications using 4-20 mA inputs, MSTB009, MSTB010, MSXB086

When my signal level is 0, my 4-20 mA transmitter module produces a 4 mA current level – as it should. But this current produces a non-zero reading when I sample it with a DAP. How can I correct for this?

There are two approaches that you can use, leading to the same kind of solution in a slightly different way.

The component value approach: Suppose that your load resistance is a precision 250 ohms (typical). At 4 mA, your DAP will measure 1 volt, 6554 counts. At 20 mA, your DAP will measure 5 volts, 32767 counts. The numeric range of the measurements is 26214 counts. You want to map these measurements to a normalized input range 0.0 to 1.0. Suppose that your 4-20 mA input signal comes in on logical channel pipe IP2. You can then apply the following DAPL expression task.

```  pipes  pnormalized float
...
pdefine   normalization
pnormalized = (IP2-6554)/(26214.0)
```

Notice the trick of making the `26214` range number a floating point number — otherwise computing the ratio in integer arithmetic will truncate to zero, which is probably not what you want.

As it turns out, this strategy also works with the `MSXB086` 4-20 mA receiver board, though you don't have to worry about the electrical details to use it.

The calibration approach: This doesn't use any nominal values, so it produces more accurate results. Drive your 4-20 mA converter at minimum input, and observe the DAP measurement. Because of device tolerances, this measurement might differ somewhat from the nominal. Now drive your 4-20 mA converter at maximum, and observe this measurement. The difference of the two measurements gives you the full range. Now you can encode the calibration constants.

```    constant  offset4mA     float = 6540     // Your actual offset here
constant  range4to20mA  float = 25620    // Your actual range here
...
pnormalized = (IP2-offset4mA)/range4to20mA
```

There is no point in using this method with an `MSXB086` board if you trust the accuracy of your transmitter.

L

Topics related to 4-20 mA current loop hardware are covered in the hardware knowledge base index.