Chapter 5 · 30 pages · Part: Wearable Sensors
Heart Rate, ECG and Heart Rate Variability
Two devices on the same runner disagree by 15 beats a minute in the middle of an interval session. Which one is right, and how would you know?
Read online PDF 1.3 MB Notebook + data 29 kB Markdown
Learning objectives
- Explain how a chest-strap ECG sensor and an optical sensor each detect a heartbeat, and why they fail in different ways.
- Convert between RR interval and heart rate, and compute RMSSD, SDNN and pNN50 by hand for a short series.
- Compare two devices with bias, mean absolute error, mean absolute percentage error and limits of agreement.
- Describe how heart rate responds to the start of exercise, to steady work and to recovery, and fit a time constant to each.
- Set heart-rate zones three ways and compute a training-load score.
- Report a heart-rate finding to an athlete without overstating it.
Apps
Sections
- 5.1Wearable Sensors at a Glance
- 5.2The Heart as a Signal Source
- 5.3Two Ways to See a Heartbeat
- 5.4From ECG to Beats
- 5.5Heart Rate Variability
- 5.6How Heart Rate Answers Exercise
- 5.7Zones and Load
- 5.8How Good Is the Number?
- 5.9Recording with the Heart App
- 5.10Telling the Athlete
- 5.11Summary
- 5.12Exercises
Lecture slides
Two decks for this chapter, one for each class of the week. Each has a speaker script; text CC BY 4.0.
The Heart as a Signal
Class 9, sections 5.1–5.6 · 30 slides · about 36 min
Zones, Load and Agreement
Class 10, sections 5.6.3–5.12 · 30 slides · about 38 min
Tutorials
From a raw file to an action, with every step runnable in the browser. Case studies are also printed in Part V.
- CS-6 From a chest-strap recording to a recovery number case study, 60 min
- Q-13 Find the beats in ten seconds of ECG quick tutorial, 15 min
- Q-14 Heart rate from beat intervals quick tutorial, 15 min
- Q-15 One night's RMSSD quick tutorial, 20 min
Code listings
- Listing 5.1 Load a strap ECG file and measure its sample rate code/load_ecg.py
- Listing 5.2 R peaks in the style of Pan and Tompkins, then RR intervals code/rpeaks.py
- Listing 5.3 RR intervals to HRV, tested first on the hand example code/hrv.py
- Listing 5.4 An independent check with a library and with the strap's own intervals code/nk_check.py
- Listing 5.5 Gain and time constant of the heart-rate response code/first_order.py
- Listing 5.6 Zones three ways and two load scores code/zones_trimp.py
- Listing 5.7 Agreement statistics, tested on Example 5.6 and run on a real file code/agreement.py
- Listing 5.8 Decode one Heart Rate Measurement message code/hrm-decode.js
- Listing 5.9 A test with known answers (run with `node hrm-decode.test.js`) code/hrm-decode.test.js
- Listing 5.10 Connect to the heart-rate service from a button code/connect.js
The listings and their data are in the notebook download above.
Exercises
25 exercises; 8 are CORE. Answers to selected exercises are at the back of the book.
Concept check
- 5.1 CORE Foundation, 2 min
A runner's wrist sensor shows exactly 170 for four minutes of a hilly run while the runner's step rate is 170 a minute. A chest strap worn at the same time shows 150 rising to 158. What is the most likely explanation?… - 5.2 CORE Foundation, 2 min
Why is RMSSD, rather than SDNN, the usual short-term HRV measure for athletes? Options: It does not need clean beats, so artifacts do not affect it.It is measured directly by the strap.It depends on beat-to-beat… - 5.3 Core, 2 min
A validation study reports limits of agreement of $-12.9$ to $+5.7$ bpm for a wrist sensor against a strap. What does that mean? Options: The sensor's average error is between $-12.9$ and $+5.7$.The sensor correlates… - 5.4 Core, 2 min
For the five intervals 812, 790, 835, 801, 822 ms, the Heart app's formula gives SDNN 15.7 ms and a Python library gives 17.6 ms. The most likely reason is: Options: The app divides by $N$ and the library by $N-1$.The…
Hand calculation
- 5.5 CORE Foundation, 8 min
parts An RR interval is 0.750 s. What is the heart rate? 80 bpm. An RR interval is 1.250 s. What is the heart rate? 48 bpm. A heart-rate message carries a raw RR value of 700. Convert it to milliseconds, give the… - 5.6 Core, 10 min
Six RR intervals from a seated recording: 1010, 985, 1040, 1002, 950, 1013 ms. This is H-3 of the course's strap exercises, first on paper. parts Compute the successive differences and RMSSD. $-25, 55, -38, -52, 63$;… - 5.7 Extension, 12 min
An athlete has a resting heart rate of 55 and a measured maximum of 185. parts What heart rate is 65% of reserve? What is 65% of maximum? 139.5 (about 140); 120. Compute the exponential TRIMP of 40 minutes at a steady…
App lab
- 5.8 CORE Foundation, 40 min
Your first recording (strap exercises H-1, H-2 and H-10). App: Heart, https://apopt.com/heart. Recording: one continuous ECG file, three minutes with dry electrodes then five minutes with wet electrodes, seated. steps… - 5.9 Core, 20 min
App: Heart, https://apopt.com/heart, with the workout example subject-b/workout.csv.gz (34.6 minutes), recording type Workout. parts Analyze with age 30. Record the TRIMP, the zone-sum load and the minutes in each zone.…
Python analysis
- 5.10 CORE Foundation, 20 min
Run Listings 5.1, 5.2 and 5.3 on the resting example. Predict before you run: will RMSSD of the first 6 intervals be larger or smaller than RMSSD of the first 20? Then compute both, and SDNN and pNN50 of the first 20,… - 5.11 Core, 60 min
Strap against wrist (H-6). Wear the strap and a wrist or arm optical device for a session of four one-minute hard efforts with one-minute rests, after a ten-minute easy warm-up. Stop if you feel unwell. parts Export… - 5.12 Extension, 30 min
Sampling rate (H-11). Take every second sample of the resting example (t[::2], x[::2]) so that it runs at about 65 samples a second. Rerun the steps of Listing 5.2 and 5.3. parts What are the new RMSSD and the smallest… - 5.13 Extension, 45 min
Onset and recovery time constants (H-7). Walk or jog at a steady pace for six minutes from rest, then stand still for three. Fit Equation ch05-heart:eq:first to the rise and to the recovery with Listing 5.5. parts… - 5.23 Core, 60 min, case-file data
Case file: the instructor's case file holds chest-strap recordings of several nights of sleep and of an interval session, as CSV files with the columns time (nanoseconds), ecg (millivolts), hr, rr (milliseconds) and…
Body science
- 5.14 Foundation, 25 min
Posture test (H-4). Record five minutes lying down, then five minutes standing, in one file. Report the change in mean heart rate and RMSSD between the last three minutes of each. Which branch of the nervous system… - 5.15 Core, 25 min
Paced breathing (H-5). Breathe at six breaths a minute for three minutes with a metronome (4 s in, 6 s out), then normally for three minutes. Plot the RR series for both parts. Explain what you see. Does the Heart app's… - 5.25 Core, 20 min
After a hard block. An athlete's seven-morning baseline is a resting heart rate of 52 bpm (standard deviation 2.5) and an ln RMSSD of 4.20 (standard deviation 0.10). After a hard training block the next four mornings…
Science of the sport
- 5.16 Foundation, 10 min
Listing 5.6 sorted the 34 minutes of the workout example into zones three ways. A coach asks: “How much of that session was hard?” Using zones 4 and 5 of the five-zone models and zone 3 of the threshold model, answer… - 5.17 Extension, 10 min
A coach sets 30-second hill repeats “at 175 heart rate”. The athlete starts each repeat at 120, and her heart rate approaches about 175 as a first-order response with $ = 30 s$. parts What heart rate does she reach by…
Field collection
- 5.18 CORE Foundation, 10 min
Seven mornings (H-9). Equipment: the strap, the Heart app or the logger. steps Each morning for seven days, on waking and after emptying the bladder, lie or sit in the same position. Record three minutes, breathing… - 5.19 Core, 30 min
The interval test (H-8). App: Heart, recording type Interval test. Equipment: the strap, a track or treadmill, a stopwatch. steps Start one continuous recording. Warm up for ten minutes, easy. Run one hard but…
Build
- 5.20 CORE Core, 90 min
Build step B-5: heart rate from a file, then live (W-1 to W-4, H-13). Work in your Vite project from earlier weeks. Prompt your AI assistant for each part, then test it. parts A page that loads an RR-interval CSV (use…
Communicate
- 5.21 CORE Core, 30 min
Report for a teammate (H-15). With your teammate's written consent (Appendix E; under 18, a parent or guardian's consent and the teammate's own assent), analyze one of their workout recordings in the Heart app. Write… - 5.24 Core, 20 min, case-file data
Case file: write a note of at most 120 words to the athlete whose recordings you analyzed in the previous exercise (the instructor, or your case-file athlete if their case file has strap recordings). Give the…
Check the AI
- 5.22 Core, 10 min
An AI assistant analyzed a one-minute seated recording made just after a hard workout. It reported: “RMSSD is 311 ms, which indicates excellent recovery and very high vagal tone.” The intervals were 602, 598, 330, 920,…
How to cite
Hedengren, J. (Ed.) (2027). Chapter 5: Heart Rate, ECG and Heart Rate Variability. In Data-Driven Athletics: Measuring, Modeling and Coaching Human Performance with Video and Wearable Data (pp. 121–150). IRSRI Sports Research Institute. https://apopt.com/book/pdf/05-heart-rate-ecg-and-hrv.pdf
BibTeX
@incollection{hedengren2027ch5heart,
editor = {Hedengren, John},
title = {Chapter 5: Heart Rate, ECG and Heart Rate Variability},
booktitle = {Data-Driven Athletics: Measuring, Modeling and Coaching Human Performance with Video and Wearable Data},
chapter = {5},
pages = {121--150},
publisher = {IRSRI Sports Research Institute},
year = {2027},
note = {CC BY 4.0},
url = {https://apopt.com/book/pdf/05-heart-rate-ecg-and-hrv.pdf}
}
RIS
TY - CHAP ED - Hedengren, John TI - Chapter 5: Heart Rate, ECG and Heart Rate Variability T2 - Data-Driven Athletics: Measuring, Modeling and Coaching Human Performance with Video and Wearable Data SP - 121 EP - 150 PB - IRSRI Sports Research Institute PY - 2027 N1 - CC BY 4.0 UR - https://apopt.com/book/pdf/05-heart-rate-ecg-and-hrv.pdf ER -