Analog I/O Scaling and Signal Conditioning for Process Control

Analog I/O Scaling and Signal Conditioning for Process Control

Key Takeaway

Analog io scaling is a linear map from a raw count to an engineering unit, and it is only as good as the reference values used to define the map. The three things that ruin a process loop are a wrong zero, a resolution that is finer than the sensor, and a filter that is too slow for the loop it is feeding. Fix the range and the reference first, then the resolution, then the filter.

Analog I/O Scaling Process Control1. InputRanges4‑20 mA, 0‑10 V, 0‑5 V2. Resolution16‑bit counts65536 steps3. ScalingEU formulaRaw‑Low/High → Engineering4. ConditioningIsolation, filtering1‑5% accuracy5. Loop BudgetTransmitter + module + wiringTotal 1‑5%Indian Process Control:Proper scaling prevents 60% of process control failures in Indian manufacturing, where 4‑20 mA loops are standard for long cable runs.

Figure 1: Analog I/O Scaling — Input ranges, resolution, scaling formula, conditioning and loop budget overview

1. From Raw Counts to Engineering Units

Analog io scaling is the conversion between two number systems: the raw integer that the input module reports, and the engineering unit that the process engineer reasons in. The module has no idea whether it is looking at a pressure, a temperature or a speed. It knows the input voltage, it knows the resolution, and it reports a count.

The scaling formula and its three variables

The standard linear map is EU = (Raw – RawLow) x (EUMax – EUMin) / (RawHigh – RawLow) + EUMin. Three things have to be right before this formula produces a correct answer, and getting any one of them wrong produces a plausible but wrong number.

  • RawLow and RawHigh are the module counts that correspond to the bottom and the top of the sensor range. For a 4 to 20 mA input configured for a 4 to 20 mA range, RawLow is the count at 4 mA and RawHigh is the count at 20 mA. For a 0 to 10 V input, RawLow is the count at 0 V.
  • EUMin and EUMax come from the sensor datasheet or the process specification. A 0 to 10 bar transmitter scaled to 0 to 16 bar means the 4 mA point maps to 0 bar and the 20 mA point maps to 16 bar, even though the transmitter’s own range is 0 to 10 bar. That is a transmitter being used as a 0 to 16 percent of its span signal, which is poor practice and it is also a common mistake.
  • The zero and span check is the step that is skipped. Before scaling anything, verify the module count at the sensor’s true zero and at the sensor’s true full scale. If the transmitter is calibrated 0 to 10 bar but the module is configured for 0 to 10 V and the field is actually 0 to 16 bar, no amount of clever scaling will fix the fact that the signal never reaches the top of the range.

Never hardcode raw counts

A program that contains the number 5530 as “12 bar” is a program that breaks when the module is replaced, when the range is reconfigured, or when a different module with a different resolution is fitted. Define the range once, in a configuration block, and let the scaling routine read it. This is the difference between a controller that a maintenance engineer can re-range in five minutes and one that needs the original programmer.

Worked example: a 4 to 20 mA pressure transmitter

A pressure transmitter has a 4 to 20 mA output for 0 to 10 bar. The input module is 16 bit with a 0 to 20 mA range, so RawLow = 13107 at 4 mA and RawHigh = 65535 at 20 mA. The process wants the reading in bar over 0 to 10.

EU = (Raw – 13107) x (10 – 0) / (65535 – 13107) + 0 = (Raw – 13107) x 10 / 52428.

So a raw count of 39371 gives EU = (39371 – 13107) x 10 / 52428 = 5.006 bar. The scaling constant to store in the program is 10 / 52428 = 0.000190745, and the offset is -13107. Store the offset and the span as named configuration variables and the same routine scales a 0 to 16 bar transmitter with no code change.

2. Resolution, Accuracy and the Loop Budget

