Every heartbeat begins as an electrical impulse in the sinoatrial (SA) node and spreads as a wave through the atria, the AV node and finally the ventricles. This simulation animates that excitation wave across a stylised heart while drawing the matching electrocardiogram (ECG) in real time, so you can see exactly which part of the heart produces the P wave, the QRS complex and the T wave.
Beat period from heart rate: T = 60 / HR seconds. The ECG sample is a sum of Gaussian bumps, V(t) = Σ Aᵢ · exp(−(t − μᵢ)² / 2σᵢ²), one per wave (P, Q, R, S, T). Conduction time over distance d at speed v is t = d / v.
The heart's electrical system would keep firing even if every nerve to it were cut — the SA node is autorhythmic. A standard clinical ECG paper runs at 25 mm/s, so one large 5 mm square equals 0.2 seconds, which is how cardiologists read heart rate straight off the trace.
What does an ECG actually measure? An ECG records the tiny voltage changes on the skin caused by the wave of depolarisation and repolarisation spreading through the heart muscle with each beat.
What are the P, QRS and T waves? The P wave is atrial depolarisation, the QRS complex is rapid ventricular depolarisation, and the T wave is ventricular repolarisation.
Where does each heartbeat start? At the sinoatrial (SA) node in the right atrium — the heart's natural pacemaker, which fires spontaneously and sets the rate.
The AV node slows conduction by about 0.1 s so the atria finish contracting and fill the ventricles first. This delay is the PR interval.
A resting heart rate above about 100 bpm. Beats look normal but are spaced closely together.
A resting heart rate below about 60 bpm. Beats are normal in shape but widely spaced.
Impaired conduction from atria to ventricles. Some P waves are not followed by a QRS, so the ventricles skip beats.
Chaotic, irregular activity with no organised P-QRS-T. The ventricles quiver instead of pumping — a life-threatening emergency.
From about 0.05 m/s in the slow AV node up to roughly 2–4 m/s in the Purkinje fibres.
No. It is an educational model and must not be used for diagnosis. Always consult a qualified clinician.
This simulation models the electrical excitation wave that travels through the heart with every beat, starting at the sinoatrial (SA) node in the right atrium and propagating through the atrioventricular (AV) node, the bundle of His, and the Purkinje fibres to reach the ventricles. The resulting voltage changes are recorded on the skin as the electrocardiogram (ECG), displaying the characteristic P wave (atrial depolarisation), QRS complex (ventricular depolarisation), and T wave (ventricular repolarisation). Users can adjust heart rate and amplitude, and switch between rhythm presets to observe how different arrhythmias distort the normal P-QRS-T pattern.
The ECG was pioneered by Willem Einthoven in the early 1900s and remains the most widely used cardiac diagnostic tool in clinical medicine today, capable of detecting arrhythmias, conduction defects, and myocardial injury within seconds of recording.
An ECG (electrocardiogram) records the tiny voltage changes on the body surface caused by the wave of electrical depolarisation and repolarisation spreading through the heart muscle with each beat. Electrodes placed on the limbs and chest detect these millivolt-scale signals, which are amplified and plotted against time to produce the familiar waveform trace.
Use the Heart Rate slider to set beats per minute between 30 and 200 bpm, and watch both the animated heart diagram and the scrolling ECG trace update in real time. The Rhythm Preset buttons switch between normal sinus rhythm, tachycardia, bradycardia, AV block, and ventricular fibrillation so you can compare how each condition changes the waveform shape and spacing. The Amplitude control scales the vertical mV display, and Pause/Reset let you freeze or restart the trace.
The P wave represents atrial depolarisation as the electrical impulse spreads from the SA node across both atria, causing them to contract. The QRS complex, the tallest and sharpest feature, represents rapid ventricular depolarisation conducted via the bundle of His and Purkinje fibres. The T wave represents ventricular repolarisation as the ventricles reset electrically for the next beat; atrial repolarisation is hidden inside the large QRS complex.
The ECG voltage at each point in the beat cycle is computed as a sum of Gaussian functions: V(t) = sum of A_i times exp(-(t - mu_i)^2 / (2 * sigma_i^2)), where each Gaussian models one wave component (P, Q, R, S, T) with its own amplitude A_i, timing mu_i, and width sigma_i. The beat period is T = 60 / HR seconds, and the phase within each beat is p = t mod T, normalised to 0..1. Ventricular fibrillation is approximated by a sum of incommensurate sine waves at frequencies around 20-100 Hz, replacing the structured Gaussian model.
A standard 12-lead clinical ECG is recorded at 25 mm/s paper speed and 10 mm/mV calibration, so each large 5 mm square equals 0.2 seconds, allowing cardiologists to measure intervals (PR, QRS, QT) and calculate heart rate by dividing 300 by the number of large squares between R peaks. ECGs are used to diagnose myocardial infarction (by ST-segment changes), arrhythmias, conduction blocks, electrolyte imbalances, and drug toxicity within minutes of recording.
Yes, this is a common misconception. A trained endurance athlete may have a resting rate of 35-50 bpm (bradycardia by textbook definition) because their stroke volume is large and each beat pumps more blood; this is a sign of cardiovascular fitness, not disease. Conversely, a normal rate of 70 bpm in a sedentary person may reflect a lower cardiac output per beat. Context, fitness level, and the presence of symptoms always matter far more than the number alone.
Willem Einthoven, a Dutch physiologist, developed the string galvanometer ECG between 1901 and 1903 and published the first systematic ECG recordings of cardiac arrhythmias. He defined the P, Q, R, S, and T wave nomenclature still used today. Einthoven received the Nobel Prize in Physiology or Medicine in 1924 for this discovery. Earlier work by Augustus Waller in 1887 demonstrated that the heart's electrical activity could be recorded from the body surface, but Einthoven's instrument was sensitive and practical enough for clinical use.
The ECG is closely related to the cardiac action potential at the cellular level, where sodium, calcium, and potassium ion channels open and close in sequence to produce the depolarisation and repolarisation currents. The mechanical contraction of the heart (producing the pulse and blood pressure waveform) follows the electrical signal with a short delay. Electromyography (EMG) uses similar surface electrode techniques to record muscle action potentials, and electroencephalography (EEG) records analogous electrical waves from the brain.
Modern smartwatches and fitness bands incorporate single-lead ECG electrodes that can detect atrial fibrillation in real time by analysing R-R interval irregularity. Implantable cardiac monitors can record continuously for up to three years. In biomedical engineering, deep-learning models trained on millions of ECG recordings can now identify conditions such as hypertrophic cardiomyopathy and low ejection fraction from a resting ECG with accuracy approaching that of trained cardiologists.
Researchers are developing high-density multi-electrode mapping systems that can reconstruct three-dimensional electrical activation maps of the whole heart in real time, enabling more precise ablation therapy for complex arrhythmias. Optogenetics is being explored to control cardiac rhythm with light rather than electrical shocks. Computational cardiac models that couple ion-channel dynamics, tissue mechanics, and body-surface ECG prediction are being used to personalise treatment planning and predict which patients are at risk of sudden cardiac death before an event occurs.