I knew about heartbeat sensors that use light, and I have seen Android applications that use your phone’s camera to measure your heart rate.
I didn’t need to do this live, so I just recorded a video of my finger on the camera using my phone. I then wrote a quick Python script to run the video through ffmpeg to iterate over each frame as an image.
I used the average pixel lightness as a measure of the amount of light that gets absorbed/reflected. When I plotted this value over time, it looked very obviously like a heartbeat. Like a very typical heartbeat, you can’t miss it.
This was underwhelmingly easy. Perhaps a future project could be to do post-process this data with some filters, or to do it live.