Resolution and accuracy are different quantities and the confusion between them causes real overspending. Resolution is how finely the module can report a number. Accuracy is how close that number is to the truth. The loop accuracy is the accuracy of the weakest element in the chain.

The arithmetic of resolution

Resolution Counts Step over 0 to 10 V Step over 4 to 20 mA
12 bit 4096 2.44 mV 3.9 uA
16 bit 65536 0.153 mV 0.244 uA
24 bit (high-end modules) 16777216 0.0006 mV 0.00095 uA

For a 0 to 10 bar transmitter on a 0 to 16 bar scale, one 16 bit count is 10 / 65536 = 0.0001526 bar. That is far finer than any pressure transmitter is accurate to. A typical 4 to 20 mA pressure transmitter is specified at 0.25 to 0.5 percent of full scale, which on a 0 to 16 bar scale is 0.04 to 0.08 bar. The module is four hundred times finer than the sensor, and adding resolution buys nothing.

Where the accuracy actually goes

Element Typical contribution Note
Pressure transmitter 0.25 to 1.0 percent of span The dominant term in most loops
Input module 0.05 to 0.1 percent of span Including accuracy, linearity and temperature drift
4 to 20 mA loop resistance 0.1 to 0.5 percent Depends on the transmitter’s own loop resistance allowance
Sensor and process 0.5 to 5 percent Line pressure drop, hysteresis, fouling
Total worst case 1 to 5 percent Add the terms, do not average them

Resolution and noise are not the same thing

A 16 bit module reading a noisy 4 to 20 mA signal will show the last few digits changing every scan. That is not resolution being used, it is noise being digitised. A module with a 0 to 10 V input has a high input impedance of tens of megaohms, so a 1 mV error is a 1 mV error. A 4 to 20 mA input has a low impedance of about 100 to 250 ohm, so the same 1 mV is a 0.1 percent error. This is the electrical reason current wins over voltage for long runs, and it is also why the module’s input impedance must be inside the transmitter’s specified loop resistance budget.

Do not average your way out of a bad installation

If a signal is noisy enough that the last three digits are random, the fix is in the installation: a shield bonded at one end only, a twisted pair, a separate 24 V supply for the transmitter, and a physically separate route from the VFD output cable. Filtering in software hides the symptom. Once the physical fix is in, a modest 100 to 500 ms filter removes the residual noise without hurting the loop.

3. Choosing the Signal Type

The choice of electrical signal is made long before the PLC and it determines the achievable accuracy more than the module does.

4 to 20 mA versus 0 to 10 V

Property 4 to 20 mA 0 to 10 V
Immunity to voltage drop Complete Directly proportional
Broken wire detection Yes, reads 0 mA No, reads 0 V which may be valid
Live zero Yes, 4 percent of span No
Power supply needed at field Yes, 2-wire loop Usually no
Load on transmitter Up to 250 ohm typical 10 kiloohm typical
Noise coupling Very low Moderate
Maximum practical run Several hundred metres 10 to 20 metres

The 4 mA live zero is the feature that gets overlooked. A 0 to 10 V signal cannot distinguish a genuine zero-pressure reading from a broken wire, because both are 0 V. A 4 to 20 mA loop can, because a broken wire gives 0 mA and the lowest legitimate reading gives 4 mA. Put that check into the program: if the raw count is below the 4 mA equivalent, raise a “sensor open circuit” alarm instead of showing a zero.

RTD

An RTD is a resistance that changes with temperature. The common industrial types are Pt100 (100 ohm at 0 deg C) and Pt1000 (1000 ohm at 0 deg C). The relationship is not linear, so an RTD module does the conversion internally using a table or a polynomial. The engineering rule is to use the module’s native type setting rather than trying to scale the raw counts yourself, because the module also handles the excitation current and the lead resistance compensation.

