Analog Scaling Calculator

A 4–20 mA or 0–10 V raw value to the sensor's engineering units: gain and offset from the signal range, or from two readings.

Scaling
shown with every value

Measured points

Raw value
Value
Point 1
raw
Point 2
raw
three or more give the best-fit line

From the signal range

Raw range
Low end
High end
Signal
Raw value
raw
raw
Value

Check a point
Raw value
Value
Check
raw
—
Measured
same raw value

—

Target
—
Signal
—
at the checked raw value
Use the measured point as
Results

Analog scaling in a PLC: 4–20 mA and 0–10 V

A 4–20 mA or 0–10 V signal reaches the PLC as a raw integer: 0–27648 on Siemens, 0–32767 or 0–4095 on others. Scaling maps the raw value at the low end of the signal to the sensor's lower range value and the raw value at the high end to its upper one; every reading in between lies on the straight line. The page takes the four ends (raw low and high, value low and high) and gives the gain and offset, the value per mA or per volt, and the raw units per mA, which says how much of the input's resolution the sensor range actually uses.

This is what NORM_X and SCALE_X do in TIA Portal, SCP or SCL on a Rockwell controller, and a one-line expression in Codesys. A transmitter whose range does not start at zero (2–10 bar, −20…60 °C) has an offset; one that starts at zero has none. Type the sensor's unit in the value unit field and every result carries it.

The check point is the commissioning test: put a known pressure or temperature on the sensor, read the raw value, and the deviation from the line shows whether the transmitter's range and the module's ends match. A raw value below the 4 mA end means an open wire or a dead transmitter; above the 20 mA end, a short or an overrange.

How it works

Every scaling here is one straight line: value = gain × raw + offset. Two measured points fix it: gain = (value₂ − value₁) / (raw₂ − raw₁) and offset = value₁ − gain × raw₁. The gain is the scaling factor a PLC or NC axis asks for, and 1 / gain is the same thing the other way round: counts per millimetre, hertz per metre a minute.

Measured more than twice? Add up to eight points and the line becomes the least-squares fit: the one with the smallest sum of squared distances to every point. Each point then shows its residual, how far it was measured off the line; one that stands out from the rest is usually a misread or a point taken while the axis was still moving.

Worked example. An encoder reads 0 at the home position and 100 000 counts 2500 mm further on. gain = 2500 / 100000 = 0.025 mm per count, 40 counts per millimetre, offset 0. The encoder itself says the same: 1000 pulses per turn, read ×4, on a 100 mm feed, is 100 / 4000 = 0.025 mm.

Measured points define the line whenever they are filled in. The mechanics give the theoretical line: on its own it is the line, next to measured points it is the dashed comparison, and the measured one is divided by it. A factor of 0.97 means the belt runs 3 % slower than the motor and roller say it should. Each scaling has its own theory.

Encoder counts

feed ÷ (PPR × evaluation × ratio)

Position per count from the pulses per turn, the ×1/×2/×4 evaluation, the feed per turn and the gear ratio. Also the pulse rate at top speed, to check the input terminal.

Show this example

Drive frequency

n ÷ f ÷ i × π × D

Speed per hertz from the motor's rated speed at its rated frequency, the gearbox ratio and the roller diameter. Measured below it: slip.

Show this example

Speed setpoint

π × D ÷ i

Speed per setpoint turn from the gearbox and the roller: the effective feed constant of the axis.

Show this example

Analog input

raw range → value range

A 4–20 mA or 0–10 V signal arrives as a raw integer, 0–27648 or 0–32767. Map its ends to the sensor's range and read any value in between.

Show this example

Check a point looks up any raw value on the line, or slides along it. Type what you measured there and the difference is shown, as a value and a percentage; if that point is the better one, make it point 1 or 2 and the line moves through it, or add it as a new point. A target value gives the raw value that reaches it: the frequency for a conveyor speed, the count for a position.

The offset is where the line crosses zero. For an encoder it is the reference position; for a drive it should be 0, and a line that does not pass through zero points to a minimum frequency, a dead band or a measuring error.

Questions

What is the 4–20 mA scaling formula?

value = (raw − raw low) × (value high − value low) / (raw high − raw low) + value low. For a 0–10 bar transmitter on a Siemens input, 0–27648 across 4–20 mA: bar = raw × 10 / 27648, so a raw value of 13824 reads 5.0 bar. As a line, the gain is 10 / 27648 = 0.000362 bar per raw unit and the offset is 0; a transmitter that spans 2–10 bar gives a gain of 8 / 27648 and an offset of 2.

Why is the raw value 0–27648 on Siemens but 0–32767 elsewhere?

Siemens S7 inputs map the nominal range, 4–20 mA or 0–10 V, to 0–27648 and keep 27649–32767 as overrange, so a reading above 27648 means the signal is past 20 mA. Other vendors map the nominal range to the full 0–32767, a 12-bit input gives 0–4095, and some modules deliver engineering units directly. Use the raw ends from the module manual; the presets on this page cover the common ones.

How do I detect a broken wire on a 4–20 mA loop?

A live loop never falls below 4 mA, so a raw value under the 4 mA end (negative on a Siemens 0–27648 input) means an open wire or a dead transmitter, and a value above the 20 mA end means a short or an overrange. Compare the raw value with its ends before trusting the scaled result; most modules can also raise a wire-break diagnostic at about 3.6 mA, the NAMUR fault level.

How do I scale a 0–10 V signal?

The same line: map the raw value at 0 V to the lower range value and the raw value at 10 V to the upper one. With no live zero a broken wire reads as a valid 0 V, which is why 4–20 mA is preferred wherever a fault must be noticed. Pick the voltage signal on this page and the ends switch to 0 and 10 V, with the value per volt shown next to the gain.

Which PLC instruction does the scaling: NORM_X and SCALE_X, SCL, SCP?

Siemens TIA Portal uses NORM_X (raw to 0.0–1.0) followed by SCALE_X (0.0–1.0 to the engineering range), or FC105 SCALE in classic STEP 7; Rockwell uses SCP on MicroLogix and SLC and SCL or a CPT expression on Logix; Codesys and most others a plain linear expression. All of them take the four numbers on this page, raw low, raw high, value low and value high; the gain and offset are the same line written as y = a·x + b.

What resolution does a 4–20 mA input give?

Value span / raw span: 10 bar over 27648 steps is 0.00036 bar per step, with 1728 raw units per mA. On a 12-bit input (0–4095) the same transmitter resolves 0.0024 bar. The page shows the value per mA and the raw units per mA next to the gain, which tells you how much of the input's range the sensor actually uses.

Need saved scalings and PDF export?

View Plans