Practical: a webcam physiology lab that grades itself against a wrist count

practical:-a-webcam-physiology-lab-that-grades-itself-against-a-wrist-count

This is a submission for the Presage SmartSpectra SDK Challenge.

The camera said 70.4. My friend, counting my wrist pulse with a stopwatch, said 70.

That number only means something because the app also showed me when the camera was wrong: on an earlier try it read 62.5 against a wrist count of 78, and that miss is why the app now works the way it does.

What I Built

Practical turns a laptop webcam into a small physiology lab for students: the classic breathing and heartbeat experiments from a physiology practical, run with nothing touching the body, using the Presage SmartSpectra SDK.

The idea behind it: every experiment has a known right answer, so a class learns the physiology and how far to trust the measurement.

Experiment What you do The answer key
Paced breathing Breathe with a growing and shrinking circle at 6, 10 and 15 breaths a minute The pacer rate
Heartbeat counting Silently count the heartbeats you can feel for 25, 35 and 45 s (Schandry, 1981) Camera pulse × interval length
Mental arithmetic Rest, count back from 1000 in steps of 7, recover Your own rest period
Pulse check A partner counts your wrist pulse for 30 s while the camera measures The partner’s count × 2

Why: physiology hardware (ECG amplifiers, breathing belts, research wristbands) is lab-budget equipment, and psychology research has long leaned on a narrow group of people: 96% of study participants came from Western industrialised countries that are home to 12% of the world’s population (Arnett 2008, quoted in Nature). A webcam is already in every student’s laptop.

Around the experiments, Practical does what a real study would: a consent sheet before the camera turns on, anonymous participant codes, a class results table, CSV/JSON export, and a “withdraw and delete” button.

Demo

Pulse check: wrist 80, camera 82.4, pulse-wave count 81.9

Code

Practical

A webcam physiology lab for students who never got one. Practical runs the classic experiments from a physiology practical (paced breathing, heartbeat counting, mental-arithmetic stress and recovery, and a pulse check against a partner’s wrist count) with just a laptop camera, using the Presage SmartSpectra SDK.

Every experiment has a known right answer (the pacer rate, the hand-counted pulse, the person’s own rest period), so a class learns the physiology and how far to trust the measurement.

Classroom science, not a medical device. Practical makes no diagnosis and no health recommendation.

Why

Physiology hardware (ECG amplifiers, breathing belts, wrist sensors) is lab-budget equipment, so many students learn these experiments from a textbook. And 96% of psychology study participants come from Western industrialised countries, home to 12% of the world’s population (Arnett 2008, quoted in Nature). A webcam is in every laptop.

Pulse check: wrist 80, camera 82.4, pulse-wave count 81.9

Results from real sessions

Built-in laptop…

Electron + the SmartSpectra Node.js SDK, tested on a Windows laptop with its built-in webcam. npm run demo starts it with clearly labelled synthetic data, so you can click through every screen without a camera, an API key or credits. The analysis is plain JavaScript with 14 unit tests.

How It Responds to Human Signals

Practical uses pulse rate, breathing rate, the chest-movement trace, the pulse wave (arterial pressure trace), talking detection, and the SDK’s validation status, all on one clock with the experiment’s phases.

Live, on screen. During paced breathing the camera’s breathing rate and your chest-movement line update as you follow the pacer. During mental arithmetic your pulse is shown live as it reacts to the task. A line under the camera says whether the signal is stable yet, and framing problems are spelled out (“Too dark. Turn on a light in front of you.”).

Hidden when it would bias the result. In heartbeat counting the live pulse is hidden, because seeing it would let you cheat. In the pulse check it is hidden from the partner who is counting.

The first version lied, so I made it check itself. My second pulse check read 62.5 against a wrist count of 78 (−15.5). The readings were swinging between 52 and 72 while my real pulse was steady. Every SmartSpectra reading carries a stable flag (pulse confidence ≥ 40, about ±3 bpm), and my first version averaged everything. Now:

  1. Rates use only readings the SDK marks stable. If there are too few, the app shows “—” instead of a number.
  2. The app counts beats in the raw pulse wave itself, as an independent second reading.
  3. Every result shows a Good / Weak signal box with the share of stable readings, framing problems and talking time.

One more bug the real data found. The SDK repeats its validation status on every frame, so my “only count beats while framing is OK” logic saw thousands of tiny segments and never ran. Merging repeated statuses fixed it, and real chest traces also needed their rare huge spikes clipped before counting.

Results (my laptop’s built-in webcam, real sessions)

Camera pulse vs a partner’s 30-second wrist count (current version):

