Heart-Rate Display with a MAX30102 and a Pico
Rest a fingertip on an optical sensor and watch your pulse wave and beats per minute on a tiny OLED — a learning project, not a medical device.
The MAX30102 shines red and infrared light into your skin and measures how much bounces back. Each heartbeat pushes a bit more blood through the capillaries, so the reflected light pulses. Counting the peaks over time gives beats per minute.
This is not a medical device and must not be used to diagnose or monitor any health condition. If you have health concerns, see a doctor.
Mission steps
Wire the I2C bus
Connect the MAX30102 and the OLED to the same I2C pins: SDA to GP4, SCL to GP5, power from 3V3 and GND.
Flash MicroPython
Install MicroPython on the Pico 2 W and add a community MAX30102 driver plus the ssd1306 driver with Thonny or mip.
Read raw samples
Read IR values about 100 times per second and plot them in Thonny's plotter; you should see a clear wave.
Detect beats
Subtract a moving average, find the peaks, and average the time between the last few beats to get BPM.
Show it
Draw the scrolling pulse wave and the BPM number on the OLED.
Questions
Why does the number jump around?
Finger movement and pressing too hard ruin the signal. Rest your finger lightly and keep still for 10 seconds before reading.