ChatPPG Editorial

Ppg Adaptive Filtering Lms Nlms

**Adaptive filtering is the workhorse of real-time PPG signal denoising, and the Least Mean Squares (LMS) family remains the most deployed algorithm c...

ChatPPG Team
11 min read

LMS and NLMS Adaptive Filters for PPG Noise Removal

Adaptive filtering is the workhorse of real-time PPG signal denoising, and the Least Mean Squares (LMS) family remains the most deployed algorithm class in commercial wearable devices. Despite being introduced by Widrow and Hoff in 1960, LMS and its normalized variant NLMS continue to dominate embedded PPG processing because they offer the rare combination of theoretical simplicity, computational efficiency, and robust performance when a motion reference signal is available.

This article provides a rigorous treatment of LMS and NLMS adaptive filtering as applied to photoplethysmographic signals. We cover the mathematical foundations, convergence properties, practical tuning guidelines, and benchmark results from the research literature. For a broader overview of all motion artifact removal techniques, see our PPG motion artifact removal guide. For foundational PPG concepts, start with our introduction to PPG technology.

The Adaptive Noise Cancellation Framework

The standard adaptive noise cancellation (ANC) framework for PPG assumes the observed signal d(n) is a sum of the desired clean cardiac signal s(n) and additive motion noise v(n):

d(n) = s(n) + v(n)

A reference signal x(n), typically from a co-located 3-axis accelerometer, is available. This reference is correlated with the noise v(n) but uncorrelated with the cardiac signal s(n). The adaptive filter produces an estimate of the noise by filtering the reference through an FIR filter with adjustable weights:

y(n) = w^T(n) * x(n)

The error signal e(n) = d(n) - y(n) serves as the filter output and, under ideal conditions, converges to an estimate of the clean cardiac signal s(n). The filter weights are updated at each time step to minimize a cost function based on the error.

This framework was formalized for PPG by Poh et al. (2010) and has since become the standard pipeline architecture for accelerometer-referenced PPG denoising. The critical assumption is that the accelerometer signal is linearly related to the motion artifact in the PPG. When this assumption is violated, for example during sensor-tissue coupling changes that create nonlinear optical path distortions, adaptive filter performance degrades (Lee et al., 2014).

LMS Algorithm: Theory and PPG Application

Mathematical Formulation

The LMS algorithm minimizes the mean squared error E[e^2(n)] using a stochastic gradient descent approach. Rather than computing the true gradient (which requires the autocorrelation matrix of the input), LMS approximates it using the instantaneous gradient:

w(n+1) = w(n) + mu * e(n) * x(n)

where mu is the step size (learning rate), e(n) = d(n) - w^T(n) * x(n) is the instantaneous error, and x(n) = [x(n), x(n-1), ..., x(n-N+1)]^T is the reference input vector of length N (the filter order).

The computational cost per sample is exactly 2N multiply-accumulate operations: N for computing the filter output y(n) and N for the weight update. On a typical ARM Cortex-M4 running at 64 MHz, an N=32 LMS filter at 100 Hz sample rate consumes less than 0.1% of available processing cycles.

Convergence Conditions

For LMS to converge in the mean, the step size must satisfy:

0 < mu < 2 / (N * Px)

where Px is the power of the reference input signal. This bound is signal-dependent, which creates a fundamental problem for PPG: during vigorous exercise, accelerometer signal power increases by 20-40 dB relative to rest, potentially violating a step size chosen for resting conditions.

Convergence speed is governed by the eigenvalue spread of the input autocorrelation matrix R_xx. The time constant for the slowest mode is approximately:

tau_max = 1 / (2 * mu * lambda_min)

where lambda_min is the smallest eigenvalue. For accelerometer signals during complex multi-axis motion, eigenvalue spreads of 10-100 are common, meaning the slowest mode converges 10-100x slower than the fastest. This eigenvalue spread problem is the primary motivation for NLMS.

PPG-Specific LMS Results

