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.

Soon, I’ll post part II. 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)

mike AVR Projects , , , , , , ,

C library for Arduino – Preview

November 1st, 2009

I’m working on a C library for Arduino hardware. The goal is to make it just as easy as the Arduino programming language but in plain standard C. The Arduino language is halfway between C and C++. While Arduino hardware uses the same Atmel atmega168 and atmega328 that I’ve come to love, the software does not allow me to code in standard C. It prevents one from being able to borrow all of the standard C and assembly (easily) that is out there for AVR micros. More importantly, it means that I have to load up a java IDE instead of just using the GNU command line tools such as avr-gcc, avr-libc, and make. By using the Arduino hardware, we get access to mass produced hardware and the Arduino bootloader. The Arduino hardware is handy because we can program it over the same interface as we use for printf() debugging. Also, since it can get its power over USB, it bundles up lots of the initial hurdles of getting started with micros.

Already the library supports:
serial – printf(), getchar(), etc
standard I/O – easily make pins input or output, set pins high and low
pwm – LED brightness, motor control
pwm servo – control RC servos
adc – read analog values

Here is a preview reading analog in with the ADC and controling the brightness of an LED using PWM:

I’m still working on making the wiki page match this blog and storing the code in SVN. For an early preview, check out http://tinkerish.com/wiki/.

mike Uncategorized

Parts ordered – DIY pulse oximeter

October 31st, 2009

I just ordered the parts for my next project: to build my own pulse oximeter. Ever seen those things at the hospital that they clip onto your finger? It measures your pulse and how much oxygen you have in your blood. It is considered one of the five vital signs that they monitor when you are in the hosipital. I wanted to explore how they work and end up with one that I can use at home. In particular, I want to be able to log and store the results. While off the shelf ones exist for just under $100, I figure I can build something for under $25 that could log to an SD card or display in real time on a PC.

Background Reading
Wikipedia page on pulse oximetery
principles of how pulse oximetery works
a light intensity to digital frequency part I chose to work with.

Parts Ordered So Far
(1) a TSL230R IC – chip to convert light intensity to something our AVR can read (in this case a digital frequency to measure with our timer counter)
(2) an IR (infra-red) LED – 940nm wavelength
(3) a red LED – 660nm wavelength
* note: all of the links above are to Sparkfun.com and should work great for this project. The LEDs that I ordered will be slightly different because I purchased them from a different source (only because they were out of stock at the time).

Quick Theory of Operation
As your heart circulates blood, your arteries constrict and expand. Also, your lungs add oxygen to the blood making it more red in color. By using a light intensity sensor and some LEDs we can get our pulse rate from the constricting and expanding and we can get the oxygen saturation from the amount of red in the blood.

Ever put a flash light against your cheek to see the light shine through the other side? Just like that, we are going to place LEDs on one side of the finger and measure light on the other side. As the heart beats we should see our output fluctuate with our heartbeat. The IR from our IR led should be pretty uniform in how much it gets absorbed through the finger. I am expecting to see the heartbeat from this with an AC component that changes as the capillaries constrict and expand. The light from our red LED should get absorbed more when the blood is oxygen rich. I am expecting to be able to contrast this with our waveform from the IR led to be able to figure out the oxygen saturation.

Electronics

The output from our TSL230R is a digital output in the form of a frequency. Our AVR will look at this on one of its interrupt pins. We can then use a 16bit timer counter to measure the pulses. These measurements will be equal to the light intensity that the TSL230R sees. The AVR will also control the red and IR leds. This will allow us to turn then on one at a time as we make our measurements.

The first step will be to output to serial (/dev/ttyUSB0). I can then graph the output to make since of it and debug. After that, I will attempt to pull as much of the processing as possible into the AVR. The goal will be to log the pulse rate and oxygen concentration to the SD card. An LCD may also be added. Last, I may add a peizo buzzer so that it can alert you when the measurements are not accurate or if there is a problem.

Anyone wishing to follow along at home should get some parts on order :-)

mike AVR Projects , , , , , ,