PLC Analog Input Calibration: Ladder Math, Not Guesswork

Ryan Tanaka10 min read
Other ManufacturerSensor IntegrationTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

The panel reads the wrong engineering value even though the field signal looks correct. You may see a zero offset, the correct low reading with a bad high reading, or two correct endpoints with errors between them. Start here: apply a known input and compare the raw PLC value with the displayed engineering value before changing calibration constants.

Reject the fixes that hide the fault

Do not start by trimming numbers until the display looks right. That approach can correct one point while making the rest of the range worse.

  • Changing only the zero: An offset adjustment moves the entire line. It cannot correct an incorrect span.
  • Changing only the span: A gain adjustment rotates the line. It cannot independently remove a zero offset.
  • Assuming zero raw input equals zero engineering units: A live-zero signal such as 4-20 mA does not pass through the electrical origin. The measured low endpoint belongs in the calculation.
  • Putting the module into hardware calibration mode: This wastes time when the channel reports a stable raw value and the error is in ladder scaling. Use module calibration only when the module documentation calls for it and a known source proves that the channel itself is inaccurate.
  • Checking only the two calibration endpoints: Two matching endpoints prove the computed line passes through those points. They do not reveal a nonlinear transmitter, an unstable source, integer truncation, or a wiring problem between the endpoints.
Panel symptom Likely cause
Same error across most of the range Incorrect offset, incorrect low-point capture, or an engineering-unit zero entered incorrectly
Low point is correct but error increases toward full scale Incorrect high-point capture, span error, or the wrong engineering-unit range
Both endpoints are correct but intermediate points are wrong Nonlinear source or sensor, unstable readings, arithmetic truncation, or a process that is not linear over the selected range
Raw input is wrong for a known applied signal Channel configuration, wiring, source loading, input hardware, or module calibration
Raw input is correct but the displayed value is wrong Ladder scaling, HMI scaling, or a second scaling operation elsewhere in the data path

Separate channel calibration from ladder scaling

Channel calibration and engineering-unit scaling solve different problems.

The input module converts current or voltage into a digital value. Hardware calibration corrects that conversion when the module supports a calibration mode. You apply a known electrical source, invoke the documented low and high operations, and let the module store its correction.

Ladder scaling converts the value delivered to the program into pressure, temperature, level, flow, or another engineering unit. For the requested two-point method, define:

  • X0: raw PLC value measured at the low calibration condition
  • X1: raw PLC value measured at the high calibration condition
  • Y0: known engineering value at the low condition
  • Y1: known engineering value at the high condition
  • X: present raw input
  • Y: calculated engineering value

The real cause of many apparent calibration faults is using nominal electrical endpoints instead of the values that the PLC actually receives. A two-point calculation removes both offset and span error because it derives the line from two measured pairs: (X0,Y0) and (X1,Y1).

Check the raw value first. If it is stable and repeatable at both known inputs, work on ladder scaling. If it is unstable or materially wrong before scaling, diagnose the signal path and input channel first.

Define two valid points before touching the controls

Choose points within the range where you intend to use the measurement. Widely separated points give a better span calculation than two nearby points because input noise becomes a smaller fraction of X1-X0.

  1. Identify the exact value consumed by the scaling logic. It may be a raw count or a value already converted by the input configuration.
  2. Identify the required output unit and range. Record the known low value as Y0 and the known high value as Y1.
  3. Decide whether to inject an electrical signal with a signal calibrator or operate the physical instrument against an external reference.
  4. Place the process in a state where calibration actions cannot create an unintended control response. Do not let a temporary calibration value drive an automatic output without the machine's normal safeguards.
  5. Confirm that no second block, HMI expression, or transmitter setting rescales the result after the ladder calculation.

With a signal calibrator, the electrical source defines the low and high conditions. With a physical pressure transmitter, for example, apply known pressures from an external pressure source and enter the actual reference values in Eng. Unit Low and Eng. Unit High.

