ChatPPG Editorial

Kalman Filtering for Continuous PPG Heart Rate Estimation

**The Kalman filter transforms PPG heart rate estimation from a noisy, frame-by-frame spectral measurement into a smooth, continuous tracking problem....

ChatPPG Team
Published
14 min read
  • Heart Rate
Kalman Filtering for Continuous PPG Heart Rate Estimation
Editorial illustration · Devices and signals are conceptual. Where shown, violet optical paths represent invisible infrared in false color.

The Kalman filter transforms PPG heart rate estimation from a noisy, frame-by-frame spectral measurement into a smooth, continuous tracking problem. By maintaining a probabilistic model of the heart rate state and recursively updating it with each new PPG observation, Kalman filtering produces heart rate estimates that are robust to transient noise, motion artifacts, and spectral ambiguity. This recursive Bayesian approach has become a standard component in wearable device heart rate algorithms, bridging the gap between raw signal processing and clinically useful continuous heart rate output.

This article provides a complete technical treatment of Kalman filter theory as applied to PPG heart rate tracking, covering the standard linear Kalman filter, Extended Kalman Filter (EKF), Unscented Kalman Filter (UKF), and particle filter variants. We include practical guidance on state model design, noise parameter tuning, and integration with upstream signal processing stages. For foundational context on PPG signal characteristics, see our PPG technology overview.

The Heart Rate Tracking Problem

Heart rate estimation from PPG signals involves two fundamental challenges that make simple instantaneous measurement unreliable.

First, the PPG signal is corrupted by noise and motion artifacts that can obscure or distort the cardiac pulse. During physical activity, motion artifact power can exceed the cardiac signal power by 10-20 dB, making frequency-domain peak picking unreliable. Even at rest, baseline wander, sensor contact variations, and ambient light interference introduce measurement noise. These challenges are addressed by upstream signal processing methods detailed in our motion artifact removal guide.

Second, heart rate is inherently a continuous physiological variable that changes smoothly over time. The cardiac autonomic nervous system adjusts heart rate with a response time constant of several seconds. Abrupt jumps in estimated heart rate (such as jumping from 72 to 144 BPM due to harmonic confusion in the frequency spectrum) are physiologically impossible and should be rejected by any well-designed estimation algorithm. This smoothness constraint is exactly what Kalman filtering exploits.

The heart rate tracking problem can be framed as a state estimation problem: given a sequence of noisy observations derived from the PPG signal (such as the dominant spectral frequency in a sliding window), estimate the true underlying heart rate at each time step. This is precisely the problem class for which Kalman filtering was developed.

Standard Kalman Filter Framework

The Kalman filter operates on a linear state-space model consisting of two equations:

State equation: x(k)=F x(k−1)+w(k)x(k) = F\,x(k-1) + w(k)

Observation equation: z(k)=H x(k)+v(k)z(k) = H\,x(k) + v(k)

where x(k) is the state vector at time step k, F is the state transition matrix, H is the observation matrix, w(k) is process noise with covariance Q, and v(k) is measurement noise with covariance R.

For PPG heart rate tracking, a minimal state vector contains the heart rate itself:

x(k)=[HR(k)]x(k) = [\mathrm{HR}(k)]

The state transition model assumes heart rate changes slowly between observations: HR(k)=HR(k−1)+w(k)\mathrm{HR}(k) = \mathrm{HR}(k-1) + w(k), where w(k)w(k) captures the expected physiological variation. The observation z(k)z(k) is typically the dominant frequency in the PPG power spectrum, multiplied by 60 to convert from Hz to BPM.

A more sophisticated state model includes heart rate and its first derivative (rate of change):

x(k)=[HR(k), dHR(k)]Tx(k) = [\mathrm{HR}(k),\ \mathrm{dHR}(k)]^{T}

with state transition:

HR(k)=HR(k−1)+dHR(k−1) dt+w1(k)\mathrm{HR}(k) = \mathrm{HR}(k-1) + \mathrm{dHR}(k-1)\,\mathrm{d}t + w_1(k)
dHR(k)=dHR(k−1)+w2(k)\mathrm{dHR}(k) = \mathrm{dHR}(k-1) + w_2(k)

This second-order model provides better tracking of heart rate trends (such as steady increases during exercise ramp-up) because the predicted heart rate incorporates the estimated trend. The extra state adds only marginal computational cost.