Two-wire, three-wire and four-wire connection refer to how the lead resistance is compensated. Two-wire is cheapest and the error appears as a constant offset equal to the lead resistance times the current. With a 2-wire Pt100 on 10 m of 0.5 mm2 copper at 1 mA excitation, the lead resistance is about 0.7 ohm, which on a 100 ohm sensor is 0.7 percent, or about 2.3 deg C at 330 deg C. Three-wire and four-wire connections compensate this and are worth the extra wire when the temperature measurement matters.

Thermocouple

A thermocouple generates a small millivolt signal from the Seebeck effect, typically 0 to 20 mV over its range. Type K covers minus 200 to 1350 deg C, type J to 1200 deg C, type R and S to 1600 deg C. The module must be cold-junction compensated: the terminal block where the thermocouple lands is at cabinet temperature, not at the furnace temperature, and that junction generates its own millivols which must be subtracted.

Thermocouples are slow. A bare junction has a time constant of perhaps 30 to 90 seconds, and even sheathed type K is in the 10 to 60 second range. Never fit a thermocouple to a fast control loop. For a furnace with a 30 second cycle, the measurement lag dominates the loop and the tuning has to account for it.

Encoder and high speed counters

An incremental encoder produces pulses. The count is the raw value, and the scaling is counts to millimetres using the encoder’s pulses per revolution and the screw lead. A 1000 ppr encoder on a 20 mm lead screw gives 1000 counts per 20 mm, or 50 counts per mm. On a 16 bit module with a 0 to 1000 count range configured, the raw value is 0 to 65535 mapped to 0 to 1000 mm, which gives 0.0153 mm per count. The physical reality is much coarser: the encoder disc has 1000 discrete positions per revolution, so the mechanical resolution is 0.02 mm per count, and a 10:1 gearbox would make that 0.002 mm. The electronic resolution is a fiction unless the mechanics support it.

4. Signal Conditioning in the Loop

Conditioning is everything you do to the raw value between the module and the process variable that the controller uses. Done badly it introduces its own errors; done well it makes the loop behave.

Filtering

Every analogue input has noise. The module applies a hardware filter and the program applies a software filter, and the two together determine how responsive the reading is. The rules:

  • Flow, level, temperature: 100 to 500 ms is appropriate. A tank level does not change faster than the filter.
  • Pressure on a machine: 20 to 100 ms. Fast enough to catch a pressure spike, slow enough to reject pump ripple.
  • Force, current, position feedback: 1 to 20 ms, or none at all if the loop needs the speed.

A rolling average over N samples adds roughly (N – 1) x sample period / 2 of lag. A 10-sample average at 100 ms sampling adds 450 ms of lag. That lag goes straight into the control loop and it will make a PID tune oscillate. When you add a filter, tell the loop tuner, or use the filter time as the loop’s dead time in the tuning calculation.

Deadband

Deadband is a band around the reading inside which the value does not change. It has two legitimate uses and one abuse.

Legitimate use one: suppressing chatter on a value that crosses a threshold repeatedly, such as a level switch near the setpoint or a temperature that jitters around 100 deg C. Legitimate use two: reducing the number of writes to a slow display or historian. The abuse: applying deadband to the value that drives a control output. A pressure controller with a 0.5 bar deadband on a 0 to 16 bar scale has a 3 percent error band built into its control output, and it will hunt around the setpoint.

Clamping and range checking

Clamp the scaled value to the physical range of the sensor. A value below the sensor’s zero means the loop is broken and should raise an alarm; a value above the sensor’s full scale means the transmitter is failed or the wiring is wrong. A scaled value of 47 bar from a 0 to 16 bar transmitter is not a process event, it is a fault, and the program should know the difference.

Isolation and common mode rejection

An input module shares one reference (usually 0 V) across all its channels. If the field side of the 24 V supply is at a different potential from the cabinet 0 V, that difference appears on every channel as an offset. This is the “ground loop” problem. Two solutions exist and the choice depends on cost.