Do not substitute the transmitter's nameplate endpoints for actual reference values when the purpose is field calibration. The calculation must pair each captured PLC input with the reference present at that moment.

Capture the low and high endpoints

Use separate CAL LOW and CAL HIGH actions. Process each action once per operator command; otherwise, scan-by-scan execution can keep overwriting a captured point while the signal moves.

  1. Connect the known signal source or external physical reference.
  2. Apply the low calibration condition and wait until the raw PLC value is stable.
  3. Enter the actual low engineering value in Eng. Unit Low.
  4. Activate CAL LOW. Store the present raw value as X0 and the entered engineering value as Y0.
  5. Apply the high calibration condition and wait for a stable raw value.
  6. Enter the actual high engineering value in Eng. Unit High.
  7. Activate CAL HIGH. Store the present raw value as X1 and the entered engineering value as Y1.
  8. Review all four stored values before accepting the calibration.

If noise prevents a stable capture, correct that problem first or capture a representative filtered value using the project's approved measurement method. Do not conceal an oscillating signal by repeatedly pressing a calibration button until a convenient number appears.

If the raw value moves in the opposite direction from the applied reference, inspect polarity, input configuration, and sensor behavior. The mathematics can represent a negative slope, but an unexpected negative slope often exposes a configuration or wiring error.

Calculate the line from the captured pairs

The direct two-point equation is:

Y = Y0 + (X - X0) * (Y1 - Y0) / (X1 - X0)

The ratio (Y1-Y0)/(X1-X0) is the slope. Its units are engineering units per raw-input unit. Subtracting X0 anchors the calculation at the measured low point, so the formula does not silently assume that the line passes through zero.

The equivalent slope-intercept form is:

m = (Y1 - Y0) / (X1 - X0)
b = Y0 - (m * X0)
Y = (m * X) + b

Both forms produce the same result. The anchored form exposes the calibration pairs directly. The slope-intercept form is useful when you want to calculate m and b once, retain them, and execute only the final multiply and add during normal scans.

Check the result algebraically:

  • At X=X0, the difference X-X0 is zero, so Y=Y0.
  • At X=X1, the input ratio is one, so Y=Y1.

A 4-20 mA signal across a 50 ohm resistor provides a simple linear example. Ohm's law gives 200 mV at 4 mA, 1000 mV at 20 mA, 325 mV at 6.5 mA, and 0 mV at 0 mA. These are electrical values derived from the stated current and resistance; the engineering-unit endpoints still come from the actual instrument range.

If another calculation needs to recover input from engineering units, invert the line:

X = (Y - b) / m
M = 1 / m
B = -b / m
X = (M * Y) + B

Do not use the inverse when m is zero.

Program the ladder without arithmetic traps

Calculate the coefficients after a valid endpoint capture or when an operator explicitly accepts a calibration. You do not need to recalculate them on every scan unless the stored points can change continuously.

  1. Convert operands to a floating-point type before division. Integer division can discard the fractional part of the slope.
  2. Perform subtractions before the division so both endpoint differences remain visible for validation.
  3. Calculate new coefficients in temporary storage.
  4. Validate the endpoint separation and resulting values.
  5. Transfer the complete accepted set into the active scaling data together. This prevents one scan from using a new slope with an old offset.
  6. Retain the accepted calibration data through a power cycle if the application requires field calibration to persist.

Control arithmetic should implement one of these equivalent sequences:

m := (Y1 - Y0) / (X1 - X0)
b := Y0 - (X0 * m)
Y := (m * X) + b

Watch the order of operations on controllers with limited numeric ranges. Multiplying two large integer values before conversion can overflow even when the final engineering value is small. Floating-point arithmetic avoids integer truncation, but it does not correct bad endpoint data.

Do not scale the same signal twice. If the input configuration already returns engineering units, another two-point block may introduce a second offset and gain. Trace the value from the input channel through every move, calculation, controller tag, and HMI expression.

Block invalid calibration data

