Home > AVR Projects > DIY Arduino Based Pulse Oximeter Part I (with video)

DIY Arduino Based Pulse Oximeter Part I (with video)

January 3rd, 2010

I recently completed the first half of my Pulse Oximeter. Already, one can see some wonderful information about one’s heart and blood from just your finger tip. So far, I’ve interfaced to the TSL230 light sensor, takinging readings, and displaying it in a Python based QT gui. It sounds complicated but its not. Its lots of fun. Check out the video to see the graph of my heart beating from light passing through my fingertip.

Part II is very delayed (and may never happen). I hope to have the heart beats detected so that I can calculate the heart rate. Also, I will be taking measurements from both LEDs and comparing them. By doing this, I hope I can extract the oxygen saturation (amount of oxygen in my blood).

Update: Since filming the video above, I implemented the heartbeat detection and heart rate calculation. In the image below, the heart rate is calculated and show in the upper right. Also, the heart beats are automatically detected and annotated with little hearts.

Screenshot showing automatic heartbeat detection and calculated heartrate (upper right corner)

Screenshot showing automatic heartbeat detection and calculated heartrate (upper right corner)

Source Code
git clone https://code.google.com/p/avr-libarduino-pulseoximeter/
– or –

AVR Projects , , , , , , ,

  1. aspro648
    January 20th, 2010 at 00:08 | #1

    Hey Mike,

    Very cool. I’m looking forward to seeing what you come up with on the SPO2 side. This is the first project I’ve seen using TSL230. Can you post some example code for it?

    I was also interested in how you are going graphing. Can you point me toward some resources or how-tos?

  2. moondoggie
    January 26th, 2010 at 11:12 | #2

    Very nice. Any chance for a schematic/pinouts or some sample source code?

  3. January 29th, 2010 at 14:35 | #3

    I used a custom python script that uses PyQt4. I’ll post it soon when I get a chance to pick up where I left off on this project.

  4. zemiguel
    February 1st, 2010 at 05:21 | #4

    Hi, very nice. I’m trying to do something similar. So I would be very pleased if you give me some highlights in the way you found the beats. Have you done an adaptive threshold?

    thanks in advance

  5. jam
    February 3rd, 2010 at 12:20 | #5

    Hey, I was trying to something almost the exact same. I was wondering if I you could post the code which you are running on your Arduino board. It appears as though you are using this sensor.

    I’m having a hard time getting my light sensor to actually find the light values accurately.

    I would appreciate the help,


  6. February 7th, 2010 at 14:20 | #6

    I wrote a basic peak detector. I did this my the PyQt4 application. Basically, it steps through each value and looks in either direction. If none of the nearby values are higher than it, it assumes it is a peak.

  7. felixk
    April 7th, 2010 at 09:17 | #7

    Can you please post the Arduino code for what you are doing? I bought all the required components, but i can’t get the code right.


  8. April 7th, 2010 at 10:03 | #8

    I just emailed you the code. Let me know if you have any questions.

  9. foomanchu
    April 9th, 2010 at 23:03 | #9

    Hey Mike can you also email me the code as well. I have been having some trouble getting things working correctly.

    Thanks a lot!!!

  10. embmicro
    April 13th, 2010 at 22:53 | #10

    I too am trying to make this work and would really appreciate the code for both the AVR and your PyQt4 program.


  11. Steffen
    June 21st, 2010 at 17:17 | #11

    hey, after reading your article i ordered
    the parts too.
    since yesterday i’m trying to reproduce your work –
    without success :(
    is it possible to mail me your arduino code, too?


  12. June 22nd, 2010 at 13:32 | #12


    I received your request and will happily send you the code. I meant to yesterday but forgot. I don’t have access to it at the moment. If you don’t get anything by tomorrow, please ping me again.

  13. joku
    August 8th, 2010 at 07:04 | #13

    @mike, could you please send the code to me too? Or post it to your blog?

  14. mythgarr
    September 5th, 2010 at 09:00 | #14

    Did you ever get around to putting together a part 2 in this series? I couldn’t find anything on the site or YouTube – it would be great if I could see how you ended up measuring both the red and IR wavelengths.
    Could you send me the arduino sketch for this?
    It would be really fantastic if you either posted the code here or gave me permission to submit it to hackaday for posting (giving you credit, of course).

  15. September 6th, 2010 at 21:23 | #15

    @mythgarr, this article was already posted on hack a day. No, I did not finish the project. I could not get a satisfactory way to calibrate both the white and red LEDs. I think I would need to more carefully select the LEDs and use a constant current device to set the current for each (instead of just trying to tune them with resistors). I don’t have an arduino sketch because, while I use Arduino hardware, I do not use there software stack. I program in straight C and use GNU toolchain. I’d be happy to share the code if you like.

  16. mythgarr
    September 7th, 2010 at 16:33 | #16

    @mike I meant that it would be great if you could post the source code and part 2, but it sounds like those bits never materialized. I’m shopping around on mouser trying to pick out the best LEDs and detectors for a DIY model, although I did find some fairly cheap (~$40) clip-on oximeters online that I might just tap into using serial or whatever protocol they happen to use internally.

  17. mario
    September 22nd, 2010 at 08:10 | #17

    Hi Mike. I am trying to build a pulse oximeter with arduino for a High School Project. Could you please send me the source code?

  18. kerbero
    October 4th, 2010 at 03:02 | #18

    Dear Mike,

    I´m studying about pulse oximeters with arduino to do an University work. Could I to see your code?

    Thanks and congratulations for the pulse oximeter.

  19. Ev
    October 31st, 2010 at 18:03 | #19

    Hey Mike. I really like your arduino based Pulse Oximeter. I am interested in doing this as well. Do you have the source code to go along with this?

  20. paul.christophe
    November 17th, 2010 at 13:56 | #20

    Hi Mike,

    I’m a student at NYU trying to make a heart rate sensor. We have gotten readings, but they aren’t accurate enough to be used consistently. Could you perhaps shed some light on the physicality of the sensor and perhaps your code?


  21. am3
    November 29th, 2010 at 23:49 | #21

    Hi Mike, I was wondering if you could also send me a copy of your Arduino code and any schematics? Any additional info would be greatly appreciated! Thanks, AM

  22. magaraci
    December 1st, 2010 at 12:52 | #22

    Hey Mike,

    I’m a bioengineering student working on a final lab project for this semester, and my group is also trying to build a pulse oximeter using the arduino microcontroller. We are having some trouble with the coding, however, since none of us have much experience with computer programming. Would it be possible for you to email me the source code?


  23. JohnnyC
    December 5th, 2010 at 20:24 | #23

    Hello Mike, I am currently constructing this, i have all the parts but do not seem to be getting an accurate reading, i was wondering if you could send me your arduino code.

    Thank you:)

  24. dillan
    February 22nd, 2011 at 16:47 | #24

    Mike, I’ve been doing work with some of the Polar hear rate monitors from sparkfun, and would be interested in trying your methods. Could I take a peek at your code? Great writeup!

  25. spuder
    February 24th, 2011 at 16:42 | #25

    Mike, I also would like your code. I have the same parts, but have a hard time getting the heartbeats registered.

  1. January 4th, 2010 at 08:35 | #1
  2. January 6th, 2010 at 12:25 | #2
  3. April 22nd, 2010 at 15:34 | #3
  4. May 5th, 2013 at 22:46 | #4
  5. October 23rd, 2014 at 17:12 | #5
You must be logged in to post a comment.