Position and Liquid-Level Sensing

Rotary Sensor Filtering: Joint Noise and Angular-Lag Limits

Choose rotary position-sensor smoothing parameters from simultaneous noise, angular-lag and settling requirements, with discrete calculations and timed verification.

Send Drawings7 min read
High-resolution industrial engineering scene showing substrate metrology in a clean thick-film ceramic circuit context.
Engineering illustration; not a product photograph or a test result.
On this page

A smooth rotary-sensor display can be late even when its stationary output looks precise. A causal filter combines present and previous samples, so it trades random fluctuation against information age. Selecting that filter requires a joint calculation: how much stationary noise is allowed, how fast the shaft can move, and how much delayed angle the application can tolerate. The useful result is a feasible parameter interval, or a clear finding that smoothing alone cannot meet both requirements.

Key design decisions

  • Express the allowed filter contribution in degrees at the stated shaft speed, separately from static curve error and mechanical backlash.
  • Calculate noise reduction and motion lag for the exact discrete algorithm, including its initialization and sampling interval.
  • Retain an appropriately designed diagnostic path so a polished position signal does not conceal a short contact interruption.

Separate a smoothing requirement from the sensor accuracy budget

Define the signal entering the software filter: raw voltage, normalized voltage ratio, or calibrated angle. The calculations here use angle samples on a continuous local branch of the transfer curve. They assume that electrical loading and the static angle conversion have already been reviewed. Averaging cannot correct an incorrect transfer law, a shifted pivot, or a worn contact that changes the underlying signal.

Record three separate limits: stationary output noise, error during sustained motion, and time to respond to a sudden change. A maximum shaft speed is necessary for a motion-lag calculation, but acceleration and reversal tests remain necessary when the mechanism does not move at constant speed. Reserve additional timing budget for conversion, communications and controller execution; the software smoother is only one part of total information age.

Write the recursion before assigning a time constant

Consider the causal recursion y[k] = a x[k] + (1 − a)y[k−1], where x is the new angle sample and y is the filtered result. The current-sample weight a lies above zero and at or below one. A smaller value places more weight on older information. Specify this convention explicitly because some software packages instead name the previous-state weight as their coefficient.

For a constant input after a step, the remaining error after m updates is the initial error multiplied by (1 − a)^m. With an assumed one-millisecond sampling interval and a = 0.20, reaching a residual at or below two percent requires 18 updates. Define update counting from the last old-state output; the first new sample is update one. A continuous-time label alone can hide this timing convention.

y[k] = a x[k] + (1 − a)y[k−1]; |e[m]/e[0]| = (1 − a)^m

  • x[k], y[k]: current input and filtered angle in degrees on a continuous local branch.
  • a: dimensionless current-sample weight, 0 < a ≤ 1.
  • m: number of updates since the last old-state output; Ts: uniform sampling interval in seconds.

The coefficient remains fixed, the step remains constant, the arithmetic is not saturated, and no samples are missing.

Convert the steady ramp error into angular lag

For an input increasing by the same angle increment each sample, substituting a ramp into the recursion gives a steady error of angular speed multiplied by Ts(1 − a)/a. This is a constant-speed result after the startup transient has decayed. It is not the same as the time required to settle after a step, and it should not be substituted for the delay of an arbitrary waveform.

Assume a shaft speed of 120 degrees per second and Ts = 0.001 second. The steady angular lag is 1.08 degrees at a = 0.10, 0.48 degree at a = 0.20, and 0.36 degree at a = 0.25. If only 0.60 degree is available for this filter, the coefficient must be at least one sixth. The speed and error allocations are illustrative, not ratings for a sensor card.

Intersect the noise and lag constraints

For independent, zero-mean input noise of constant variance, the settled output standard deviation is the input standard deviation multiplied by sqrt(a/(2 − a)). This follows by summing the squared impulse-response weights. It is not a general promise for contact chatter, periodic interference, slow drift or already correlated converter output. Use stationary records to determine whether the independent-noise approximation is appropriate.

