Lifeline is a proprietary project, however there are some open-source concepts that I will discuss here.
Following the design lab final project, Aerobit, we had learned a lot about heart rate monitoring (and actually vowed to never do it again). However, when searching for senior project opportunities, we noticed a heart rate monitor project that was corporate sponsored. Corporate sponsorship means little to no funding concerns, and based on our previous experience we knew we could pull it off. So, we decided to give it a shot. Unfortunately, most of the fun stuff (wireless charging protocols, power saving magic, etc.) is proprietary, but the heart rate monitoring algorithm that I wrote is based on multiple open-source algorithms and is therefore open.
Heart rate monitoring 102
I feel like rule #1 of engineering is "if you want to do something, someone else has probably already tried." There's no doubt that engineering rests on combining the work of others. That's how we got the formulas we got, by leaning on previous researchers' and tinkerers' work. The heart rate monitor is no exception.
The easiest place to start is with an open platform. With the prevalence of hobby electronics nowadays, there's almost always an Open Hardware platform that you can build on. In our case, this was the light pulse sensor from World Famous Electronics. It works based off an ambient light sensor and an LED to read reflection/refraction rates. This data then gets transferred via an analog signal to the microcontroller and can be read from there.
Now, I would be lying if I said it didn't take me much more time than it should have to do my research on this. Particularly, many thresholding and moving threshold strategies simply don't work with this sensor. This is because ambient light sensors adjust to the amount of light in the room and change based on the small fluctuations in light. This means that if you try and read the peak (R) via a threshold, you're going to have a bad time as soon as the lights turn on.
Another thing to note is that complicated algorithms fail. Simplicity means consistency, and consistency is important when you're trying to read heart rate real time. One of the concerns is that we wanted to read the heart rate in the minimum amount of time possible to save power, and this means that if you count one too many or one too few, the heart rate could be off (in our case) by up to 20 BPM. There's a pretty big difference between 50 BPM and 70 BPM when it comes to catching medical emergencies.
To read pulse fast, you can't really just "count the beats." If you count, you really need 60 seconds to get an accurate pulse measurement. Anything else and you're going to be off. However, by reading the IBI (Inter-Beat Interval), you can get a pulse in 2 seconds tops. The IBI also provides a great filtering mechanism. By setting a threshold AND waiting for a certain percentage of the IBI to pass, you can successfully read the peak of a beat more often than not.
This algorithm, a double threshold (time and amplitude) approach was our final one. However, there are quick improvements to be made if you can spare the power cost. Mainly, instead of just reading 2 beats and taking the pulse from the IBI, reading 6 beats and taking the middle IBI would be much more accurate. This is 3 times the readings and therefore 3 times the power consumption however. More data means more accuracy, but everything comes with a cost.
All in all, getting to and adjusting this approach was an extremely difficult portion of the project. The human body is noisy to say the least, but that presents more fun problems to solve!
Despite being one of the most stressful projects of my life, this project taught me an immense amount about all of the little things that go into doing projects on a large scale. Quite simply, this wasn't a fun pet project or a 2-3 week final project, it was a large-scale project with large-scale deadlines. It's also not the project itself that kills you, it's the little things like documentation and debugging that take up all of the time. At the end of the day, I'll be the first to admit that this project was more-or-less a failure, but the lessons learned for both us and our sponsors were immense.