Signal conditioning in the PLC: debounce, filtering, validity
Practical handling of raw signals before they reach control logic: debouncing contacts, filtering noisy analog values, validity checks and substitute values.
Debouncing digital inputs
Mechanical contacts bounce for a few milliseconds; level switches flicker on waves. Use an on/off delay:
tOn (IN := RawLevelHigh, PT := T#2S);
tOff(IN := NOT RawLevelHigh, PT := T#2S);
IF tOn.Q THEN LevelHigh := TRUE; ELSIF tOff.Q THEN LevelHigh := FALSE; END_IF;
Many input modules also have configurable hardware input delays (e.g. 3 ms) — enough for contact bounce, not for waves.
Filtering analog values
First-order (exponential) filter, executed in a constant-time task:
(* Tf = time constant, Ts = task cycle time *)
Alpha := Ts / (Tf + Ts);
Filtered := Filtered + Alpha * (Raw - Filtered);
Filtering adds delay — do not filter a signal used in a fast control loop more than necessary, and never filter a value for a safety function. Analog modules usually offer hardware smoothing too.
Validity before use
| Check | Example |
|---|---|
| Module status / overflow codes | Siemens 32767 / −32768 → invalid |
| NE 43 failure currents | ≤ 3.6 mA or ≥ 21 mA → sensor failure |
| Range | Pressure below −1 bar(g) is impossible |
| Rate of change | Level cannot jump 2 m in one second |
| Redundant comparison | Two transmitters differ by more than tolerance |
Carry a quality bit with every important value, show it on the HMI, and decide what the logic does when the value is bad: hold last value, use a substitute value, stop the equipment.
Connections
Open in Knowledge Graph →Loading the map…
Sources
Updated 2026-10-02