The Kalman Prediction-Update Cycle

Each iteration of the Kalman filter consists of two phases:

Prediction step:

  • Predicted state: xpred=F x(k−1)x_{\text{pred}} = F\,x(k-1)
  • Predicted covariance: Ppred=F P(k−1) FT+QP_{\text{pred}} = F\,P(k-1)\,F^{T} + Q

Update step:

  • Innovation: y=z(k)−H xpredy = z(k) - H\,x_{\text{pred}}
  • Innovation covariance: S=H Ppred HT+RS = H\,P_{\text{pred}}\,H^{T} + R
  • Kalman gain: K=Ppred HTS−1K = P_{\text{pred}}\,H^{T} S^{-1}
  • Updated state: x(k)=xpred+K yx(k) = x_{\text{pred}} + K\,y
  • Updated covariance: P(k)=(I−KH) PpredP(k) = (I - K H)\,P_{\text{pred}}

The Kalman gain K automatically balances trust between the prediction and the observation. When measurement noise is high (large R), K is small, and the filter relies more on its prediction. When process noise is high (large Q), K is large, and the filter tracks the observations more closely. This adaptive weighting is the core mechanism that makes Kalman filtering robust to intermittent measurement failures.

Extended Kalman Filter (EKF) for PPG

The standard Kalman filter assumes linear state and observation models, which limits its applicability to PPG. In practice, the relationship between the PPG signal and heart rate involves nonlinear transformations (spectral estimation, peak detection, waveform feature extraction), and the state dynamics may also be nonlinear (heart rate variability is modulated by respiratory and autonomic factors in complex ways).

The Extended Kalman Filter addresses this by linearizing the nonlinear models at each time step using Jacobian matrices. The nonlinear state and observation models are:

x(k)=f(x(k−1))+w(k)x(k) = f\left(x(k-1)\right) + w(k)
z(k)=h(x(k))+v(k)z(k) = h\left(x(k)\right) + v(k)

where f(⋅)f(\cdot) and h(⋅)h(\cdot) are nonlinear functions. The EKF computes the Jacobians F=∂f/∂xF = \partial f/\partial x and H=∂h/∂xH = \partial h/\partial x at the current state estimate and uses these in the standard Kalman equations.

EKF State Model Design for PPG

One EKF design for PPG heart rate tracking uses a state vector holding heart rate and a signal model parameter describing the expected PPG spectral shape. The observation model h() mapped the state to the expected power spectral density of the PPG signal, and the innovation was computed by comparing the predicted and observed spectra.

A richer EKF formulation includes the heart rate, its rate of change, and the amplitudes of the fundamental frequency and first harmonic in the state vector:

x(k)=[HR, dHR, A1, A2]Tx(k) = [\mathrm{HR},\ \mathrm{dHR},\ A_1,\ A_2]^{T}

Including harmonic amplitude states lets the filter resolve harmonic ambiguity (distinguishing the fundamental cardiac frequency from its half-frequency or double-frequency harmonics) by tracking the expected harmonic amplitude ratio across time.

Noise Parameter Tuning

The performance of the EKF depends critically on the process noise covariance Q and measurement noise covariance R. These parameters encode prior knowledge about physiological heart rate dynamics and measurement quality.

Process noise Q should reflect the maximum expected heart rate change between update steps. For a 2-second update interval, maximum physiological heart rate change is approximately 5-10 BPM. Setting Q=diag⁡([52,22])Q = \operatorname{diag}([5^2, 2^2]) for a [HR,dHR][\mathrm{HR}, \mathrm{dHR}] state vector provides reasonable tracking bandwidth. During known exercise conditions, Q can be increased to allow faster tracking. Adaptive Q estimation based on accelerometer-derived activity level can help during activity transitions.

Measurement noise R should reflect the reliability of the spectral heart rate observation. At rest with clean signals, R = 1-4 BPM^2 is appropriate. During heavy motion, R should increase to 25-100 BPM^2, effectively telling the filter to distrust the observation and rely on its prediction. Adaptive R estimation based on PPG signal quality indices (SQI) is a powerful technique that enables the filter to automatically adjust its behavior based on signal conditions.

Unscented Kalman Filter (UKF) for PPG

