PLC Analog Input Digital Filter Calculator
Design a first order (exponential) software filter for a noisy PLC analog input. Enter the sample time and either the filter time constant or the cutoff frequency to get the filter factor and its response.
- τ = 2 s
- α = Ts ÷ (τ + Ts) = 0.1 ÷ (2 + 0.1) = 0.0476
- Each scan: y = y + α × (x − y)
First Order Filter Equations
α = Ts ÷ (τ + Ts)
τ = 1 ÷ (2π × fc)
x is the raw input, y the filtered value, Ts the time between filter executions, τ the filter time constant and fc the −3 dB cutoff frequency. The filter must run at a fixed interval (a cyclic or timed task) for τ to be correct.
Worked example
With a 100 ms task and a 2 s time constant, α = 0.1 ÷ 2.1 = 0.0476. A step change reaches 63 % in 2 s and 99 % in about 9.2 s.
Frequently Asked Questions
What does the filter factor mean?
It is the fraction of each new sample added to the output. Small α gives heavy filtering and slow response.
Why must the filter run at a fixed interval?
α is calculated for a set sample time. In a free running scan with varying cycle time, the effective time constant changes.
Should I filter in the transmitter or the PLC?
Use transmitter damping for process noise near the sensor, and a PLC filter for electrical noise. Avoid stacking large filters in both.
Learn more on the blog
Analog input stability and cable length
A practical, field focused guide on instrumentationblog.in that explains the theory behind this calculator and how engineers apply it on real plants.
Read Full Article