April 8, 2026

The Ultimate Guide to Scaling 4–20 mA Signals in PLC Programming

Scaling a 4–20 mA signal means converting the PLC module’s raw numeric value into a useful engineering quantity such as bar, litres per minute or degrees Celsius. The mathematics is simple; reliable implementation is not. Module ranges, fault currents, integer precision and unit ownership can create errors that survive commissioning. A good scaling design produces both a value and an honest statement about its quality.



Why 4–20 mA uses a live zero

Four milliamps represents the low measurement rather than zero current. This live zero supplies many two-wire transmitters and helps distinguish a legitimate minimum process value from a broken loop. Twenty milliamps represents the configured maximum. Devices may use currents outside the normal band to indicate underrange or fault according to their design.

The PLC does not necessarily receive the number 4 or 20. Its analog-to-digital converter produces raw counts. Depending on module and configuration, the normal span might be 0 to 27,648, 6,553 to 32,767, or another documented range. Always use the exact endpoints for the installed hardware and selected mode.

The universal linear formula

For raw input R, raw low RL, raw high RH, engineering low EL and engineering high EH, linear scaling is:

Engineering Value = EL + (R - RL) × (EH - EL) ÷ (RH - RL)

Suppose 4–20 mA produces 5,530 to 27,648 counts and the transmitter range is 0–160 °C. At a raw value of 16,589, the normalized fraction is approximately (16589 - 5530) / (27648 - 5530) = 0.5. The engineering result is therefore about 80 °C.

This form handles nonzero and negative engineering ranges. For a transmitter configured from −50 to 150 °C, the midpoint becomes 50 °C, not 100 °C.

Preserve numerical precision

Integer arithmetic can truncate the fraction before it is multiplied. If (R - RL) / (RH - RL) is evaluated using integers, most in-range values may become zero. Convert to floating point before division or order operations carefully with a wider integer type.

Also consider resolution. If a module offers 20,000 usable counts over a 1,000-bar range, each count represents 0.05 bar. Displaying six decimals does not create more measurement accuracy. Choose display precision based on sensor, module and process capability.

Separate configuration from logic

Store raw low, raw high, engineering low, engineering high and units in a defined configuration structure. A reusable scaling function should accept these parameters and return scaled value, normalized percentage and quality. Validate that high and low endpoints differ before division.

Do not duplicate scaling in the PLC and HMI. Select one authoritative layer, normally close to the source, and transmit engineering units with metadata. Double scaling is a frequent cause of values that look plausible but are wrong.

Handle underrange, overrange and failure

Linear mathematics will happily extrapolate outside the intended span. Sometimes that is useful for diagnosis, but a control strategy should not unknowingly act on an invalid signal. Establish thresholds using module documentation and transmitter behavior.

Return quality states such as Good, Underrange, Overrange, WireBreak, ModuleFault and BadConfiguration. Preserve the unclamped diagnostic value separately if useful. Then decide at the equipment level how poor quality affects control: alarm only, hold briefly, use a validated substitute, transfer to manual or stop safely.

Blindly clamping every value to the engineering limits hides evidence. A measured −3 percent may reveal calibration drift; forcing it to zero makes the problem invisible. Clamp the value presented to a particular control calculation only when the process design requires it, while retaining quality and raw data.

Reversed and nonlinear ranges

Some applications intentionally map 4 mA to the high value and 20 mA to the low value. The same formula works when EH is less than EL. Make the reversal obvious in configuration and documentation so it is not “corrected” later.

Not every sensor is linear. Tank level versus volume can be nonlinear because of geometry, and some analyzers use piecewise characteristics. First scale current into the transmitter’s primary quantity, then apply a documented lookup table, polynomial or vessel-strapping table. Keep interpolation bounded and test every segment transition.

Filtering after scaling

Filtering can improve display stability and control performance, but it adds delay. A moving average, first-order low-pass filter or module filter should be selected according to process dynamics. Fast pressure protection and slow tank level do not need the same settings.

Trend raw and filtered values separately during tuning. Filtering must not be used to hide loose wiring or electromagnetic interference. Quality faults should normally bypass or reset the filter according to a defined strategy so the program does not keep presenting a smooth but stale value.

Commissioning procedure

Disconnect or isolate the process signal according to approved procedures and use a calibrated source. Inject 4, 12 and 20 mA, then verify raw counts, scaled values and HMI display. Test just below and above the normal span to confirm diagnostics. Repeat for reversed or negative ranges.

Compare the configured transmitter range with PLC engineering limits and plant documentation. Verify units—bar versus kilopascals and litres per minute versus cubic metres per hour are common traps. Record the final values and calibration equipment.

Example reusable result

A robust scaling block returns more than one number: Raw, Normalized, Engineering, Quality, LowAlarm, HighAlarm and a configuration error. Alarm delay and hysteresis should be handled deliberately, often outside the pure conversion function so the scaler remains testable.

Scaling is trustworthy when an engineer can trace any displayed value backward through the formula to an injected current. Correct endpoints, precise arithmetic, explicit units and quality-aware control turn a two-line equation into a dependable measurement interface. That discipline matters because every trend, alarm, PID loop and maintenance decision downstream assumes the number is real.

No comments: