IMDHMIControls LibraryShop main store

Analog scaling calculator

Enter the raw range and the engineering range, then a value in either unit, and the page returns the other with the straight-line formula written out. It also converts between a 4-20 mA signal, percent of span and engineering units.

Calculator

This calculator needs JavaScript. Without it, use the formulas under "How it works" and the worked example.

How it works

The relation is a straight line through two points: the raw minimum is the engineering minimum and the raw maximum is the engineering maximum.

engineering = eng_min + (raw - raw_min) × (eng_max - eng_min) / (raw_max - raw_min)
raw         = raw_min + (eng - eng_min) × (raw_max - raw_min) / (eng_max - eng_min)
percent     = (raw - raw_min) / (raw_max - raw_min) × 100

For a 4-20 mA signal these become percent = (mA - 4) / 16 × 100 and mA = 4 + percent / 100 × 16. The percent of span is the same number whichever side you start from, which is why the calculator accepts a raw value, a percent or an engineering value and shows the other two.

The presets only fill in the raw minimum and maximum. The free raw range is for anything else, for example 0 to 65535 counts from a 16-bit converter; which count sits at which end of the signal comes from the device documentation. A reversed range (a minimum larger than the maximum, on either side) is valid and gives a falling line. A range whose minimum equals its maximum has no slope, so it is refused. Nothing is clamped: a value beyond the range is converted by the same line and marked as below 0 % or above 100 % of span.

Worked example

A pressure transmitter outputs 4-20 mA for 0 to 10 bar, and the loop reads 9.6 mA.

  • Fraction of span: (9.6 - 4) / (20 - 4) = 5.6 / 16 = 0.35, which is 35 %.
  • Pressure: 0 + 0.35 × (10 - 0) = 3.5 bar.
  • Back the other way: 4 + (3.5 - 0) × (20 - 4) / (10 - 0) = 4 + 5.6 = 9.6 mA.

The calculator prints these lines with your own numbers: engineering = 0 + (9.6 - 4) × (10 - 0) / (20 - 4) = 3.5

Common mistakes

  • Enter the real ends of the signal. A 4-20 mA signal scaled as if it were 0-20 mA reads 20 % of span at the bottom of the range instead of 0 %.
  • The line is straight. A square-root flow signal from a differential-pressure transmitter, or a thermistor input, needs a further step after this scaling.
  • In integer arithmetic, multiply before you divide, or use REAL numbers. Dividing first throws away the fraction and leaves steps in the result.
  • A current below the low end (under 4 mA on a 4-20 mA loop) usually points to a broken wire or a faulted device, not a negative process value. The levels at which a device flags a fault are set by the device, so check its documentation.
  • The 0 to 27648 preset is the nominal range named in its label. The count at the low end of a 4-20 mA signal depends on the module and its setting, so read the module manual before you rely on it.

Related articles

Other calculators