In this project, we will learn how to interface MAX30100 Pulse Oximeter with ESP32. We will monitor the Blood Oxygen & Heart Rate online on Blynk Application.
Overview
In this DIY IoT Project, we will try to make a Smart Health Monitoring Device that can measure SpO2 (percentage of oxygen in the blood) and heart rate in BPM (Beat Per Minute). This wearable device can be used by athletes to monitor their heart rate and blood oxygen levels during a workout. The Best part of this project is that you can connect this device to an Android app Blynk that will record and regularly update the data for both SPO2 & BPM on the internet. Even anyone can monitor the data from any part of the world as data are uploaded on server.
As there is an availability of online data, so this project can be used to monitor the health of a patient online. The pulse oximeter available in the market is very expensive, but with this simple & low-cost pulse oximeter module, we can make our own device. So let’s learn how to make MAX30100 Pulse Oximeter with ESP32.
You can go through the previous version of this project with ESP8266:
1. MAX30100 Pulse Oximeter with ESP8266 on Blynk IoT App
Bill of Materials
Following are the components required for making this project. All the components can be purchased from Amazon. The components purchased link is given below.
| S.N. | Components Name | Quantity | Purchase Links |
|---|---|---|---|
| 1 | ESP32 Board | 1 | Amazon | AliExpress |
| 2 | MAX30100 Pulse Oximeter Sensor | 1 | Amazon | AliExpress |
| 3 | Connecting Wires | 5 | Amazon | AliExpress |
| 4 | Breadboard | 1 | Amazon | AliExpress |
MAX30100 Pulse Oximeter
The sensor is integrated pulse oximetry and heart-rate monitor sensor solution. It combines two LED’s, a photodetector, optimized optics, and low-noise analog signal processing to detect pulse and heart-rate signals. It operates from 1.8V and 3.3V power supplies and can be powered down through software with negligible standby current, permitting the power supply to remain connected at all times.
Features of MAX30100 Pulse Oximeter
1. Consumes very low power (operates from 1.8V and 3.3V)
2. Ultra-Low Shutdown Current (0.7µA, typ)
3. Fast Data Output Capability
Working of MAX30100 Pulse Oximeter and Heart-Rate Sensor
The device has two LEDs, one emitting red light, another emitting infrared light. For pulse rate, only the infrared light is needed. Both the red light and infrared light is used to measure oxygen levels in the blood.
When the heart pumps blood, there is an increase in oxygenated blood as a result of having more blood. As the heart relaxes, the volume of oxygenated blood also decreases. By knowing the time between the increase and decrease of oxygenated blood, the pulse rate is determined.
It turns out, oxygenated blood absorbs more infrared light and passes more red light while deoxygenated blood absorbs red light and passes more infrared light. This is the main function of the MAX30100: it reads the absorption levels for both light sources and stored them in a buffer that can be read via I2C.
Interfacing MAX30100 Pulse Oximeter with ESP32
We will now interface MAX30100 Pulse Oximeter with ESP32 . The circuit diagram & connection is given below. You can assemble the device exactly as shown in the figure below.
The MAX30100 has I2C Pins. So connect its SDA pin to D21 & SCL pin to D22 of ESP32 Board. The power supply required by MAX30100 is 3.3V. So connect its VCC terminal to 3.3V of ESP32.
Setting up the Blynk Android App
Blynk is an application that runs over Android and IOS devices to control any IoT based application using Smartphones. It allows you to create your Graphical user interface for IoT application. Here we will set up the Blynk application to monitor BPM & SPO2 over Wi-Fi using NodeMCU ESP32.
So download and install the Blynk Application from Google Play store. IOS users can download from the App Store. Once the installation is completed, open the app & sign-up using your Email id and Password.
Now click on “New Project”. In the pop up set the parameters like Project name, Board and connection type as shown in the photo above. For this MAX30100 ESP32 project select the device as ESP32 and connection type as Wi-Fi. Then click on Create.
Now click on the “+” sign to add the widgets. We need to read the value of BPM & SpO2. So select a pair of widget named Value Display & Gauge.
After dragging the widgets, set their parameters as shown in the image above. Click on Value Display and set the pin to “V3” & “V4“. Similarly, in gauge settings, set the output pin to “V3” & “V4”.
After the successful creation of the Project, go back to setting and click on Send Email. You will get an Authenticate ID on registered mail. Save the Authenticate ID for future reference.
Source Code/Program
Once the hardware setup is done, now we need to upload the code to the ESP32 Board. But before that you need to install few libraries.
The library files can be downloaded from here:
1. Arduino MAX30100 Library
2. BlynkSimpleEsp32.h Library
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
#include <Wire.h> #include "MAX30100_PulseOximeter.h" #define BLYNK_PRINT Serial #include <Blynk.h> #include <WiFi.h> #include <BlynkSimpleEsp32.h> #define REPORTING_PERIOD_MS 1000 char auth[] = "w2yoZ3qIQpfq1DmTMYUcEB1Nd3s_HnwO"; // You should get Auth Token in the Blynk App. char ssid[] = "Alexahome"; // Your WiFi credentials. char pass[] = "12345678"; // Connections : SCL PIN - D1 , SDA PIN - D2 , INT PIN - D0 PulseOximeter pox; float BPM, SpO2; uint32_t tsLastReport = 0; void onBeatDetected() { Serial.println("Beat Detected!"); } void setup() { Serial.begin(115200); pinMode(19, OUTPUT); Blynk.begin(auth, ssid, pass); Serial.print("Initializing Pulse Oximeter.."); if (!pox.begin()) { Serial.println("FAILED"); for(;;); } else { Serial.println("SUCCESS"); pox.setOnBeatDetectedCallback(onBeatDetected); } // The default current for the IR LED is 50mA and it could be changed by uncommenting the following line. pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA); } void loop() { pox.update(); Blynk.run(); BPM = pox.getHeartRate(); SpO2 = pox.getSpO2(); if (millis() - tsLastReport > REPORTING_PERIOD_MS) { Serial.print("Heart rate:"); Serial.print(BPM); Serial.print(" bpm / SpO2:"); Serial.print(SpO2); Serial.println(" %"); Blynk.virtualWrite(V3, BPM); Blynk.virtualWrite(V4, SpO2); tsLastReport = millis(); } } |
Output Observation & Reading Value on Blynk from MAX30100 ESP32
Once the code is uploaded, you can open serial monitor and see the following as BPM & SpO2 values are displayed after NodeMCU connects to wifi.
On the Android App, the BPM & SpO2 value is uploaded after a second and you can see a change in gauge and display parameters.
MAX30100 Not Working Troubleshooting
If you purchased the MAX30100 Module shown below, then it might not work as it has a serious design problem. The MAX30100 IC uses 1.8V for VDD and this particular module uses two regulators to achieve this voltage. Nothing wrong with that. However, if you look closely, the SCL and SDA pins are pulled-up via the 4.7k ohm resistors to 1.8V! This means it won’t work well with microcontrollers with higher logic levels.
1st Method
The solution is to remove the resistors from the board (encircled on the image below) and attach external 4.7k ohms resistors to SDA, SCL and INT Pin instead.
After removing all 4.7K Resistor, connect the INT, SDA, SCL pin to the external 4.7K Pull up resistor as shown in the image below.
2nd Method
Similarly you can use the second method to fix this issue if you don’t like the first one. It is enough to cut the path in the place of the red cross and make a jumper as shown by the yellow line. The jumper does not need an insulated wire. You can take a tinned strand from the stranded wire. The board is covered with a protective mask and there is no short circuit to the copper pour.

















6 Comments
Can we use MAX30102 instead of MAX30100
I see in picture, SDA to RXD not to D21. How this is?
Hi, I was wondering how the circuitry would look with a lolin32 lite. It is practically the same board but is doesn’t have a 21 pin. Can I change the pin somewhere in the code? Thanks!
Check the datasheet and find the SDA and SCL pin of the board
can you share the fritzing library pacakge for MAX30100
Hi,
I’m using MAX30102 and I want to know how to get heart rate and SpO2 using it cause the libraries are different for MAX30100 and MAX30102.
and the functions:
pox.getHeartRate()
pox.getSpO2()
doesn’t work with MAX30102