0% found this document useful (0 votes)
79 views20 pages

Arduino Pulse Oximeter: by Nate and Ben

This document describes how to build a low-cost pulse oximeter using an Arduino. A pulse oximeter measures blood oxygen levels using principles of Beer-Lambert's law and light absorption properties of oxygenated and deoxygenated hemoglobin. The design uses an Arduino, dual-LED light source, photodiode detector, and various resistors and capacitors. Instructions are provided on circuit assembly, code, and safety considerations for a device intended to monitor blood oxygen levels over time for healthcare purposes.

Uploaded by

Yafi Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views20 pages

Arduino Pulse Oximeter: by Nate and Ben

This document describes how to build a low-cost pulse oximeter using an Arduino. A pulse oximeter measures blood oxygen levels using principles of Beer-Lambert's law and light absorption properties of oxygenated and deoxygenated hemoglobin. The design uses an Arduino, dual-LED light source, photodiode detector, and various resistors and capacitors. Instructions are provided on circuit assembly, code, and safety considerations for a device intended to monitor blood oxygen levels over time for healthcare purposes.

Uploaded by

Yafi Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

instructables

Arduino Pulse Oximeter

by Nate and Ben

Arduino Pulse Oximeter: Page 1


Pulse oximeters are standard instruments for hospital 10 kOhm Resistor - $0.10 (Mouser.com)
settings. Using the relative absorbances of
oxygenated and deoxygenated hemoglobin, these 100 kOhm Resistor - $0.12 (Mouser.com)
devices determine the percentage of a patient's blood
that is carrying oxygen (a healthy range being 94- 47 nF Capacitor - $0.16 (Mouser.com)
98%). This gure can be lifesaving in a clinical setting,
as a sudden drop in blood oxygenation indicates a *(Our Nano is stuck in China at the moment, so we
critical medical problem that needs addressed used an Uno, but both will work)
immediately.
Total Cost: $5.55 (But... we had a bunch of things lying
In this project, we attempt to construct a pulse around and bought a few spare parts as well)
oximeter using parts that are easy to nd online/in a
local hardware store. The nal product is an S e c o n d a ry Pa r t s List - Things that were lying
instrument that can provide enough information for around for us, but you might need to buy
someone to monitor blood oxygenation over time for
only $x. The original plan was to make the device fully Copper Clad Board - Fairly cheap (Example). In place of
wearable, but due to factors outside of our control, this, you can make and order a PCB.
this wasn't possible in our timescale. Given a few more
components and a bit more time, this project could PVC - Something at least an inch in diameter. The
become completely wearable and communicate thinner kind works great.
wirelessly to an external device.
Wires - Including some jumper wires for the
Supplies: breadboard and some longer ones to connect the
oximeter to the board. In step 20 I show my solution
Esse n t ia l Pa r t s List - Things you probably need to
to this.
buy (We recommend to have a few spare of each
component, especially the surface mount pieces)
Female Pin Header - These are optional, if you just
want to solder wires to the boards it will work just
Arduino Nano* $1.99 (Banggood.com)
ne.

Dual-LED - $1.37 (Mouser.com)


Foam - I used L200, which is pretty speci c. You can
really use anything you think will be comfortable. Old
Photodiode - $1.67 (Mouser.com)
mousepads are great for this!

150 Ohm Resistor - $0.12 (Mouser.com)


LEDs and Resistors - Pretty cheap if you need to buy
them. We used 220 resistors and had a few colors
180 Ohm Resistor - $0.12 (Mouser.com)
lying around.

Re c o mme n d e d To o ls a n d Equipme n t Dremel Tool with Routing and Cutting bits (You can get by
with a utility knife, but not as quickly)
Heat Gun
Pliers, Wire cutters, Wire Strippers, etc.
Soldering Iron with a Fine Tip

https://vimeo.com/413374861

Arduino Pulse Oximeter: Page 2


Step 1: Preparation: Beer-Lambert's Law

