PLC Simulator
PLC field notespid

Analog I/O and PID Tuning: The 90% Method That Works on Most Loops

A practical guide to analog I/O (4–20 mA, 0–10 V) and PID tuning for PLC programmers. Covers scaling, the three PID terms in plain English, and a step-by-step tuning method that works on 90% of loops without Ziegler-Nichols wizardry.

PLC Simulation Software10 min read

Analog I/O and PID tuning — the 90% method

Most PLC engineers find PID loops intimidating. The textbooks make them worse with Ziegler-Nichols tables, derivative kick, integral windup, and dozens of pages of equations. In practice, 90% of PID loops in the field can be tuned to good-enough performance using a method that fits on one page. This post is that method.

We'll also cover the analog I/O chain — how a 4–20 mA signal becomes a number your ladder code can use — because PID without scaling is just theatre. If you want the fundamentals refresher first, our PID control for PLCs post goes deeper on what the terms mean.

The analog chain, end to end

From sensor to smooth control

Every analog control loop is five steps:

  1. Sensor — a transmitter outputs 4–20 mA (industrial standard) or 0–10 V (machinery standard). Pressure, temperature, level, flow, position.
  2. Scaling — your PLC's analog input module converts mA or V to a 16-bit integer (usually 0–27648 for Siemens, 0–32767 for Rockwell, vendor-specific). Your ladder scales that to engineering units.
  3. PID compute — the PID block reads the scaled process variable (PV), compares to the setpoint (SP), and writes an output (0–100 % or scaled).
  4. Output scaling — that output is converted back to the analog output module's integer range and driven to the actuator (valve, VFD, heater).
  5. Actuator — the physical change that affects the process.

Miss any step and your loop behaves badly. Over-scale and PID thinks the PV is saturated when it's only 60%. Under-scale and the derivative term goes wild.

The scaling rung in plain terms

A 4–20 mA transmitter measuring 0–100 °C. For more worked examples of reading and scaling analog inputs in ladder logic, see analog input PLC examples.

raw_input ∈ 0..27648   (Siemens SM1231 convention)
4 mA → raw = 5530
20 mA → raw = 27648
span_raw = 27648 - 5530 = 22118
span_eu = 100 - 0 = 100

PV_in_EU := (raw_input - 5530) * 100 / 22118

Write that once in a scaling function block, call it for every analog input, and you're done. Never retype the magic numbers.

PID in plain English

Three terms. None of them are scary on their own.

  • P (Proportional) — "how far off are we?" Bigger error → bigger corrective output. If the tank is 10 °C below setpoint, open the steam valve wider.
  • I (Integral) — "how long have we been off?" Small persistent error → slowly bigger output. Corrects for steady-state offset that P alone can't fix.
  • D (Derivative) — "how fast is the error changing?" Rapid change → damping output. Prevents overshoot on fast loops; amplifies noise on slow loops. Often turned off.

In ladder logic, every vendor gives you a PID function block with these three as parameters: Kp, Ki (or Ti), Kd (or Td). You set them, the block does the math.

When PID isn't the right tool

Bang-bang vs PID — when each wins

Simple on-off (bang-bang) control is often better than PID for:

  • Water heaters with big tanks — oscillation is fine, PID is overkill.
  • Cabin heaters in HVAC where setpoint drift of ±1 °C doesn't matter.
  • Relay-driven systems that can't cycle faster than once every 30 seconds.

Reserve PID for:

  • Analog actuators — modulating valves, VFDs, SCRs, servo drives.
  • Loops where overshoot matters — temperature loops on chemical reactions, pressure loops on regulators.
  • Loops where ripple matters — pressure control in process systems, level control in tank blending.

If your actuator is a contactor or a solenoid, use on-off. If it's a valve or VFD, use PID.

The 90% tuning method

The 90% tuning method (no Ziegler-Nichols drama)

Step by step, for the vast majority of temperature, level, flow, and pressure loops:

  1. Set P only. Start with Ki and Kd at 0. Pick a small Kp — 0.1 is a reasonable start for most loops.
  2. Ramp up P. Double Kp every 30 seconds (or every 2–3 settling times for slow loops) while making step changes to the setpoint. Watch the PV response.
  3. Stop when it oscillates. When the PV starts swinging back and forth around the setpoint, you've found the critical gain. Note the period of the oscillation — this is Tc, typically 10–60 seconds for temperature loops, 1–5 seconds for fast pressure loops.
  4. Halve the Kp. That's your operating P. The loop is now stable but sluggish, with steady-state offset.
  5. Add I with Ti = Tc. Set the integral time to roughly the period of oscillation. The loop now eliminates steady-state offset.
  6. Leave D at zero unless you see unacceptable overshoot on step response. If you add D, start at Td = Tc / 8 and increase cautiously.
  7. Test. Do a 10% setpoint change. Good tune: reaches setpoint in 2–3 settling times, less than 10% overshoot. If not, adjust Ki or Kd slightly.
  8. Lock in the gains. Write them down. Add a comment in the PID block noting the tuning date and who did it.

That's the whole method. It won't beat a control engineer with proper step-response identification tools, but it'll get you 90% of the way in an afternoon.

Avoiding the classic PID traps