Kim and Yoo (2006) applied LMS with a 3-axis accelerometer reference to wrist PPG during walking and achieved heart rate estimation errors of 5-8 BPM using a filter order of N=20 at 25 Hz sampling. Ram et al. (2012) compared LMS against RLS for PPG denoising during treadmill exercise (DOI: 10.1109/TBME.2011.2164933), finding that LMS achieved mean absolute error (MAE) of 6.2 BPM on their 12-subject dataset, compared to 3.8 BPM for RLS. The convergence time of LMS was approximately 4x longer than RLS when subjects transitioned between walking speeds.

Chan et al. (2003) reported that standard LMS failed to converge during high-intensity exercise segments where the accelerometer signal power exceeded the resting value by more than 30 dB. They recommended either using NLMS or implementing a variable step-size LMS with power-normalized adaptation, effectively arriving at NLMS through a different path.

NLMS Algorithm: The Practical Standard

Mathematical Formulation

The Normalized LMS algorithm modifies the weight update to normalize by the instantaneous input power:

w(n+1) = w(n) + mu_bar / (epsilon + ||x(n)||^2) * e(n) * x(n)

where mu_bar is the normalized step size (0 < mu_bar < 2 for convergence), epsilon is a small regularization constant to prevent division by zero (typically 1e-6 to 1e-3), and ||x(n)||^2 = x^T(n) * x(n) is the squared Euclidean norm of the input vector.

The normalization ensures that the effective step size adapts automatically to the input signal power. When motion is vigorous and accelerometer power is high, the effective step size decreases, preventing instability. When motion is gentle, the effective step size increases, maintaining adequate convergence speed.

Why NLMS Outperforms LMS for PPG

The advantages of NLMS over LMS for PPG denoising are both theoretical and practical:

Automatic power adaptation. During a typical wearable use case, a user transitions from sitting (low accelerometer power) to walking (moderate) to running (high). LMS requires a step size small enough for the highest-power condition, which makes it sluggish at rest. NLMS adapts automatically, providing near-optimal convergence at every activity level.

Reduced sensitivity to filter order. In LMS, the convergence bound depends on both N and Px. Increasing the filter order to capture longer impulse responses tightens the convergence bound and requires reducing mu. In NLMS, the normalization by ||x(n)||^2 (which grows with N) automatically compensates, making NLMS less sensitive to filter order selection.

Robustness to non-stationary signals. PPG motion artifacts are inherently non-stationary. NLMS's instantaneous power normalization provides a first-order adaptation to statistical changes, whereas LMS assumes fixed statistics over its convergence time window.

Benchmark Results

Lee et al. (2014) conducted a comprehensive comparison of NLMS variants on PPG data from 10 subjects performing treadmill exercise at speeds of 4-12 km/h (DOI: 10.1016/j.bspc.2014.01.002). Key findings:

  • Standard NLMS with mu_bar = 0.5 and N=32 at 125 Hz achieved MAE of 3.1 BPM during steady walking (6 km/h)
  • During walking-to-running transitions, MAE increased to 7.8 BPM due to the abrupt change in motion statistics
  • Adding a proportionate NLMS variant (PNLMS), which assigns larger step sizes to filter taps with larger magnitudes, reduced transition MAE to 5.2 BPM

Zhang et al. (2015) evaluated NLMS as part of their TROIKA framework for PPG heart rate estimation (DOI: 10.1109/TBME.2014.2359372), achieving average absolute error (AAE) of 2.34 BPM on the IEEE Signal Processing Cup 2015 dataset across 12 subjects performing intensive treadmill exercise. The NLMS stage served as the initial motion artifact removal step before spectral peak tracking, demonstrating that NLMS alone is often insufficient for high-accuracy HR estimation during vigorous motion.

Salehizadeh et al. (2016) tested NLMS on a 23-subject dataset during daily living activities including typing, eating, and walking (DOI: 10.3390/s16010027). The overall MAE was 1.8 BPM, with rest segments achieving 0.9 BPM and motion segments achieving 3.4 BPM.

Multi-Axis Reference Signal Handling

A 3-axis accelerometer provides three reference channels: a_x(n), a_y(n), and a_z(n). There are two primary strategies for incorporating multi-axis references into the ANC framework.

Concatenated Single-Filter Approach

