Free engineering calculators and unit convertersceo@instrumentationblog.in
PLC Digital Signal · Free Calculator

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.

First order filterFilter factor αCutoff frequencyNoisy analog input
ms
s
Filter factor α (weight of new sample)0.0476
Equivalent (1 − α) weight of old value0.9524
Time constant τ2 s
Cutoff frequency0.07958 Hz
Time to 63 % of a step2 s
Time to 99 % of a step9.2 s
How this result was calculated
  1. τ = 2 s
  2. α = Ts ÷ (τ + Ts) = 0.1 ÷ (2 + 0.1) = 0.0476
  3. Each scan: y = y + α × (x − y)
Advertisement

First Order Filter Equations

yn = yn−1 + α × (xn − yn−1)
α = 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.

Key insight: every filter adds lag. On a PID loop, keep the filter time constant well below the process time constant, or the loop must be detuned. Filter noise, not the process.
Advertisement

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.

You May Also Like

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

More PLC Digital Signal Calculators

More Calculator Categories