Pan-Tompkins QRS Detection

Simulation
Introduced by
Jiapu Pan
Year
1985
Type
Digital signal processing pipeline
Family
Biomedical signal processing

What does it do?

The Pan-Tompkins algorithm is a real-time method for detecting QRS complexes, and the R-peaks within them, in continuous electrocardiogram (ECG) recordings.

Pan and Tompkins described it in IEEE Transactions on Biomedical Engineering in 1985, designing it for real-time operation. It is widely used as a reference QRS detector in ECG processing work. The original evaluation reported correct detection of 99.3% of QRS complexes on the 24-hour MIT/BIH arrhythmia database. This figure applies to that database, and performance on other recordings must be checked.

The intuition behind the method

The QRS complex is the most prominent deflection in a normal ECG and reflects ventricular depolarization, so locating it gives the R-peak times used for heart rate and RR-interval analysis. The algorithm does not search for the raw peaks directly. It first band-passes the signal to keep the frequency range where QRS energy dominates, then differentiates it so that steep edges stand out, squares the result so that large deflections dominate, and integrates over a short moving window so that each QRS produces one broad pulse. Decision thresholds are then applied to this output, and they are updated over time so the detector can follow changes in QRS amplitude and heart rate.

History

Pan and Tompkins published the algorithm in IEEE Transactions on Biomedical Engineering in 1985, describing a real-time QRS detector based on digital analysis of slope, amplitude and width. The original evaluation on the 24-hour MIT/BIH arrhythmia database reported 99.3% correct QRS detection. Later detectors, including those based on stationary wavelet transforms, adaptive filtering and neural networks, have been proposed as variants or alternatives.

When to use it

Choose Pan-Tompkins when you need a fast, training-free QRS detector for ECG recordings, particularly in real-time or embedded settings where computation is limited. It suits recordings sampled at at least 200 Hz with mostly regular rhythms, where the QRS is the dominant steep feature. Multi-lead and 12-lead recordings require a lead to be selected, and detection on that lead should be verified before the output is used. Do not treat it as the sole tool when the recording has heavy noise, large morphology change, or when arrhythmia classification is the question, since the original evaluation used the MIT/BIH arrhythmia database and performance on other acquisition setups should be checked. For heavily arrhythmic or strongly baseline-disturbed recordings, consider adaptive or alternative detectors.

Limitations and considerations

  • The decision rules rely on typical QRS slope, amplitude and width. QRS morphologies far from these assumptions, such as wide ectopic beats, may be missed or mistimed.
  • Differentiation amplifies high-frequency content, so muscle artefact that remains within the passband after filtering can be detected as QRS activity.
  • Steep, high-amplitude T-waves can be detected as QRS complexes, particularly at high heart rates, because their slope and amplitude partly overlap with those of the QRS.
  • The band-pass filter uses fixed cutoffs. The adaptive updates described in the original paper concern thresholds and parameters. If signal morphology or acquisition differs substantially from the data the design was based on, the filter may generalise poorly.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Operates in real time at low computational cost: each stage uses simple per-sample operations (filtering, differencing, squaring and a moving sum), which is why the design targets real-time hardware.
  • Requires no training data, because thresholds are derived from the signal itself and updated periodically rather than fitted to a labelled ECG set.
  • The original paper reports correct detection of 99.3% of QRS complexes in the 24-hour MIT/BIH arrhythmia database. This is a detection rate on that database, not a general sensitivity or specificity figure.
  • The band-pass stage reduces false detections caused by interference, which the original paper states permits the use of low thresholds and so raises detection sensitivity.

Applications

  • Continuous cardiac monitoring in intensive care units to detect arrhythmias and trigger alerts
  • Holter monitor analysis: automated detection of QRS complexes in 24-hour ambulatory ECG recordings
  • Heart rate variability studies: precise R-peak timing for temporal analysis of autonomic nervous system function
  • Cardiac rehabilitation: monitoring exercise intensity and recovery via heart rate measured from detected QRS complexes

How it works

How it works

1

Record a continuous ECG from a selected lead, and check that the QRS complex and its R-peak are clearly visible in that lead. Sample at 200 Hz or higher. The sampling rate must be high enough to resolve a QRS complex, which typically lasts 80–120 ms.

2

Apply the special digital band-pass filter described in the original paper to reduce the interference that causes false detections, including baseline wander and high-frequency noise, while keeping the spectral content of QRS complexes. Verify the exact cutoffs against the paper. A passband of roughly 5–15 Hz is an approximate QRS band used here for illustration, not the original specification.

3

Differentiate the filtered signal so that steep QRS edges produce large values. This step emphasises slope, which is one of the features the original paper uses to discriminate QRS complexes.

4

Square the differentiated signal so that large deflections dominate, then apply a moving-window integrator over a short window. The output is a smoothed waveform with one broad pulse per QRS complex, and the pulse width depends on the window chosen.

5

Apply adaptive thresholds, updated periodically from running estimates of signal and noise levels, to the integrated output. Accept only peaks that pass the threshold and the slope, amplitude and width checks, which are the features the original paper uses. The exact decision rules and their parameter values, including any refractory-period and T-wave checks, should be taken from the original paper. Steep, high-amplitude T-waves can still pass these checks (see limitations). Convert the accepted R-peak times into RR intervals and heart rate.

Common pitfalls

  • Choosing band-pass cutoffs without regard to the sampling rate and the patient population. The original paper uses a specific digital band-pass filter, and the approximate 5–15 Hz band mentioned here is not a universal setting, so check filter settings on representative recordings.
  • Using fixed detection thresholds instead of the adaptive update. Without the update the detector cannot follow amplitude drift or heart rate change, which the original design explicitly addresses.
  • Feeding unfiltered recordings into detection. Baseline wander and muscle artefact pass directly into the differentiation stage and are amplified there, so confirm that preprocessing is applied first.
  • Treating 200 Hz as a hard guarantee. It is the minimum recommended here; check that the QRS complex is adequately resolved in your own data.

Frequently asked questions

What is the difference between QRS detection and ECG interpretation?

QRS detection identifies the timing of ventricular depolarization (R-peaks); ECG interpretation assigns diagnoses (MI, arrhythmia, etc.) based on waveform morphology and timing. Detection is a prerequisite for interpretation.

Can the Pan-Tompkins algorithm handle atrial fibrillation?

It can identify R-peaks in atrial fibrillation, but irregular RR intervals and baseline variations may reduce sensitivity. Adaptive thresholds help; specialized arrhythmia detection may be needed for diagnosis.

What sampling rate is needed for accurate QRS detection?

At least 200 Hz is recommended for proper resolution of the QRS complex (which typically lasts 80–120 ms). Higher rates (250–1000 Hz) resolve the QRS morphology more finely. This page treats 200 Hz as the minimum recommended rate.

Related methods

Sources

  1. Pan, J., & Tompkins, W. J. (1985). A real-time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, BME-32(3), 230-236.

    Open DOI reference
  2. Clifford, G. D., Azuaje, F., & McSharry, P. E. (2006). ECG statistics, noise, artifacts, and missing data. Advanced Methods and Tools for ECG Data Analysis, 1, 1-41.

    Open publication reference