The UKF provides a higher-accuracy alternative to the EKF by avoiding Jacobian computation and instead using deterministic sampling (sigma points) to propagate the state distribution through the nonlinear models. The UKF captures the mean and covariance of the transformed distribution more accurately than the first-order linearization used by the EKF, particularly when the nonlinearities are strong.

For PPG heart rate tracking, the UKF generates 2n+1{2n+1} sigma points (where nn is the state dimension), propagates each through the nonlinear state and observation models, and computes the predicted mean and covariance from the transformed sigma points. With nn = 2-4 for typical PPG state models, the computational overhead relative to the EKF is modest.

Particle Filters for PPG

Particle filters (Sequential Monte Carlo methods) represent the most general Bayesian filtering approach, capable of handling arbitrary nonlinear models and non-Gaussian noise distributions. Instead of parametric state estimation (as in the EKF/UKF), particle filters maintain a set of weighted samples (particles) that approximate the full posterior distribution over the state.

For PPG heart rate estimation, particle filters offer two distinct advantages. First, they can represent multimodal distributions, which naturally handles harmonic ambiguity. When the PPG spectrum contains energy at both the fundamental heart rate frequency and a motion harmonic, the particle cloud can maintain hypotheses at both frequencies, automatically resolving the ambiguity as more observations arrive. Second, particle filters can incorporate arbitrary constraints (such as physiological heart rate bounds of 30-220 BPM) directly into the sampling process.

A useful design is a spectral likelihood function that evaluates each particle's predicted heart rate against multiple peaks in the PPG power spectrum, weighted by peak prominence and harmonic consistency. This naturally handles scenarios where the strongest spectral peak is a motion artifact rather than the cardiac fundamental.

The primary disadvantage of particle filters is computational cost. With hundreds of particles, each requiring spectral evaluation, the computation per update step is far greater than the EKF. On modern wearable processors (ARM Cortex-M4/M7), particle filters at low update rates remain feasible, but careful implementation optimization is required.

Multi-Stage Pipeline Integration

In practical wearable heart rate algorithms, the Kalman filter operates as the final stage in a multi-stage signal processing pipeline. The upstream stages handle motion artifact removal and spectral estimation, while the Kalman filter provides temporal smoothing and continuity.

A representative pipeline architecture is:

  1. Preprocessing: Bandpass filtering (0.4-4 Hz), baseline removal
  2. Motion artifact reduction: Adaptive filtering (NLMS/RLS) with accelerometer reference, or SVD-based denoising
  3. Spectral estimation: Short-time FFT or autoregressive spectral estimation on 5-8 second windows
  4. Peak selection: Identification of candidate heart rate frequencies from spectral peaks
  5. Kalman filtering: Recursive tracking of the heart rate state using spectral peaks as observations

The interface between stages 4 and 5 is critical. Rather than passing a single point estimate to the Kalman filter, passing multiple candidate peaks with their spectral magnitudes enables the filter to resolve ambiguities using its temporal model. This is particularly important during exercise, where motion harmonics often produce spectral peaks that are stronger than the cardiac fundamental.

Zhang (2015) implemented this multi-candidate approach in the TROIKA framework, using a sparse signal reconstruction step to identify candidate frequencies and a spectral peak tracking stage functionally equivalent to Kalman filtering. TROIKA achieved heart rate MAE of 2.34 BPM on the IEEE Signal Processing Cup dataset and established a benchmark that subsequent Kalman-based methods have built upon. For related peak detection methods, see our guide on PPG signal processing algorithms.

Adaptive Kalman Filtering

Fixed-parameter Kalman filters assume that the process and measurement noise characteristics remain constant, which is rarely true for PPG signals recorded during real-world activities. Adaptive Kalman filtering dynamically adjusts Q and/or R based on signal characteristics, achieving significantly better performance during transitions between rest and exercise.

Signal Quality-Based Adaptation

PPG signal quality indices (SQI) provide a direct measure of measurement reliability that can be mapped to the measurement noise covariance R. Common SQI metrics include:

  • Perfusion index: The ratio of AC to DC PPG amplitude. Higher perfusion indicates better signal quality.
  • Skewness: Clean PPG pulses have characteristic negative skewness. Deviation indicates corruption.
  • Kurtosis: Excess kurtosis detects non-Gaussian artifacts.
  • Template correlation: Cross-correlation of each pulse with a running average pulse template. Values below 0.8 indicate morphological distortion.

