Skip to main content
Call Eric:863-698-8266
CURRYCONTROLS.COMControls & Automation Knowledge Hub
ReferenceAnalogPLCSignalsProgramming

Filtering Analog Inputs

How to damp a noisy analog input in the controller without hiding a real process change: the first-order filter, the moving average, the median, where each belongs, and what never to filter.

8 min readUpdated Sep 5, 2026Published Sep 5, 2026By Eric Sullivan

The short answer

Filtering Analog Inputs

A filter trades responsiveness for smoothness. A first-order low-pass filter, one line of arithmetic per scan, removes most of the fuzz on a measurement at the cost of a lag set by its time constant. Choose the time constant so that the lag is small compared to how fast the process can actually change, filter in one place only, and never filter a value used for a safety interlock or a fast alarm. If the signal needs heavy filtering to be usable, the wiring is the problem, not the arithmetic.

Key points

  • A first-order filter is y = y + a(x - y), and the smoothing constant a comes from the scan time and the time constant you want.
  • The lag is the price. A filter that hides a two-second disturbance also delays a two-second real change.
  • A median filter kills single-scan spikes without lag; a moving average smooths but delays; combine them for spiky, noisy signals.
  • Filter once, in the controller or the module, and say where in the documentation.
  • Interlocks, trips, and fast alarms read the unfiltered value.

Why the signal is noisy

Before filtering anything, ask where the noise comes from. Induced noise from a drive cable, a ground loop, or a loop running out of voltage are wiring problems and the pages on those subjects fix them at the source. Turbulence at a level probe or pulsation at a pressure tap is real process movement that a filter legitimately smooths. A filter applied to a wiring problem hides the symptom and leaves the cause to get worse.

The first-order filter

The workhorse is the exponential, or first-order low-pass, filter. Each scan the filtered value moves a fraction of the way from where it was toward the new reading.

y = y + a x (x - y)

  • x is the new raw reading this scan
  • y is the filtered value, carried from the previous scan
  • a is the smoothing constant between 0 and 1, computed as dt / (T + dt)
  • dt is the scan or task period and T is the filter time constant, in the same units

The time constant T is the tuning knob. After a step change in the input, the filtered value reaches about 63 percent of the change in one time constant and about 95 percent in three. A time constant of two seconds means a real change is mostly visible after six seconds. Choose it from how fast the process can genuinely change, not from how smooth you want the trend to look.

Other filters

Moving average
The mean of the last N readings. Smooths evenly, delays by about half the window, and costs N words of memory. It is what a chart recorder does, and it is fine for slow signals, but the first-order filter does the same job with less memory and a cleaner response.
Median
The middle value of the last three or five readings. A single-scan spike from a radio burst or a relay switching never makes it through, and there is almost no lag. It does nothing for continuous fuzz. Put it ahead of a first-order filter on a signal that has both spikes and noise.
Rate limit
Clamps how far the value can move per scan. Useful where a physical quantity cannot change faster than a known rate, dangerous where it can, because it hides a genuine fast event.
Module hardware filter
Most analog modules offer an input filter or an integration time, often set to reject 50 or 60 Hz. It is applied before the count reaches the program and it is the right place to handle mains-frequency pickup. It adds lag like any other filter, and it is easy to forget it is there.

Where to filter and where not to

UseFiltered?Why
Operator display and trendYesA steady number is easier to read and the lag does not matter
PID measurementLightlyNoise in the measurement drives the output through the derivative and proportional terms; a small time constant helps, a large one destabilizes the loop
TotalizerYes, lightlyNoise averages out over the total anyway, so a light filter changes little
Level start and stop setpointsYes, with deadbandPrevents chatter around the setpoint; the deadband page covers the pairing
High and low alarmsDepends on the alarmA nuisance alarm from noise wants a filter or a delay; an alarm that must catch a fast event wants neither
Safety interlock or tripNoThe lag delays the trip. Use the raw value and a hardwired device where the consequence is serious
What reads the filtered value

One filter, documented

The failure mode of filtering is not too little; it is too much, in too many places. The transmitter has a damping setting. The module has a hardware filter. The program has a first-order filter. The SCADA tag has a deadband and a smoothing option. Each was added by a different person to fix a symptom, and together they turn a real change into a slow drift that arrives a minute late. Decide where the filter lives, set the others to zero, and write the time constant into the narrative beside the tag.

Frequently asked questions

What time constant should I use?
Short enough that the lag is small compared with the fastest change the process can make, and long enough to remove the noise. A level in a wet well can take several seconds. A pressure loop on a pump takes a fraction of a second or none. Start small and lengthen only as far as needed.
Should I filter the input to a PID loop?
Lightly, if the measurement is noisy, because noise reaches the output through the proportional and derivative terms. A heavy filter adds lag inside the loop and makes it unstable. Fix the noise at the source first.
Where does the transmitter damping setting fit in?
It is a filter in the transmitter, applied before the signal leaves the field. It is one of the places a filter can live, and it should be the only one if it is used. Note it on the instrument data sheet.
How do I remove single spikes without adding lag?
A median filter over three or five readings. A single bad reading is never the middle value, so it never reaches the output, and the response to a real change is delayed by one or two scans only.

Direct contact

Have a controls question?

Reach Eric Sullivan directly about anything on this site, a controls or automation topic, or one of his personal projects.