The simplest approach concatenates all three axes into a single extended reference vector:

x(n) = [a_x(n), ..., a_x(n-N+1), a_y(n), ..., a_y(n-N+1), a_z(n), ..., a_z(n-N+1)]^T

This produces a filter of order 3N, with computational cost of O(3N) per sample for LMS/NLMS. The filter can model cross-axis coupling effects, where motion in one axis creates artifacts correlated with accelerometer data from another axis.

Parallel Multi-Filter Approach

An alternative uses three separate adaptive filters, one per axis, and sums their outputs:

y(n) = y_x(n) + y_y(n) + y_z(n)

Each filter operates on a single axis with order N, giving the same total parameter count (3N) and computational cost. However, this approach constrains the solution to additive combinations and cannot model cross-axis interactions.

Empirically, the concatenated approach yields 5-15% lower error than the parallel approach on benchmark datasets (Lee et al., 2014), at no additional computational cost. The concatenated approach is therefore recommended for most PPG applications.

Practical Implementation Guidelines

Step-Size Selection

For NLMS, begin with mu_bar = 0.5 and adjust based on the tradeoff between convergence speed and steady-state misadjustment. Higher values (0.7-0.9) improve tracking of rapidly changing motion but increase noise in the output. Lower values (0.1-0.3) produce cleaner outputs during steady-state motion but lag during transitions.

A practical approach is to use a variable normalized step size that increases during detected transitions and decreases during steady motion. The transition can be detected by monitoring the short-term energy change in the accelerometer signal. See our PPG signal processing algorithms page for implementation details.

Filter Order Selection

Filter order determines the length of the impulse response the filter can model, which relates to the complexity of the motion-to-artifact transfer function. General guidelines:

Sample Rate Recommended N Impulse Response Duration
25 Hz 10-20 400-800 ms
50 Hz 16-32 320-640 ms
100 Hz 32-64 320-640 ms
256 Hz 64-128 250-500 ms

The impulse response duration should be sufficient to capture the mechanical delay between accelerometer motion and optical path distortion, which is typically 50-300 ms depending on sensor mounting and tissue coupling.

Pre-Processing Pipeline

Raw PPG and accelerometer signals require pre-processing before adaptive filtering:

  1. DC removal. Subtract a moving average (window 1-2 seconds) from both PPG and accelerometer signals to remove baseline wander and gravitational offset.
  2. Bandpass filtering. Apply a 4th-order Butterworth bandpass filter (0.4-5 Hz) to the PPG signal to isolate the cardiac band. Apply a matching bandpass to the accelerometer to maintain temporal alignment.
  3. Normalization. Scale both signals to unit variance over a sliding window (5-10 seconds) to improve adaptive filter convergence.
  4. Decimation. If the native sample rate exceeds 100 Hz, consider decimating to 50-100 Hz to reduce computational cost without sacrificing cardiac frequency resolution.

Post-Processing

The adaptive filter output e(n) is the estimated clean cardiac signal, but it may still contain residual noise. Common post-processing steps include:

  • Spectral peak tracking. Apply an FFT or autocorrelation to the filtered signal in sliding windows (6-10 seconds with 1-2 second overlap) and track the dominant spectral peak as the heart rate estimate.
  • Harmonic validation. Verify that the detected peak has harmonics at 2x and 3x the fundamental frequency, which distinguishes true cardiac peaks from residual motion artifacts.
  • Physiological bounding. Reject heart rate estimates outside 30-220 BPM and apply maximum rate-of-change constraints (e.g., no more than 10 BPM change per second) to prevent spurious jumps.

Limitations and When to Use Other Methods

LMS and NLMS adaptive filters have well-understood limitations that determine when alternative methods should be considered:

Nonlinear artifacts. When the motion-to-artifact relationship is nonlinear (e.g., during sensor liftoff or tissue compression), linear adaptive filters cannot fully cancel the artifact. Nonlinear extensions such as Volterra filters or kernel adaptive filters address this but at substantially higher computational cost (Comminiello and Principe, 2018). For further reading on nonlinear approaches, see our algorithms overview.