In order to understand how to build a pulse oximeter, Io = Incident light (before added sample)
it is rst necessary to understand the theory behind I = Incident light (after added sample)
its operation. The principle mathematical equation = Molar absorption coe cient (function of
used is known as Beer-Lambert's Law. wavelength and substance)
b = Path length of light
Beer-Lambert's law is a well-used equation that c = Concentration of substance in sample
describes the relationship between the concentration
of a substance in a solution and the transmittance (or When measuring concentrations using Beer's Law, it's
absorbance) of light passed through said solution. In convenient to select a wavelength of light in which
a practical sense, the law says that increasingly the sample absorbs most. For oxygenated
greater amounts of light are blocked by increasingly hemoglobin, the best wavelength is about 660nm
greater particles in a solution. The law and its (red). For deoxygenated hemoglobin, the best
components are described below. wavelength is about 940nm (Infrared). Using LEDs of
both wavelength, the relative concentration of each
Absorbance = log10(Io/I) = bc can be calculated to nd a %O2 for the blood being
measured.
Where:

Step 2: Preperation: Pulse Oximetry

Our device uses a dual LED (two LEDs on the same chip) for the 660nm and 940nm wavelengths. These are
alternated on/o , and the Arduino records the result from the detector on the opposite side of the nger from the
LEDs. The detector signal for both LEDs pulses in time with the heartbeat of the patient. The signal can thus be
divided into two portions: a DC portion (representing the absorbance at the speci ed wavelength of everything but
the blood), and an AC portion (representing the absorbance at the speci ed wavelength of the blood). As speci ed
in the Beer-Lambert section, Absorbance is related to both of these values (log10[Io/I]).

%O2 is de ned as: Oxygenated Hemoglobin / Total Hemoglobin

Substituting in the Beer Lambert Equations, solved for concentration, the result is a very complex fraction of
fractions. This can be simpli ed in a few ways.
Arduino Pulse Oximeter: Page 3
1. The path length (b) for both LEDs is the same, causing it to drop out of the equation
2. An intermediate ratio (R) is used. R = (AC640nm/DC640nm)/(AC940nm/DC940nm)
3. Molar Absorption coe cients are constants. When divided, they can be replaced with a generic t
factor constant. This causes a slight loss in accuracy, but seems to be pretty standard for these
devices.

Step 3: Preperation: Arduino

The Arduino Nano required for this project is known as a microprocessor, a class of devices that continuously runs a
set of preprogrammed instructions. Microprocessors can read inputs to the device, do any required math, and write
a signal to its output pins. This is incredibly useful for any small-scale project that requires math and/or logic.

Step 4: Preperation: GitHub

GitHub is a website that hosts repositories, or spaces for collections of sketches for a project. Ours is currently
Arduino Pulse Oximeter: Page 4
stored in https://github.com/ThatGuy10000/arduino-pulse-oximeter. This allows us to do several things.

1. You can download the code for yourself and run it on your personal Arduino
2. We can update the code at any point without changing the link here. If we nd bugs or decide to do
math di erently, we will push out an update that will be accessible here immediately
3. You can edit the code yourself. This will not cause an immediate update, but you can create a "pull
request" that asks if I want to include your changes in the master code. I can accept or veto these
changes.

For any questions on GitHub or how it works, see this tutorial published by GitHub itself.

Step 5: Safety Considerations

As a device, this is about as safe as it can get. There is very little current, and nothing is operating over 5V. In fact,
the circuit should be more scared than you are.

In the construction process though, there are some key things to keep in mind.

Knife safety should be a given, but some of the parts have a very organic shape which can make it
tempting to hold them in a spot where your ngers really shouldn't be. Just be ca re f ul .
If you own a soldering iron, heat gun, or a dremel tool, I assume you should know how to use them
properly. Regardless, take the necessary precautions. Do no t work through frustrations. Take a
break, clear your head, and get back to it when you are more stable. (Safety information for the
soldering iron, heat gun, and dremel tools can be found in the links)
As you test any circuits or move things around on a breadboard, it's best to turn everything o . There
really isn't a need to test anything with live power, so do no t risk causing shorts and potentially
damaging the Arduino or other components.
Be careful when using the electronic components in and around water. Wet skin has a signi cantly
lower resistance than dry skin, which can cause currents that exceed safe levels. Further, electric
shorts in board components can cause signi cant damage to components. Do no t operate
electrical equipment near liquids.

WARNING : Please do not try to use this as a true medical device. This device is a proof of concept, but it is NO T a
perfectly accurate instrument that should be used in the care of potentially sick individuals. There are plenty of
cheap alternatives you can buy that provide a much higher level of accuracy.

Step 6: Tips and Tricks

As the project developed, there were a number of lessons learned. Here are a few bits of advice:

Arduino Pulse Oximeter: Page 5


1. When you're making the circuit boards, more separation between traces is your friends. Better to be
on the safe side. Even better is to just order a PCB from a service like Oshpark that will do small
boards like these for a reasonable price.
2. On a similar note, watch out if you decide to apply power to the circuit boards before covering them.
The photodiode is especially touchy, and it's just not fun if it's broken when you get to it. It's better to
test the components without power and have faith that it will turn out. The diode and continuity
settings are your friends.
3. Once you have everything built, it's pretty cut and dry, but one of the most common errors was
having the LEDs circuit board connected incorrectly. If your data is weird, check the connection, and
potentially try connecting one of the LED connections to the Arduino at a time. Sometimes things
become clearer that way.
4. If you are still having trouble with the LEDs, you can connect 5V power into their inputs. The red will
be quite bright, but the infrared is invisible . If you have a phone camera on you, you can look
through it and you'll see the infrared light. The phone's camera sensor shows it as visible light, which
is really convenient!
5. If you're getting a lot of noise, check that the photodiode board is far away from anything carrying
the nasty 60Hz power from the wall. The high value resistor is a magnet for additional noise, so
beware.
6. Math for calculating SpO2 is a little tricky. Follow the code provided, but make sure to edit the
" tFactor" variable to make the calculations t your particular device. This requires trial and error.

Step 7: Constructing Circuit Boards

We'll start by making the two circuit boards that go into the design. I used a two-sided copper clad board and
Dremel tool to make these by hand, which was not perfect, but it worked. If you have the resources I highly
recommend drawing a schematic and having this milled with a machine, but it is do-able without.

Step 8: Board 1 - the Photodetector

Here is the circuit I put on the rst board, minus the capacitor. It's best to keep a low pro le, since this is going to go
Arduino Pulse Oximeter: Page 6
around your nger inside of the oximeter. The photodetector, in this case, is a photodiode which means that it is
electrically similar to a diode, but will generate current for us based on the light level.

Step 9: Milling the Board

I decided to start by printing and cutting out a scale This is available at the vendor's sight for the
model of the recommended footprint. Because I'm photodetector.
just eyeballing my cutting, this gave a good reference
before I took the photodetector out of its package.

Step 10: Drilling Down

Arduino Pulse Oximeter: Page 7


This is the design I went with for the PCB, which I cut There is a non-connected pin on the chip that should
out with a small dremel router bit and a utility knife. get its own pad, since it doesn't connect to anything
My rst build of this board ended up faulty for a else but still helps to hold the chip to the board. I also
couple of reasons. The lessons I learned for my second added holes for the resistor, which I made by placing
build were to cut more than just the minimum and to the resistor next to it and eyeballing the holes.
cut out where I drew a black line on the image above.

Step 11: Placing Components

This part is a bit tricky. I've marked the orientation of the board is liquid, it should connect with the chip
the photodetector here in white. I put a tiny bit of pretty quickly if you have enough solder on. You
solder on the bottom of each pin on the chip, put should also solder the 100k resistor a 3-pin header
some solder on the circuit board, and then held the to the same side of the board.
chip in place as I heated the solder on the board. You
don't want to heat it up too much, but if the solder on

Step 12: Cleaning and Checking

Arduino Pulse Oximeter: Page 8


Then, use the dremel tool to cut out the copper a nal check, use the diode measurement of the
around the resistor leads on the backside of the board multimeter (Tutorial if this is new tech for you) across
(to avoid shorting the resistor). Afterwards, use a the photodiode to make sure it's fully attached to the
multimeter on its continuity mode to check that none board.
of the traces were shorted in the soldering process. As

Step 13: Board 2 - the LEDs

Here is the schematic for the second board. This one is a bit more di cult, but luckily we are warmed up from doing
the last one.

Step 14: Drilling Down Redux

Arduino Pulse Oximeter: Page 9


After several attempts that I didn't like so much, I the circuit). The most important part of this cutting is
settled on this pattern, which I drilled using the same the intersection where the LED chip will sit. This
dremel routing bit as before. From this image, it is crosshair pattern needs to be pretty small because the
hard to tell, but there is a connection between two connections on the LED chip are pretty close together.
parts of the board through the other side (ground in

Step 15: Soldering Vias

Because two opposite corners of the LED chip both into the hole and soldered on both sides. I cut o as
need to be connected, we need to use the backside of much excess wire as I could and did a continuity check
the board to connect them. When we electrically to see that there was near-zero resistance between
connect one side of the board to the other, that's these two areas. Unlike the last board, this vias will
called a "via." To make the vias on the board, I drilled a not need to be outlined on the backside because we
hole in the two areas I've marked above. From here, I want them to be connected.
put the leads of the resistor on the previous board

Arduino Pulse Oximeter: Page 10


Step 16: Soldering the LED Chip

To solder the LED chip, follow the same procedure as marked what numbers attach at which points. Once
the photodiode, adding solder onto each pin and to you've soldered it on, you should again use the diode
the surface as well. The orientation of the part is test setting on the multimeter to see that both sides
tough to get right, and I recommend following the are attached properly. This will show you which LED is
datasheet to get your bearings. On the underside of the red one too, since it will light up a little when the
the chip, "pin one" has a slightly di erent pad, and the multimeter is connected.
rest of the numbers continue around the chip. I've

Step 17: The Rest of the Components

Next, solder on the resistors and the 3-pin header. If you happened to have the LED chip ipped 180° in the
previous step, you are actually still ne to continue. When you put on the resistors, make sure the 150 resistor
goes on the red side, and the other side has the 180

1. Infrared goes with the 180 resistor


2. Red goes with the 150 resistor

Arduino Pulse Oximeter: Page 11


Step 18: Finishing and Checking

On the backside, cut around the resistors like before to avoid them shorting with the via. Cut out the board, and do
one last sweep over with the continuity tester on the multimeter, just to double check that nothing became
shorted accidentally.

Step 19: "Potting" the Boards

After all of the ne soldering work I did, I wanted to oximeter. I tested out a few things I had lying around,
make sure nothing would knock the components o and this industrial strength adhesive worked well. I
while the oximeter was being used, so I decided to started by covering the backside and letting it sit for a
"pot" the boards. By adding a layer of something non- few hours.
conductive, all the components will stay in place
better and will provide a atter surface for the

Step 20: Potting Continued


Arduino Pulse Oximeter: Page 12
After the bottom is solidi ed, ip over the boards and to just cover them, just make sure to avoid air
coat the top. Even though it's a nearly clear adhesive, I bubbles. It's ne to put as much adhesive as you want
wanted to keep the photodetector and LEDs on (within reason), since a atter surface will sit more
uncovered, so before covering everything, I covered comfortably and add more protection to the
both with tiny pieces of electrical tape and after a few components, just make sure to let it sit for a while so
hours, I used a knife to carefully remove the adhesive it can dry throughout.
on top of these and took the tape o . It might not be
necessary to keep them uncovered, but if you decide

Step 21: Constructing Wires

I only had stranded wire on hand, so I decided to use each wire to a pin on the header, and if you have it I
some male 3-pin header to create some cables. If you would coat each strand with some heat-shrink. M a ke
have it on hand, it's much simpler to just use solid s ure y o u ha v e t he w ire s in t he s a m e o rde r
gauge wire for this without soldering. It does help to w he n y o u co nne ct t he he a de r o n t he o t he r
twist the wires together though, since that prevents s ide .
snagging and just generally looks neater. Just solder

Arduino Pulse Oximeter: Page 13


Step 22: Idiot-Proofing the Wiring

Because of the way I connected these boards to cables, I wanted to make sure I never connected them wrong, so I
color coded the connection with paint markers. You can see here which pin is which connection and how my color
coding works.

Step 23: Making an Enclosure

The enclosure for the oximeter I made with L200 foam and a piece of PVC pipe, but you can certainly use whatever
foams and/or plastics you have lying around. The PVC works great because it is already nearly in the shape we want.

Step 24: PVC and Heat Guns

Using a heat gun on PVC for shaping is simple, but can take some practice. All you need to do is apply heat to the
PVC until it starts to bend freely. While it's hot, you can bend it into just about any shape you want. Start out with a
Arduino Pulse Oximeter: Page 14
section of PVC pipe just wider than the boards. Cut one of the sides, and then just put some heat on it. You'll want
some gloves or some wood blocks to be able to maneuver the PVC while it's hot.

Step 25: Shaping the Plastic

As you bend the loop in, cut o some any excess PVC. somewhere to grab in order to open the oximeter to
Before you have it completely bent in, use a knife or put it on your nger. Don't worry about the tightness
dremel tool to carve out a notch on one side and the for now, since you'll want to see how it feels once the
edges of the opposing side. This forked shape allows foam and boards are in.
you to close the loop further. It also gives you

Step 26: Something a Bit Softer

Next, cut a piece of foam to the width of your PVC, and to a length that will fully wrap around the inside loop.

Arduino Pulse Oximeter: Page 15


Step 27: A Place for the Boards

To keep the board from digging into your nger, it's under the foam. At this point, you can put the boards
important to recess them into the foam. Trace the and foam into the PVC and test out the t in the
shape of the boards into the foam and use a pair of actual PVC and then on your nger. If you do this start
scissors to excavate the material. Instead of clearing to lose circulation, you will want to use the heat gun
the entire area around the headers, add some slits on again to open up the enclosure a little bit more.
the side connectors can pop out but still be slightly

Step 28: Boards Into Foam

We're going to start putting it all together now! To start, just throw some epoxy/adhesive into the holes you just
made in the foam and put the boards into their little homes. I used the same adhesive I used to pot the boards
earlier, which seemed to work just ne. Make sure you let this sit for a few hours before moving on.

Arduino Pulse Oximeter: Page 16


Step 29: Foam Into Plastic

Next, I lined the inside of the PVC with the same glue and carefully put the foam inside. Wipe the excess and put
something inside for the foam to chomp on. My utility knife worked well, and it really helps to push the foam
against the PVC to get a strong seal.

Step 30: The Arduino Connection

At this point the actual sensor is completed, but of course we want to use it for something. There isn't much to
connect to the Arduino, but it's incredibly important not to wire anything backwards or you will very likely damage
things on the circuit boards. M a ke s ure po w e r is t urne d o w he n y o u a re co nne ct ing t he circuit s (It
really is the safest way to avoid problems).

Arduino Pulse Oximeter: Page 17


Step 31: The Remaining Resistor and Capacitor

A few notes on wiring into the Arduino:

The capacitor from the signal to ground does wonders on the noise. I didn't have a wide selection, so
I used the "dad's junk bin special," but if you have variety then go for something around 47nF or less.
Otherwise you might not be able to have a fast switching speed between the red and IR LEDs.
The resistor going into the photodetector cable is a safety thing. It isn't necessary, but I was scared
that while handling the breadboard circuit I might accidentally short something and botch the
whole project. It won't cover every accident, but it just helps to have a little more piece of mind.

Step 32: Testing LED Current

Arduino Pulse Oximeter: Page 18


Once I had these in, test the current going through the red and IR LEDs using a multimeter on the ammeter mode.
The goal here is to just check that they are similar. Mine were at around 17mA.

Step 33: The Code

As stated in the preparation step, the code for this device can be found in our GitHub repository. Simply:

1. Download this code by clicking "Clone or download"/"Download Zip".


2. Unzip this le using 7zip or a similar program, and open this le in Arduino IDE.
3. Upload it to your Arduino and connect the pins as described in the pin assignments (or change them
in the code, but realize you'll have to do this every time you redownload from GitHub).
4. If you want to see a Serial output on the serial monitor, change the serialDisplay boolean to True. The
other input variables are described in the code; the current values worked well for us, but you can
experiment with others to achieve the optimum performance for your setup.

Step 34: Circuit Diagram

Step 35: Further Ideas

Arduino Pulse Oximeter: Page 19


We would like to add (or one of our many followers might think about adding)

1. Bluetooth connection for exchanging data with a computer


2. Connection to a Google Home/Amazon device to request SpO2 information
3. More ushed out math for calculating SpO2, as currently we have no reference for comparison. We
are simply using math that we found online.
4. Code for calculating and reporting the heartbeat of the patient, along with SpO2
5. Using an Integrated Circuit for our measurements and math, eliminating much of the variability for
our output.

Really nice job on your tutorial :)

Arduino Pulse Oximeter: Page 20

You might also like