The cheap solution: make the field 24 V supply come from the same source as the PLC 24 V, so both sides sit at the same potential. This works and it is what most Indian machines do. The robust solution: a galvanic isolator on the analogue input, rated typically 1 kV or 2 kV isolation, with a channel-to-channel isolation of 500 V or better. An isolator costs roughly INR 3,000 to 8,000 per channel, which is significant but negligible against a process line that has to make product to a tolerance.

Common mode rejection ratio is the figure that quantifies this. A module with a CMRR of 80 dB at 50 Hz rejects 100 times the common mode voltage at the input frequency. A 5 V common mode error becomes 50 mV, which on a 0 to 10 V input is 0.5 percent of span. That is the whole error budget of a decent transmitter spent on the input stage, which is why isolation and a good reference matter.

5. Putting It Together: A PID Loop That Behaves

The scaling and the conditioning exist to serve the loop. Here is the complete chain for a tank level loop, which is a useful worked example because the requirements are modest and every error is visible.

The signal chain

A differential pressure transmitter measures the tank level and outputs 4 to 20 mA over 0 to 500 mm of level. It is two-wire and powered from the 24 V DC field supply through a 250 ohm resistor in the panel. The loop goes to a 16 bit analogue input module. A dedicated 24 V DC supply feeds the transmitter loop, separate from the sensor supply that feeds the digital inputs.

The scaling block

The configuration holds the transmitter span (0 to 500 mm), the raw limits (13107 to 65535), and the engineering limits (0 to 500 mm). The scaling routine runs every 100 ms, produces the level in millimetres, applies a 500 ms moving average because level is slow, applies a 5 mm deadband to stop the display chattering, and clamps the output to 0 to 500. If the raw value falls below 13107 the program raises a “level transmitter open circuit” alarm rather than reporting a level of zero.

The loop tuning has to know the filter

With a 500 ms filter and a 100 ms sample, the effective dead time is about 0.55 s. A level loop on a 500 mm tank with a 0.55 s dead time needs proportional action and a modest integral time. Tuning the loop without accounting for the filter gives a controller that appears to have unstable gain, and the usual response is to reduce the filter, which then lets the noise through, which then brings the deadband back, which then makes the level reading jumpy on the display. The fix is to compute the filter delay into the tuning and leave the filter in.

Alarm limits in engineering units

Set the high and low level alarms in millimetres, not in raw counts. A raw count alarm of 60000 is meaningless to the maintenance engineer and breaks silently if the module is replaced with one of a different resolution. An engineering-unit alarm survives every hardware change and it is the only kind of alarm an operator can act on.

Document the loop, not just the wire

Every analogue loop needs a tag sheet entry that records the tag, the description, the sensor type, the range in engineering units, the signal type, the module and channel, the supply source, the isolator if any, the filter time, the alarm limits, and the scaling constants. This is the document that lets a maintenance engineer change a transmitter without guessing, and it is the one that is always missing. The module selection side of this work is in the PLC selection and I/O sizing guide, the wiring and shielding detail is in the PLC panel design and wiring guide, and the supervisory side of the same loop is in the SCADA alarm management guide.

Sources

  1. IEC 61131-3, Programmable controllers – Programming languages
  2. IEC 61724-1, Industrial process measurement and control – Analogue
  3. Omega Engineering, Introduction to Thermocouples and RTD Temperature Sensors

Key Takeaways

  • Define the scale from the sensor datasheet, never from a guess. A wrong zero offset shifts the whole process range.
  • A 16 bit input over 0 to 10 V resolves 0.153 mV, but the transmitter supplying it is usually accurate to only 0.5 percent of span.
  • 4 to 20 mA survives long cable runs and detects a broken wire as 0 mA, which a 0 to 10 V signal cannot.
  • Use a 100 to 500 ms filter only on slow variables like flow and level, never on a fast loop such as pressure or current.
  • Deadband, alarm limits and scaling must be applied in engineering units, not in raw counts, or they move when the module changes.

Leave a Reply