Five things that bite newcomers:

  1. Integral windup. If your output saturates (valve fully open) and error persists, the integral keeps accumulating. When error finally reverses, the loop overshoots wildly. Cure: use vendor's anti-windup feature (all modern PID blocks have one).
  2. Derivative kick on setpoint changes. If D acts on error, a step setpoint change produces a huge derivative spike. Cure: use "D on PV only" configuration (standard on modern blocks).
  3. Scan time too slow. If your scan is 100 ms and your loop period is 1 second, you've got only 10 samples per cycle. Marginal. Move PID to a faster task or shorten your scan.
  4. Noisy PV. A shaky sensor reading amplifies D wildly. Cure: filter the PV (first-order lag, 0.1–0.5 seconds) before feeding it to the PID block.
  5. Tuning with the wrong process. If you tune a water-heating loop with the tank empty, the gains won't fit the real load. Tune with the real process running.

PID in IEC, Rockwell, Siemens

Same math, slightly different parameter names:

  • IEC 61131-3 — PID function block, parameters CTRL_MODE, SP_INT, PV_IN, LMN_PER (output), tuning via GAIN, TI, TD.
  • Rockwell Studio 5000 — PIDE (Enhanced PID) function block. Parameters Kp, Ki, Kd. Auto-tune feature built in.
  • Siemens TIA Portal — PID_Compact (for S7-1200) or PID_3Step (for S7-1500). Auto-tune modes called "Pretuning" and "Fine-tuning."

Our PID Temperature scenario is a browser playground for this method — tune it until the loop settles smoothly, then port the gains to real hardware.

FAQ

Is PID hard to tune?

The 90% method above is not. Ziegler-Nichols is. Most engineers who say PID is hard were taught via Z-N without seeing the simpler iterative approach.

Do I need to learn the math?

No. You need intuition for what each term does (see "PID in plain English" above) and a systematic tuning method. The math is optional.

What's the best PID tuning software?

For most loops: none. The 90% method works with a stopwatch and the PLC's online view. For tricky loops: ExperTune PlantTriage, Matrikon Process Doctor, or vendor-specific auto-tune features.

How long does PID tuning take?

30 minutes per loop for the 90% method. 4 hours per loop if you want a professional-quality tune with step-response identification.

Do modern PLCs auto-tune PID?

Siemens PID_Compact and Rockwell PIDE both offer auto-tune. They work for about 70% of loops and are a good starting point for the other 30%.

Where to start

  1. Open our PID Temperature scenario. Pro tier.
  2. Start with Kp = 0.1, Ki = 0, Kd = 0.
  3. Follow the eight steps above.
  4. When the loop settles cleanly, port the gains to a real PID block in Studio 5000, TIA Portal, or whatever IDE your target job uses.

Eight steps, thirty minutes, one dominant practical skill. That's PID on a PLC.

ShareX / TwitterLinkedIn

From reading to running logic

Practice this yourself in the simulator

Start with guided PLC practice in your browser. No install and no credit card required.

Start practising free

Continue learning

Related field notes

All articles
pid
analog

PID Control for PLCs: Practical Tuning Guide

Learn how PID controllers work in PLCs: proportional, integral, and derivative terms explained. Includes practical tuning methods and IEC 61131-3 code examples.

11 min read
tutorial
examples

PLC Temperature Control with a Ladder Diagram (On/Off and PID)

How PLC temperature control works, from the RTD or thermocouple input to the heater output. A worked temperature control using PLC ladder diagram, on/off vs PID, hysteresis, and a control-logic flowchart.

8 min read
tutorial
examples

PLC Pump Control Logic: Duty/Standby and Lead-Lag (Ladder Examples)

Pump control logic in a PLC explained with ladder diagrams. Start/stop on level, seal-in rungs, duty standby alternation, lead lag pump control and automatic fault changeover — with state, timing and architecture diagrams.

9 min read

Technical reference and worked-example guide

Analog I/O and PID tuning guide: field reference

Direct answer

The reader can prove the measurement and final-control path before tuning and can evaluate setpoint response, disturbance rejection, saturation and recovery with trends.

Written for pLC and process-control learners connecting transmitter range, input scaling, sample behavior and output actuation to safe, evidence-led PID tuning.

an instrumentation diagnostics bench connecting pressure, temperature and smart transmitters to isolated analog channels and time-aligned trend evidence while studying analog measurement quality and PID tuning evidence
System map / 02

NODE 01observable

Definition

Process objective, PV range and unit, sensor and transmitter dynamics, input scaling, sample and filter, controller direction, output limits, actuator response, mode transfer, tuning method and acceptance metrics.

NODE 02observable

Signal path

Process condition through sensor, transmitter, analog input, scaled PV, PID calculation, bounded output, final control element, process response and independent trend evidence.

NODE 03observable

Worked example

A small approved test produces coherent PV and output trends and the loop meets declared response and steady-state criteria without saturation.

NODE 04observable

Limits

Wrong direction, noisy PV, bad scaling, dead time, actuator stiction, output saturation, integral windup, manual-auto transfer, sensor failure and restart.

NODE 05observable

Common mistake

A process, sensor, loop, input, scaling, sample, controller, tuning, output, actuator or acceptance mismatch.

NODE 06observable

Verification

The loop tuned and validated on the target controller and process under approved operating limits and rollback procedures.

Answer surface / 07

Should I tune PID before checking analog scaling?

No. Prove sensor range, loop signal, raw input, engineering units, controller direction and final-element response before changing tuning constants.

What data is useful for PID tuning?

Trend timestamped setpoint, process value, controller output, mode, limits and relevant disturbances at a rate that exposes the process dynamics.