Making a pulse oximeter using MAX30102

COVID-19 and pulse oximeter

A good way to know the severity of Covid-19 is to use a passel oximeter. However, there is a global shortage of pulse oximeters. I have built a pulse oximeter using the MAX30102 sensor. This could be helpful if my family member gets infected.


How to connect the ESP8266 to MAX3012

MAX80102 sensor connects to ESP8366 using the I2C interface. The connection was made by referring to the following figure. 3.3k Ohm resistance is also available at 3.3-10k ohms

You have to remember to do the i2c setup with the Wire library.


The sensor I purchased was the following

In order to use MAX30102, you need to install Sparkfun’s library.

I tried to run a sample program (Example8_SPO2).

HR=166… SPO2=76-89

This vital sign is a dead man!!

I scrutinized the content of the program. The code to find SPO2 is included in spo2_algorithm.cpp.

It’s too difficult for me to understand !!

However, direct observation of the sensor values appears to be coming in exactly the get. The code below is a test sketch to get the sensor data.

The RED and IR pulses need to be analyzed to obtain SPO2. So I’ve been gathering information from net.


It is necessary to obtain the values of Red_AC and Red_DC and IR_AC and IR_DC.
The formula for calculating SPO2 is as follows

$$R=\frac{Red_{AC} \div Red_{DC}}{IR_{AC} \div IR_{DC}}$$


Normal SPO2 is 97-99%.


In other words, the normal R value is about 0.54.

However, when calculated using the sensor values, the R value is 1.782

Isn’t this sensor already broken?

Just when I was about to give up, the reciprocal of 1.782 was…


Are the RED and IR values reversed?

In RED Value only mode(ledMode = 1), the red LED is not lit.

I tried shooting it with an IR camera.

Oh… The sensor’s infrared light is glowing.

I need to reverse the IR value and Red value when programming

Assembly and Code

I used a 3D printer to make a sensor mounter. I put a band on my finger to hold it.

The chart below shows the heart rate and SPO2 graph and each moving averages

I have a moving average library to thank.

The red line is SPO2.
The blue line is heart rate.

When I held my breath, my SPO2 was dropping.
My heart rate is also a representation of my breathing.

RED and IR values should be checked !!

It’s important!!


Display SPO2 and heart rate on a real-time graph


The official library has reported the same problem. I’m publishing this article on 5/4-5. I’m hoping that maybe the questioner has seen this article.
I’m praying for a resolution.