PLC Simulator
Free tool

4–20 mA Scaling Calculator

Convert milliamps to engineering units, raw ADC counts to pressure or temperature, or reverse any of those — with a live formula and a copyable result.

4–20 mA Scaling Calculator

All calculations are client-side. Nothing is sent to a server.

Direction

mA
mA

Formula

EU = 0 + (mA − 4) / 16 × (100 − 0)

Engineering Units

50.000

Worked example

Pressure transmitter: 0–100 bar, 12 mA signal

A pressure transmitter ranges 0–100 bar and outputs 4–20 mA. If the PLC reads 12 mA, what is the actual pressure?

4 mA12 mA20 mA0 bar50 bar100 barEU = 0 + (12 − 4) / 16 × 100 = 50
A 12 mA signal is halfway through the 4–20 mA input span, so it represents 50 bar on a linear 0–100 bar range.
Analog input loop a 4-20 mA scaling calculation runs on: transmitter, analog input card, scaled engineering unitsA 4 to 20 milliamp analog signal from a sensor, read by the analog input card and scaled linearly into engineering units such as degrees Celsius.sensor4-20mAAI cardADC62.5deg C (scaled)10004mA20mAlinear scaling
The full analog signal chain — transmitter to 4-20 mA loop to scaled engineering units in the PLC.

Step-by-step

  1. 1. Span = EU_max − EU_min = 100 − 0 = 100 bar
  2. 2. Current span = mA_max − mA_min = 20 − 4 = 16 mA
  3. 3. Normalised = (12 − 4) / 16 = 0.5
  4. 4. EU = 0 + 0.5 × 100 = 50 bar

Background

What is 4–20 mA and why does scaling matter?

The 4–20 mA current loop is the dominant analogue signal standard in industrial process control. A transmitter (pressure, temperature, flow, level) converts a physical measurement to a proportional current: 4 mA represents the minimum of the measurement range, 20 mA represents the maximum. The 4 mA “live zero” is the feature that makes the standard so robust — a broken wire reads 0 mA, which is unambiguously different from a genuine minimum measurement.

Inside the PLC, the analogue input module converts the 4–20 mA signal to a raw integer via an analogue-to-digital converter (ADC). A 12-bit card produces values from 0 to 4095; a 16-bit card produces 0 to 65535. Your ladder logic or structured text program then scales that integer to an engineering unit (bar, °C, m³/h) using the linear interpolation formula the calculator above implements in real time.

Getting the scaling right matters in three ways: incorrect engineering-unit display misleads operators; incorrect PID setpoint comparison causes process upsets; incorrect alarm limits trigger nuisance trips or, worse, miss real faults. The formula is straightforward but there are two gotchas that catch beginners — using the raw ADC span instead of the mA span, and forgetting to handle the live-zero offset (subtracting 4 before dividing by 16, not dividing by 20).

The general formula

For mA to engineering units: EU = EU_min + (mA − 4) / 16 × (EU_max − EU_min).
For raw ADC counts to engineering units: EU = EU_min + (raw − raw_min) / (raw_max − raw_min) × (EU_max − EU_min).
In IEC 61131-3 Structured Text: EU := EU_min + (REAL(raw) - raw_min) / (raw_max - raw_min) * (EU_max - EU_min);

Fault detection with the live zero

Because 4 mA is the minimum valid signal, most PLCs support configuring analogue input alarms at 3.6 mA (wire break / sensor loss) and 21 mA (over-range / transmitter saturation). When you configure these limits, the PLC sets a status bit you can use in your ladder program to inhibit PID control or trigger an operator alarm before a scaling error propagates into the process.

Where to practice

The simulator’s analogue scenarios — including the 4-20 mA Process Control and Pump Pressure scenarios — require you to write the scaling ladder rung as part of the program. The auto-grader tests both the scaled output value and the fault-detection coil. If the formula above makes sense on paper but breaks down when you implement it, the grader will tell you exactly which test case failed and what it expected.

Loop wiring a 4-20 mA transmitter terminates to a PLC analog input card before scalingA PLC terminal strip wiring view: a switch wired to an input terminal and a lamp wired to an output terminal, with numbered terminals.TERMINAL STRIP0VI0I124VO0O1switchlampfield wiring to numbered terminals
Wiring the loop to the analog input card — before any scaling happens.
Discrete I/O contrasted with the analog 4-20 mA signal the scaling calculator convertsA digital input pushbutton wired to a PLC input card, and a PLC output card driving a lamp, with a sinking versus sourcing hint.I/O CARDINPUTOUTPUTPushbuttonI:0/0LampO:0/0sinking (NPN) vs sourcing (PNP)
Discrete vs analog — scaling only applies to the analog signals.
Modbus link that carries 4-20 mA scaled values as register data to an HMI or SCADAA Modbus master polling three slave devices over a shared serial or TCP link, reading and writing their holding registers and coils.MASTERpolls slavesModbus RTU / TCPID 01regs/coilsID 02regs/coilsID 03regs/coilsrequest / response polling
Once scaled, the value travels to HMI/SCADA over Modbus or EtherNet/IP.
PLC scan cycle that reads and scales the 4-20 mA analog input every scanThe repeating PLC scan cycle: read inputs, execute the ladder logic, update outputs, then housekeeping, looping continuously.1Read Inputs2Execute Logic3Update Outputs4HousekeepingSCANCYCLE
The scan loop reads and scales the analog input on every cycle.