The first mandatory check is X1 != X0. Equal raw endpoints make the denominator zero and provide no information about span. Reject the new calibration instead of allowing a divide-by-zero result into control logic.

  • Reject endpoints with inadequate raw separation for the expected source change. Determine the acceptable separation from the module resolution, instrument behavior, and project accuracy requirement.
  • Reject an unintended zero engineering span when Y1=Y0.
  • Require deliberate operator acceptance before replacing working coefficients.
  • Keep the previous accepted calibration if a new capture fails validation.
  • Distinguish an out-of-range process value from a calibration failure. A mathematically valid line can extrapolate beyond both endpoints.
  • Use clamping only when the control requirement calls for it. Clamping can hide an open circuit, overrange input, or failed transmitter if it is applied before diagnostics.

Store the four endpoint values even if normal operation uses only m and b. They let you reconstruct the calculation, detect an incorrect operator entry, and compare later calibrations with the accepted baseline.

Verify five points, not just the endpoints

Check the completed calibration at 0%, 25%, 50%, 75%, and 100% of the calibrated span. This catches faults that two endpoint checks miss.

  1. Apply the 0% reference and record the source value, raw PLC value, and calculated engineering value.
  2. Repeat at 25%, 50%, 75%, and 100%.
  3. Calculate the expected engineering value at each fraction p with Yexpected=Y0+p*(Y1-Y0).
  4. Calculate indicated error as the displayed engineering value minus the applied reference.
  5. Compare each error with the project's accuracy limit, including the source, sensor, input channel, and numeric resolution where applicable.
  6. Run the points in the reverse direction when mechanical hysteresis, process lag, or transmitter behavior could make direction matter.

If 0% and 100% pass but 25%, 50%, or 75% fail, recalculating the same line will not repair the fault. Check the reference source, sensor linearity, input stability, filtering, arithmetic data types, and any downstream scaling.

If every point has nearly the same error, inspect Y0, X0, and b. If error grows with the applied value, inspect Y1, X1, and m. If the error changes randomly, stop adjusting coefficients and investigate signal stability.

Return the channel to service deliberately

  1. Save X0, X1, Y0, Y1, m, and b in the approved persistent storage.
  2. Record the reference source, applied points, as-found results, and as-left five-point results.
  3. Exit module calibration mode if it was used and restore the normal channel operating state.
  4. Remove temporary forces, simulation paths, maintenance bypasses, and manual output selections used during the work.
  5. Cycle power when permitted and confirm that the accepted constants remain intact.
  6. Apply one known point after restoration and verify the raw value, scaled value, HMI display, alarms, and dependent control logic.

Restrict CAL LOW and CAL HIGH controls to the operating state and access level defined by the project. An accidental capture during production replaces a known endpoint with a live process value and can shift every subsequent reading.

FAQ

What happens if X1 equals X0 during PLC calibration?

The slope calculation divides by X1-X0, so equal raw endpoints cause division by zero. Reject the calibration, retain the previous coefficients, and check whether the source actually changed or the input is frozen.

What happens if CAL LOW and CAL HIGH are captured backwards?

The formula can produce a negative slope when the raw and engineering pairs are internally matched. If a negative slope was not intended, inspect polarity, source direction, and the values stored as X0, X1, Y0, and Y1 before accepting it.

What happens if both endpoints pass but the midpoint fails?

The line is correct at its anchors, but something between them is nonlinear or calculated incorrectly. Test 25%, 50%, and 75%, then inspect the source, sensor, input stability, integer truncation, filtering, and downstream scaling.

What happens if the raw PLC input remains wrong or unstable?

Stop changing ladder constants after a known source, channel configuration, wiring, loading, and power checks fail to produce a stable raw value. Escalate to the PLC or input-module manufacturer's official support channel when the documented hardware calibration cannot be completed or the channel still fails against a known source. Provide the module identification, configuration, stored endpoints, applied source values, raw readings, and five-point results.

Back to blog