📈 2D ECG Simulator — Live Waveform Strip Chart
Interactive 2D ECG strip-chart simulator. A real Gaussian-pulse PQRST waveform generator scrolls a single-lead trace like a bedside cardiac monitor, with heart rate measured live from the actual R-R interval and genuine arrhythmia modes (A-Fib, V-Tach, bradycardia).
📈 What It Demonstrates
This simulator drives a single-lead ECG strip chart exactly the way a bedside cardiac monitor does: a real parametrised waveform generator sums a P wave, a QRS complex (built from separate Q, R and S Gaussian pulses) and a T wave into one PQRST cycle, then repeats that cycle at an adjustable rate while the trace scrolls continuously across the screen. Unlike a pre-rendered animation, the displayed heart rate is not read from a slider — it is measured live from the actual R-R interval between detected R peaks, the same way a real monitor computes it.
How to Use
- Select a Rhythm Preset: normal sinus, tachycardia, bradycardia, atrial fibrillation (irregular R-R with no clear P wave), ventricular tachycardia (wide QRS at high rate), or an isolated premature ventricular contraction (PVC) dropped into a normal rhythm.
- Adjust Base Heart Rate to change the target R-R interval.
- Modify P, QRS, T amplitudes to see how each component's shape changes the composite trace.
- Increase Noise to simulate electrode artefact, or change Sweep Speed to match standard 25 mm/s paper.
Did You Know?
Real bedside monitors compute the displayed heart rate exactly this way — by timing the interval between consecutive R peaks rather than counting beats over a fixed window — which is why the number can swing rapidly during an arrhythmia. Atrial fibrillation is defined electrically by the complete loss of an organised P wave, replaced by a chaotic fibrillatory baseline, which is reproduced here in the underlying waveform math rather than just a colour change.
About this simulation
This tool synthesises a single-lead electrocardiogram in real time and scrolls it across a strip chart exactly like a bedside cardiac monitor. Each cardiac cycle sums Gaussian pulses for the P wave, the Q, R and S deflections, and the T wave, and the displayed heart rate is measured, not set — it is computed from the timing between consecutive detected R peaks.
🔬 What it shows
A normalised beat phase from 0 to 1 places a P wave near 0.16, a Q/R/S triple around 0.30-0.36 and a T wave near 0.56. The generator writes samples at 250 Hz into a scrolling ring buffer drawn on a green ECG-style grid, and an R-peak detector timestamps every beat to derive the live R-R interval and heart rate.
🎮 How to use
Pick a rhythm preset (Normal Sinus, Sinus Tachy/Brady, A-Fib, V-Tach, PVC). Sliders set Base Heart Rate (30-200 bpm), P/QRS/T amplitudes, Noise and sweep Speed. The Vitals panel reports the measured R-R heart rate, R-R interval, QRS duration, QT interval and rhythm name. Pause freezes the sweep; Reset clears the buffer.
💡 Did you know?
Bedside monitors alarm on heart rate using exactly this R-R timing method, which is why the number can jump abruptly during an arrhythmia rather than drifting smoothly — a behaviour this simulator reproduces because it measures the same way.
Frequently asked questions
How is this different from the 12-lead ECG simulator?
The 12-lead simulator projects one shared beat onto six lead angles to show how morphology differs by viewing axis. This 2D simulator instead focuses on a single scrolling monitor-style trace and measures heart rate live from the actual R-R timing between detected beats, the way a real bedside monitor displays it, rather than simply echoing the heart-rate slider.
How is the waveform actually generated?
A cardiac cycle runs over a normalised phase 0 to 1. The model places a Gaussian P wave at phase 0.16, separate Q, R and S Gaussian pulses around phase 0.30 to 0.36, and a Gaussian T wave at phase 0.56, then sums them. That composite value is written into a scrolling sample buffer 250 times per second.
How does the "measured" heart rate work?
Each sample is checked against a rising-edge threshold on the R-wave region. When the trace crosses that threshold, the time since the previous crossing is recorded as the R-R interval, and heart rate is computed as 60 divided by that interval in seconds — the same beat-to-beat method real monitors use, so the display reacts immediately to rhythm changes instead of smoothing them away.
What actually changes in each arrhythmia mode?
Atrial fibrillation removes the Gaussian P wave entirely and replaces it with small random fluctuations, and randomises each R-R interval independently. Ventricular tachycardia widens the QRS pulses and shortens the base R-R interval. Bradycardia and tachycardia only change the target rate. A PVC mode inserts one wide, early, P-less beat into an otherwise normal rhythm, followed by a compensatory pause — all of these are changes to the underlying waveform-generation math, not colour or overlay effects.
Are the displayed intervals clinically accurate?
The numbers are illustrative rather than diagnostic. QRS duration is fixed at 90 ms (140 ms for V-Tach and PVC beats) and the QT figure is rate-corrected with a Bazett-style square-root of the R-R interval. They show the right trends but are simplified for teaching, not measurement.
Interactive 2D ECG strip-chart simulator. A real Gaussian-pulse PQRST waveform generator scrolls a single-lead trace like a bedside cardiac monitor, with heart rate measured live from the actual R-R interval and genuine arrhythmia modes (A-Fib, V-Tach, bradycardia, PVC).
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install