Assume the input standard deviation is 0.30 degree and the required filtered value is at most 0.09 degree. The noise inequality requires a ≤ 0.16514. The preceding angular-lag requirement requires a ≥ 0.16667. There is no shared interval: choosing an attractive coefficient between the two would quietly violate a requirement. If the noise allocation were instead 0.10 degree, the upper bound would be 0.20, leaving a feasible range from one sixth to 0.20. Changing that allocation requires an explicit system decision.

Compare a finite moving window under the same assumptions

An N-sample trailing arithmetic mean assigns equal weight to the current sample and the previous N−1 samples. For steady constant-speed motion, its angular lag is speed multiplied by (N−1)Ts/2. Independent stationary noise is reduced by sqrt(N). Comparing those two expressions avoids selecting a window solely because a graph appears quieter.

With the same speed and sampling interval, a 0.60-degree lag allocation permits N at most 11. Reducing 0.30-degree input noise to 0.09 degree requires N at least 12, so this alternative also fails that pair of assumptions. At a 0.10-degree target, N = 9 gives 0.48-degree lag and exactly 0.10-degree predicted noise. These calculations do not establish rejection of a particular interference frequency, and a digital average cannot undo aliasing that occurred before acquisition.

Illustrative coefficient comparison at a one-millisecond update interval
Current-sample weight aSteady lag at 120 degrees/sNoise from 0.30-degree independent inputUpdates to at most 2% step residual
0.101.08 degrees0.0688 degree rms38
0.200.48 degree0.1000 degree rms18
0.250.36 degree0.1134 degree rms14

Control startup, wrapping and missing samples

Initializing the filter to zero creates a false transient when the mechanism starts elsewhere. Initializing to the first valid sample avoids that particular jump but leaves the early noise distribution different from the settled prediction. Define when the result is valid, what resets the state, and how a disconnection differs from an ordinary startup. Do not carry a stale filter state across an unrecorded mechanical movement.

For a limited-angle resistive card, preserve the actual end zones rather than assuming unlimited rotation. If software expresses an otherwise continuous position across a numerical wrap boundary, resolve that representation before averaging; values near 359 and 1 degrees must not be blindly treated as an ordinary scalar pair. Missing samples also change information age. Record timestamps and define a reviewed recovery policy instead of treating a long gap as one normal sampling interval.

Keep short contact events observable

A disturbance can disappear from a slowly updated display while still affecting the receiver. In the a = 0.20 example, four consecutive samples at a new level move the output by only 1 − 0.8^4 = 0.5904 of that level difference before recovery begins. A threshold applied only to the filtered value can therefore respond differently from a threshold applied to the raw samples.

Define contact-event detection using the application's fault requirements, including bandwidth, thresholds, persistence and response time. Retain raw and filtered records during engineering evaluation. A separate diagnostic stream may need different processing, but its design and system acceptance require their own review. Smoothing settings must never be presented as proof of functional safety or as a substitute for checking the physical wiper and track.

Verify the feasible choice against an independent angle record

Measure stationary distributions at several angles, then run synchronized constant-speed sweeps in both directions. Compare filtered angle with the independent angle reference at the time the value becomes available, not after shifting one curve until the traces overlap. A shifted overlay is useful for estimating delay, but it removes the very real-time error that the application must tolerate.

Add startup, reversal, acceleration and controlled signal-change sequences. Retain the raw samples, timestamps, coefficient, initialization state and software revision. Recalculate the predicted ramp lag and step response from those exact settings, then investigate departures before changing the track artwork. The outcome is a documented filter choice or a requirement conflict that calls for a quieter signal chain, a different acquisition strategy or a reviewed change in the system budget.

Provide the rotary sensing and timing budget

Send the position signal and dynamic requirements so filtering can be reviewed together with the resistor-card interface.

  • Angle-output transfer, active travel, end-zone behavior, excitation and the electrical receiver configuration.
  • Maximum speed and acceleration, permitted dynamic angle error, stationary noise metric and step-response requirement.
  • Raw stationary and moving records with independent angle reference, acquisition timestamps and known conversion latency.
  • Exact filter recursion or window definition, coefficient, numerical precision, initialization and missing-sample policy.
  • Contact-event detection requirements, diagnostic processing and ownership of system-level acceptance.

The drawing-upload form loads as you reach this section.