Free Tool

Free 4-20mA & 0-10V Analog Scaling Calculator

Convert raw PLC counts to engineering units in seconds. Pick your platform (Siemens, Allen-Bradley, Beckhoff, CODESYS), enter the signal range and EU range, and get the slope, offset and ready-to-paste PLC code — with NAMUR NE43 fault thresholds and a transfer-function chart.

Analog scaling calculator showing slope, offset, NAMUR thresholds and generated Siemens SCL code

Slope, Offset & PLC Code — In One Click

📏

Raw Counts ↔ Engineering Units

Linear conversion between raw module counts and PSI, °C, bar, %, GPM — whatever your tag uses. Inverted (fail-safe) signals supported.

🔁

4-20mA, 0-10V, ±10V & More

Nine standard signal types covered, with custom ranges for non-standard sensors and the unusual 1-5V live-zero loops.

🛡️

NAMUR NE43 Fault Detection

Automatic fault (3.6 mA) and warning (3.8 mA / 20.5 mA / 21 mA) thresholds for broken-loop detection — visualised on the transfer-function chart.

🧮

Transparent Slope & Offset

See the exact m and b values plus the formula EU = m × raw + b. Resolution and counts-per-EU shown alongside.

🧩

Generates PLC Code

Siemens SCL with NORM_X / SCALE_X, Allen-Bradley Structured Text, Beckhoff TwinCAT, CODESYS — paste straight into your project.

🔐

Runs Locally

Browser-only, no signup, no server, no upload. Works offline once loaded. Share configurations with a copy-able URL.

Built for PLC Commissioning

Platform Presets — Siemens, Allen-Bradley, Beckhoff, CODESYS

Pick your PLC and the raw-count ranges fill in automatically: Siemens S7 (0–27648), Allen-Bradley ControlLogix (3277–16384 for 4-20mA), Beckhoff TwinCAT (0–32767), AB PLC-5/SLC-500 legacy, and a custom platform for anything else.

  • Siemens S7-300/400/1200/1500 — SM331 / AI modules, 0-27648 range
  • Allen-Bradley ControlLogix / CompactLogix — 1756-IF8, 1769-IF4
  • Allen-Bradley PLC-5 / SLC-500 — legacy 0-16383 range
  • Beckhoff TwinCAT — 0-32767 / ±32768 ranges
  • CODESYS, custom & manual range entry
PLC platform selector with Siemens, Allen-Bradley, Beckhoff and CODESYS presets

NAMUR NE43 Fault Detection & Transfer-Function Chart

For 4-20mA loops the calculator computes the NAMUR NE43 fault (3.6 mA / 21 mA) and warning (3.8 mA / 20.5 mA) thresholds in raw counts and engineering units, and highlights the valid / warning / fault zones on the transfer-function chart.

  • Fault thresholds in raw counts and EU
  • Valid range, warning low/high, fault low/high
  • Live status: OK / Warning / Fault on the converter
  • Annotated zones on the linear transfer-function chart
NAMUR NE43 threshold table with raw and EU values plus annotated chart

Code Generation — SCL, Structured Text, CODESYS

Once the math is locked in, hit Copy or Download to get a ready-to-paste code block in your platform's language: Siemens SCL using NORM_X / SCALE_X, Allen-Bradley Structured Text with SCP-style scaling, Beckhoff function blocks, CODESYS — all with NAMUR fault handling stubbed in if enabled.

  • Siemens SCL — NORM_X + SCALE_X with tag names
  • Allen-Bradley Structured Text — SCP-style scaling
  • Beckhoff TwinCAT 3 function blocks
  • CODESYS ST
  • Copy to clipboard or download as .scl / .st / .iecst
Generated Siemens SCL scaling code with NORM_X and SCALE_X

Analog Scaling FAQ

Linear scaling: EU = (raw − raw_min) × (EU_max − EU_min) ÷ (raw_max − raw_min) + EU_min.

Or equivalently EU = m × raw + b with:
• slope m = (EU_max − EU_min) ÷ (raw_max − raw_min)
• offset b = EU_min − m × raw_min

