Pulse sensor

The Pulse Sensor Amped: a green LED, a light sensor and an amplifier that put a fingertip's pulse on one analog wire. Aliases: PulseSensor, PPG sensor.

The LED shines into the fingertip and the light sensor sees how much comes back. Each heartbeat pushes a little more blood into the skin, which takes a little more of the light, and the amplifier turns that into a wave on S. With no finger, S sits at half the supply.

Pins

Pin What it does
S The pulse wave, the purple wire. Read it with analogRead().
VCC Supply, 3 V to 5.5 V, the red wire.
GND Ground, the black wire.

Properties

bpm is the heart rate it starts with, 72, or 0 for no finger. swing is how far the main peak rises above the middle, 0.8 V by default, an assumption for a finger held still.

While it runs

The slider is the heart rate, 30 to 200 beats a minute; all the way left is no finger. The heart on the board beats with each main peak.

What the model gets right

The middle. S sits at half the supply, about 512 counts on a 5 V Uno, and the wave rides on it, so a threshold a little above the middle (PulseSensor Playground's default is 550) catches each beat.

The shape. Each beat is a quick rise to the main peak, a fall with a smaller bump (the dicrotic notch) and a shallow dip before the next. A sketch that triggers on any rise above the middle counts the notch as a second beat; one that waits for the main peak does not.

The rate. The beats come exactly 60000 / bpm milliseconds apart.

What it does not model

The light itself, a finger that moves or presses too hard, the slow drift as a finger settles, and the small variation from beat to beat of a real heart. The wave is a stand-in with its features in the right places, not a recording.

Libraries

PulseSensor Playground (PulseSensorPlayground.h) samples S every 2 ms in the background on the Uno, Nano, Pro Mini and Mega, finds each beat and keeps the heart rate: pulseSensor.getBeatsPerMinute() and pulseSensor.sawStartOfBeat().

Common mistakes

Counting every rise above the middle. Use a threshold over the notch's height, or the library, which does.

Reading it once a second. A beat lasts well under a second; sample every few milliseconds or let the library do it.

See it in action

Heartbeat monitor draws the wave on an OLED with the heart rate above it. Open it at /templates.