I have previously written several posts about doing an optical pulse monitor as a lab exercise in the applied electronics course or as a project in the freshman design seminar. Most of what I’ve written up as has been the electronics design, with recording using PteroDAQ and post-processing using filters written in Python for display using matplotlib or gnuplot.
I decided today to try writing the software to do the pulse monitor on the Teensy and report the pulse rate out the serial port. This meant sampling at a fixed rate, doing digital bandpass filtering to remove drift and noise that is not eliminated by the electronics, detecting rising edges in the filtered output (with hysteresis to increase noise immunity), and converting the measured period to beats per minute. I used the LED on the board to report the pulses detected (flashing the light synchronized with the pulse).
I also added some tests to see if the pulse has been lost, and only report the pulse rate if there have been enough pulses properly detected since the last loss so that a smoothed pulse rate can be reported.
I output the time, the unsmoothed pulse rate, and the smoothed pulse rate to the serial monitor, and I can save that output to a file for plotting:
Before anyone asks, the pulse rate of 44 bpm is normal for me when resting—this is not likely to be a timing bug.
I’ll also want to try the 240×320 RGB ILI9341 TFT display that I bought, so that I can display the pulse (and maybe the pulse waveform) without needing a USB connection for anything but power.