For Siemens S7 the raw range is 0–27648, for Allen-Bradley ControlLogix at 4-20mA it is 3277–16384, for Beckhoff TwinCAT it is 0–32767. Plug those into the formula and you get the slope/offset to drop into NORM_X/SCALE_X or SCP.
On Siemens S7-300/400/1200/1500 with standard analog modules (SM331, AI modules), 4 mA = 0 counts and 20 mA = 27648 counts. For 0–10 V it is the same 0–27648 range. ±10 V uses ±27648. Higher than 27648 is the overflow / over-range area used by the diagnostic block. The calculator picks these automatically when you choose the Siemens preset.
On 1756-IF8 / 1769-IF4 modules with default scaling, 4 mA = 3277 raw counts and 20 mA = 16384 raw counts. The classic SCP block does the same conversion as the EU formula above. Studio 5000 Structured Text usually does it inline: EU := (Raw - 3277) * (EUMax - EUMin) / (16384 - 3277) + EUMin;.
NAMUR NE43 is the de-facto standard for broken-loop and fault detection on 4-20mA transmitters. The standard reserves < 3.6 mA for low fault (wire break), 3.6–3.8 mA as low warning, 3.8–20.5 mA as the valid range, 20.5–21 mA as high warning, and > 21 mA as high fault (short or sensor failure).

With NE43 enabled, this calculator shows the threshold counts and highlights the zones on the transfer-function chart so your PLC logic stays consistent across projects.
Exactly like 4-20mA, except the signal range is 0–10 V instead of 4–20 mA, and there is no live zero so broken-loop detection does not apply.

On Siemens the raw range is still 0–27648 (0 V = 0, 10 V = 27648). On Allen-Bradley ControlLogix 0–10 V maps to 0–32767. Pick "0-10V" as the signal type in the calculator and the raw range fills in for your platform.
The usual suspects, in order of likelihood:

1. Wrong raw range — 0–32767 (Beckhoff) vs 0–27648 (Siemens) vs 3277–16384 (AB 4-20mA) are easy to mix up.
2. Clamping before scaling — if you limit the raw value to 0–27648 before scaling, you lose NAMUR diagnostic information.
3. Integer overflow — slope and offset on small integer types overflow; use REAL/FLOAT for the math.
4. Inverted signal — for fail-safe loops a wire break should park the value at min, not max. Use the inverted option.
5. Filter / debounce settings on the AI module can mask the symptom you are seeing on the screen.
2-wire (loop-powered): the transmitter is powered by the same two wires that carry the 4-20mA signal — the 4 mA "live zero" is the operating current of the sensor itself. Most pressure, temperature and level transmitters are 2-wire.

4-wire (separately powered): two wires for power (24 VDC, 120 VAC), two for signal. Used when the sensor needs more current than the loop can supply — flow meters, gas detectors, some pH analysers. Scaling math is the same either way; only the wiring differs.
Yes, when you enable NAMUR. The generated block computes the EU value and a fault flag with the standard < 3.6 mA / > 21 mA thresholds. For Siemens that is a wrapper around NORM_X / SCALE_X with a status output. For Allen-Bradley Structured Text it is the inline formula plus a fault BOOL. Drop the tag name in and the code is ready to paste into your tag table.
Yes — every change updates a URL you can copy. The URL encodes platform, signal type, raw range, EU range, units, decimals, NAMUR and the tag name, so opening the link reproduces the exact configuration. Useful for handing over commissioning notes or grabbing the same scaling from another machine.
Yes. Toggle "Inverted (fail-safe)" and the slope flips so 4 mA = EU_max and 20 mA = EU_min. Useful for level transmitters where a broken loop should report "tank full" instead of "tank empty", and for fail-safe valve position feedback.
No. The calculator runs entirely in your browser. Nothing is uploaded — no platform names, tag names, generated code or configurations. Works offline after the first page load.
Puida Oy builds free professional tools for industrial automation engineers. Questions or feature requests? Email hello@puida.com — we add platforms and signal types based on user requests.

Get Your Analog Scaling Right the First Time

Free. Generates PLC code. NAMUR NE43 built in. No signup.

Open Scaling Calculator