Who Wrist × 2 Camera (stable readings) Difference Beats counted in the pulse wave
P02 70 70.4 +0.4 — (framing too short)
P04 80 82.4 +2.4 81.9
P05 68 68.1 +0.1 65.5
P06 84 86.3 +2.3 83.0
P07 76 73.8 −2.2 — (camera frame rate too low)
P03 92 no number the app refused: more than one face was in view

All five valid checks were within 2.5 bpm of the wrist count (mean difference 1.5 bpm). The refusal is a result too: with a second face in the picture, the app gave no number instead of a wrong one.

The SDK’s pulse and my own beat count agree. In heartbeat counting, the pulse-wave count matched the SDK’s stable pulse to within about 1 bpm in every interval: 76.2 vs 75.6, 81.0 vs 82.0, 79.0 vs 79.7.

Paced breathing: camera rate vs pacer

Paced breathing (three runs; P07 is the one in the video):

Pacer P04 camera P06 camera P07 camera Counted from chest movement (P04, P06, P07)
6 / min 3.7 6.0 6.2 5.2, 6.0, 6.2
10 / min 9.9 10.3 10.2 9.7, 9.6, 10.2
15 / min 14.0 15.0 15.1 8.0, 10.5, 15.0

In the second and third runs the SDK landed on the pacer almost exactly: 6.0, 10.3, 15.0 and 6.2, 10.2, 15.1. In the first run it read 3.7 at 6 a minute, and the chest-movement trace’s own rhythm was also about 3.6 there, so I most likely breathed slower than the pacer in that block. My own breath counter matches at slow rates but undercounted at 15 a minute in two of three runs, which is why the app shows it as a second opinion, not the answer.

Heartbeat counting: P04 felt 14 of 31.5, 17 of 47.9 and 22 of 59.9 beats, an interoceptive accuracy of 39%. P06 scored 83% (38 of 36.2, 41 of 59.7, 60 of 70). The task exists because people differ this much in how well they feel their own heartbeat.

Mental arithmetic (P04): pulse 89.3 at rest, 82.7 during the sums, 80.5 in recovery. No rise. My “rest” was probably not rest yet; the app reports it as measured rather than as the textbook says it should look.

Where it struggles: in the evening my webcam’s frame rate dropped (“The camera frame rate is too low”), which was the most common framing problem in my sessions. Daylight or a lamp facing me fixed it.

Honest limits: these are 14 sessions from two people (me and one friend, under 7 participant codes) on one laptop. That is a classroom demo, not a validation study. The point of the app is that anyone can run more and see for themselves.

Prize Categories

  • Best Thoughtful Real-World Use: a free teaching lab for physiology and psychology classes, with consent, anonymity, withdrawal and export built in, and every number shown next to the answer it should match.
  • Most Creative or Delightful Use: turning the SDK into its own experiment, where students measure themselves and grade the measurement.

Before anything is measured. Each person reads a plain-language information sheet and ticks five boxes themselves: they are 18 or older; this is a science activity, not a health check; the camera may measure breathing and pulse while an experiment they choose runs; numbers (not video) are stored on this laptop under a code; and they can stop and have their data deleted at any time. Only then is a code like P03 created. Names are never asked for.

While measuring. The camera turns on only after Start is pressed and a red “Camera on” label shows while it runs. “Stop and discard” ends it at once and saves nothing. Electron is told to grant the camera only (never the microphone) and only to the app’s own local page.

What is stored. Only timestamped numbers: pulse and breathing rates with the SDK’s confidence and stable flag, the chest-movement trace, the pulse wave, whether the person was talking, and the SDK’s framing status. They live in the app’s local database on the laptop. No video frames or photos are stored.

What leaves the laptop. SmartSpectra processes video on the device and contacts Presage to authorise the API key. Its optional telemetry (session summaries and readiness reports, which per the SDK never contain raw frames or vitals) is switched off with enableTelemetry: false. Nothing else is sent anywhere unless someone presses Export, and exports use codes only.

Withdrawal. “Withdraw and delete” removes a participant’s consent record and every session immediately.

Not medical. The SDK’s metrics are for general wellness and information. Practical makes no diagnosis and no health recommendation; it is classroom science.

People in this post. The participants are me and one friend, who consented in the app. Only my own face appears in the demo video. The voice-over was generated with ElevenLabs from a script I wrote.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
mvtec,-bmg,-bosch-rexroth-simplify-use-of-machine-vision-on-ctrlx-os

MVTec, BMG, Bosch Rexroth Simplify Use of Machine Vision on ctrlX OS

Next Post
imts-drives-manufacturing-technology-orders-past-$1b-in-september-2026

IMTS Drives Manufacturing Technology Orders Past $1B in September 2026

Related Posts