Monitor Your Heartbeat With A Webcam And A Flashlight

After seeing some heart rate monitor apps for Android which use the camera and flashlight features of the phones, [Tyson] took on the challenge of coding this for himself. But he’s not using a smart phone, instead he grabbed a headlamp and webcam for his heat rate monitor.

To start out he recorded a test video with his smart phone to see what it looks like to cover both the flash LED and camera module with his thumb. The picture is mainly pink, but there’s quite obviously a color gradient that pulses with each gush of blood through his skin. The next task was to write some filtering software that could make use of this type of image coming from a webcam. He used C# to write a GUI which shows the live feed, as well as a scrolling graph of the processed data. He took several tries at it, we’ve embedded one of the earlier efforts after the break.

15 thoughts on “Monitor Your Heartbeat With A Webcam And A Flashlight

      1. Just search for “heart beat” and you will find dozens, many of them free.

        In terms of what I can vouch for personally, the one that uses your face is called “What’s my heart rate” (by ViTrox Technologies) and the other two I have installed that us the lamp/finger are both called “Heart Rate” (one by “CMG Research” and the other by “Modula d.o.o.”)… All of those are free also.

      2. And those apps I just mentioned are the iPhone ones. I have one on my Android Tablet (Acer Iconia) as well but I don’t have that with me so I can’t tell you the specific one.

      3. so far, the only one i can get working is HeartScan which uses the mic

        pretty much all of the camera based ones dont work, but i’ll try What’s my heart rate and the others next

      4. I haven’t tried the mic based ones… I can’t imagine they would be accurate. The three I listed, at least on my new iPhone, work beautifully and are very accurate. The one on my android tablet is accurate as well. If they’re not working for you, try again, you may be doing something wrong. If you’re trying the finger+light+cam ones and they’re not working, it might be a pressure issue — pressing too hard will cut off the bloodflow, and too light and there’s too much noise in the signal to get a read. Just a light even pressure works best.

  1. This probably works due to the small infrared content of incandescent white light, and the inherent sensitivity of most cameras to infrared.
    If you were to take the filter off a cheap webcam as I did and redo the experiment the resulting change in brightness should be more evident.

    Nice hack BTW, wonder if it would also be able to test for SpO2 with differential switching of infrared and visible LEDs on sequential frames?
    The commercial disposable sensors use a pair of LEDs with a thermal feedback element (to keep wavelengths constant) and a calibrated silicon diode.

  2. Come to think of it, a nice hack to Mr Cheap Laptop would be to build a microhub in single chip form) and add TWO webcams.
    Both of them have the IR filter removed, but
    due to the offset 3-D is quite possible.

    Only works if the webcams “play nice” ie slightly different models but identical formats.

    I found the best way to get these filters off is to carefully unscrew the lens, don safety goggles and carefully take wire cutters and squeeze where that little red filter is.
    If you are lucky it will pop off intact without damage to the lens so it can be recycled.

    Full 3-D screen laptop mod coming soon :-)

  3. If you are going to start modding the camera surely it would be more practical to simply use an optical sensor which doesn’t have a built in system to automatically adjust the exposure of the image tending to suppress exactly what you are looking for?

  4. Hi there —

    I do research on, among other things, psychophysiology at Northwestern University.

    I have three questions for you:
    1) would you consider sharing your best algorithm with me for X dollars?
    2) if so, what is X?
    3) you mention in your videos that your heart rate is moving all over — FYI, this is what healthy heart rates do. For people who are not overly stressed, the heart rate should follow a sinewave pattern…it only stays the same over time when people are stressed out, or in certain pathological conditions like PTSD or anxiety disorder. So congrats!

    Take care and thanks for considering it,

    Julia

Leave a Reply to snowrailCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.