No reference signal available. Without an accelerometer or other motion reference, LMS/NLMS cannot function. Reference-free methods including empirical mode decomposition, independent component analysis, and wavelet denoising should be used instead.

Spectral overlap. When the motion artifact fundamental frequency coincides exactly with the heart rate, even a perfect adaptive filter with perfect reference cannot separate them, because the cardiac component in the error signal is zero at that frequency. Spectral tracking methods that exploit harmonic structure provide an alternative in this scenario.

Rapidly time-varying channels. While NLMS handles moderate non-stationarity well, extremely rapid changes (e.g., impact events, sudden sensor displacement) can exceed the tracking bandwidth. The RLS algorithm converges faster and handles such transitions more effectively, at the cost of O(N^2) computation per sample.

Comparison with RLS and Advanced Methods

To contextualize LMS/NLMS performance, consider the following comparative results from the literature:

Method MAE (BPM) Computation Converge Time Best Use Case
LMS 5-8 O(N) Slow Static or slow-changing motion
NLMS 2-5 O(N) Moderate General wearable use
RLS 1-4 O(N^2) Fast Activity transitions
NLMS + spectral tracking 1-3 O(N + K log K) Moderate High-accuracy HR estimation

These figures aggregate results across multiple studies with different datasets, so direct comparison requires caution. However, the general ranking is consistent: RLS outperforms NLMS, which outperforms LMS, at increasing computational cost.

For many embedded wearable applications, NLMS with spectral post-processing represents the optimal tradeoff. The algorithm is simple to implement, requires minimal memory (N+1 weight coefficients plus input buffer), runs in real-time on microcontrollers as modest as ARM Cortex-M0+, and achieves clinically acceptable accuracy for heart rate monitoring during moderate activity.

Conclusion

LMS and NLMS adaptive filters remain foundational tools for PPG motion artifact removal. NLMS, with its automatic power normalization, is the recommended starting point for any accelerometer-referenced PPG denoising pipeline. The algorithm's simplicity, low computational footprint, and well-understood convergence properties make it particularly suited to embedded wearable devices where power consumption and processing resources are constrained.

For applications requiring higher accuracy during activity transitions or complex motion patterns, NLMS can be extended with variable step-size strategies or upgraded to RLS filtering. For the highest accuracy in challenging conditions, multi-stage pipelines combining adaptive filtering with spectral tracking or deep learning post-processing represent the current state of the art. Explore our complete algorithms reference for implementation guidance across all PPG signal processing methods.

References

  • Kim and Yoo (2006) applied LMS with a 3-axis accelerometer reference to wrist PPG during walking and achieved heart rate estimation errors of 5-8 BPM using a filter order of N=20 at 25 Hz sampling. Ram et al. (2012) compared LMS against RLS for PPG denoising during treadmill exercise (DOI: 10.1109/TBME.2011.2164933), finding that LMS achieved mean absolute error (MAE) of 6.2 BPM on their 12-subject dataset, compared to 3.8 BPM for RLS. The convergence time of LMS was approximately 4x longer than RLS when subjects transitioned between walking speeds.
  • Lee et al. (2014) conducted a comprehensive comparison of NLMS variants on PPG data from 10 subjects performing treadmill exercise at speeds of 4-12 km/h (DOI: 10.1016/j.bspc.2014.01.002). Key findings:
  • Zhang et al. (2015) evaluated NLMS as part of their TROIKA framework for PPG heart rate estimation (DOI: 10.1109/TBME.2014.2359372), achieving average absolute error (AAE) of 2.34 BPM on the IEEE Signal Processing Cup 2015 dataset across 12 subjects performing intensive treadmill exercise. The NLMS stage served as the initial motion artifact removal step before spectral peak tracking, demonstrating that NLMS alone is often insufficient for high-accuracy HR estimation during vigorous motion.
  • Salehizadeh et al. (2016) tested NLMS on a 23-subject dataset during daily living activities including typing, eating, and walking (DOI: 10.3390/s16010027). The overall MAE was 1.8 BPM, with rest segments achieving 0.9 BPM and motion segments achieving 3.4 BPM.