Implementation guide

Scale the value and preserve its quality

Start with the channel contract, not a copied constant. Record the transmitter lower-range value, upper-range value and engineering unit; the analog module’s configured electrical range; the raw counts returned at the bottom and top of that range; and the module status bits. Some modules represent 4–20 mA as 0 to a full-scale integer, while others expose counts aligned to current or use a signed range. The exact module manual is authoritative.

Convert integer counts to a floating-point type before division. Integer division can discard the fraction and make most of the scaled range appear as its lower endpoint. Calculate a normalized value, then apply the engineering span. Keep the unclamped value for diagnostics. Clamping every out-of-range input to a believable minimum or maximum hides under-range, over-range and configuration faults from operators and control logic.

Treat the measurement as a small data structure: value, engineering unit, quality, raw input and timestamp. A PID block or permissive should not consume the numeric value without also knowing whether the channel is healthy. On bad quality, place the process in its documented response—hold, substitute, transfer to manual, alarm or trip according to the risk assessment. A calculator proves arithmetic; it cannot choose that process response.

Analog scaling commissioning record
RecordExampleWhy it matters
Transmitter range0–100 barDefines engineering minimum, maximum and units
Electrical range4–20 mADefines the live-zero input contract
Module raw endpointsVerified from current manualAvoids assuming 0–4095 or 0–65535
Healthy midpoint12 mA = 50 barProves slope and offset together
Fault boundariesModule-specific under/over-range statusSeparates process extremes from channel failure
Bad-quality actionAlarm and inhibit automatic controlMakes failure behavior explicit and testable

Worked checks

Test low, midpoint, high and failure states

A two-point calibration checks the endpoints, but software acceptance should add the midpoint and fault cases. For a 0–100 bar transmitter, prove that the configured raw value for 4 mA yields 0 bar, the value for 12 mA yields 50 bar and the value for 20 mA yields 100 bar within the agreed tolerance. A reversed span such as 100–0 bar should also work because the same interpolation equation permits a negative engineering slope. Use a documented simulator or approved loop calibrator rather than manipulating live process wiring without authorization.

Test values just below and above each endpoint. The calculation may legitimately extrapolate, but the application must flag quality according to the analog module and transmitter specifications. Do not hard-code universal 3.6 mA and 21 mA decisions without confirming the device, input standard and module diagnostic configuration. Distinguish a process value beyond its normal range from a detected wire break, transmitter fault, saturated output or disabled channel.

Finally, power-cycle or restart the test system and verify retained configuration, startup quality and the first valid sample. Trend raw counts, scaled value and quality together while changing the simulated input. The trend should be monotonic for a direct-acting linear range, without sudden discontinuities caused by integer conversion or an incorrect raw endpoint. Save the range, code revision, test values, expected results, observed results and pass/fail decision as commissioning evidence.

Minimum analog scaling test matrix
CaseStimulusExpected numeric resultExpected quality/application result
Lower endpointVerified 4 mA raw countEngineering minimumGood quality
MidpointVerified 12 mA raw count50% of engineering spanGood quality
Upper endpointVerified 20 mA raw countEngineering maximumGood quality
Under-rangeApproved value below valid inputVisible diagnostic value; no silent believable clampUnder-range or bad quality handled
Open-loop/lossApproved loss simulationLast value not presented as currentAlarm and documented control response
RestartConfigured system restartCorrect scaling after first valid sampleStartup state transitions predictably to good

Implementation boundary

This tool performs linear interpolation from the values you enter. It does not identify a module’s raw endpoints, calibrate a transmitter, compensate a nonlinear sensor, validate measurement uncertainty or decide a safe response. Use the current transmitter and analog-input manuals, approved calibration procedure and site risk controls for production work. Practise the logic in the linked analog scenarios, then verify it on authorised equipment with competent supervision.

Now practise it in a real scenario

The 4-20 mA formula makes sense on paper. The grader will tell you if your ladder rung actually implements it correctly.

4-20mA FAQ

Common questions about 4-20mA scaling.

The linear interpolation formula is: EU = EU_min + (mA − 4) / 16 × (EU_max − EU_min). For raw ADC counts: EU = EU_min + (raw − raw_min) / (raw_max − raw_min) × (EU_max − EU_min). The calculator above applies both directions in real time.

Technical reference and worked-example guide

4–20 mA scaling calculator: field reference

Direct answer

The user can record endpoints and units, calculate intermediate values and verify scaling with known test points.

Written for instrumentation and PLC technicians converting loop current or raw counts into engineering units.

System map / 02

NODE 01observable

Definition

Lower and upper current or raw endpoints with engineering range and units.

NODE 02observable

Signal path

Transmitter output through loop current, input raw value and scaled tag.

NODE 03observable

Worked example

Low, midpoint and high calculations checked against known values.

NODE 04observable

Limits

Under-range, over-range, reversed range, rounding and signed data.

NODE 05observable

Common mistake

A wrong input mode, endpoint, unit or wiring assumption.

NODE 06observable

Verification

Documented formula, injected test points and calibration boundary.