A common design sets R as an increasing function of a composite SQI score (for example, from perfusion index and template correlation). When SQI drops, R rises and the filter coasts on its prediction. When SQI recovers, R falls and the filter re-locks to the observation.

Innovation-Based Adaptation

An alternative approach adapts Q and R based on the Kalman filter's own innovation sequence (the difference between predicted and observed measurements). If the innovation consistently exceeds the predicted innovation covariance, either Q is too small (the model is not allowing enough state variation) or R is too small (the model is trusting observations too much). Innovation-based adaptation algorithms such as those of Mehra (1970, doi:10.1109/TAC.1970.1099422) and Mohamed and Schwarz (1999, doi:10.1007/s001900050236), developed for general and INS/GPS filtering, can be carried over to PPG heart rate tracking.

Sage-Husa adaptive Kalman filtering estimates both Q and R online from windowed innovation statistics, which removes the need for manual parameter tuning.

Performance Benchmarks

Compare any Kalman tracker against established, non-Kalman reference results on public datasets:

Scroll horizontally if needed

Method Dataset Activity Reported error
TROIKA (Zhang et al., 2015) 12 subjects Running up to 15 km/h Average absolute error 2.34 BPM
WFPV (Temko, 2017) 23 PPG recordings Intensive exercise Average absolute error 1.97 BPM online, 1.37 BPM offline (Viterbi)
Deep PPG CNN (Reiss et al., 2019) PPG-DaLiA Daily-life activities Mean absolute error 31% lower than the classical methods compared

Spectral peak tracking with temporal constraints (as in TROIKA) and Viterbi decoding (as in Temko's offline mode) do the same job as a Kalman stage: they exploit the smoothness of heart rate over time.

Computational Requirements and Embedded Implementation

Kalman filters are highly efficient algorithms, particularly in low-dimensional state spaces. The computational requirements for PPG heart rate tracking are dominated by the upstream spectral estimation, not the filter itself.

For a 4-state EKF, each prediction-update cycle requires approximately 100 floating-point multiply-accumulate operations. At a 1 Hz update rate, this is negligible on any modern processor. The UKF with 9 sigma points requires approximately 500 operations per update, still trivial. Even particle filters with 500 particles require only about 50,000 operations per update, feasible on ARM Cortex-M4 at clock speeds above 48 MHz.

Memory requirements are also minimal: the EKF requires storage for the state vector (4 floats), covariance matrix (4x4 = 16 floats), process and measurement noise matrices, and Kalman gain, totaling approximately 200 bytes. Particle filters require storage for particle states and weights, totaling approximately 4 KB for 500 particles with a 4-state model.

These low computational and memory requirements make Kalman filtering an ideal final stage in wearable heart rate estimation pipelines, adding robust temporal tracking with negligible resource overhead.

Conclusion

Kalman filtering provides a principled, efficient, and effective approach to continuous heart rate estimation from PPG signals. By framing heart rate tracking as a recursive Bayesian state estimation problem, Kalman filters exploit the temporal smoothness of heart rate to produce estimates that are robust to transient noise, spectral ambiguity, and brief signal dropouts. The Extended Kalman Filter offers the best balance of accuracy and computational efficiency for most wearable applications, while the Unscented Kalman Filter and particle filters provide additional capability for handling strong nonlinearities and multimodal ambiguity. Adaptive variants that dynamically adjust noise parameters based on signal quality further improve robustness during real-world use. For researchers and engineers building PPG heart rate algorithms, adding a Kalman filtering stage to the signal processing pipeline is one of the highest-value, lowest-cost improvements available.

References

  • Reiss, A., Indlekofer, I., Schmidt, P., & Van Laerhoven, K. (2019). Deep PPG: Large-scale heart rate estimation with convolutional neural networks. Sensors, 19(14), 3079. https://doi.org/10.3390/s19143079
  • Temko, A. (2017). Accurate heart rate monitoring during physical exercises using PPG. IEEE Transactions on Biomedical Engineering, 64(9), 2016-2024. https://doi.org/10.1109/TBME.2017.2676243
  • Zhang, Z., Pi, Z., & Liu, B. (2015). TROIKA: A general framework for heart rate monitoring using wrist-type photoplethysmographic signals during intensive physical exercise. IEEE Transactions on Biomedical Engineering, 62(2), 522-531. https://doi.org/10.1109/TBME.2014.2359372

Related articles