In this project, we will learn how to interface MAX30100 Pulse Oximeter with NodeMCU ESP8266. 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 ESP8266.
You can go through the previous version of this project:
1. Interfacing MAX30100 Pulse Oximeter Sensor with Arduino
2. Blood Oxygen & Heart Rate Monitor with MAX30100 & Arduino
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 | NodeMCU ESP8266 | 1 | Amazon | AliExpress |
| 2 | MAX30100 Pulse Oximeter Sensor | 1 | Amazon | AliExpress |
| 4 | 0.96" I2C OLED Display | 1 | Amazon | AliExpress |
| 5 | Connecting Wires | 10 | Amazon | AliExpress |
| 6 | 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 NodeMCU ESP8266
We will now interface MAX30100 Pulse Oximeter with NodeMCU ESP8266 and I2C 0.96″ OLED Display. The circuit diagram & connection is given below. You can assemble the device exactly as shown in the figure below.
Both the MAX30100 & OLED Display has common I2C Pins. So connect their SDA pins to D2 & SCL pins to D1 of NodeMCU ESP8266 Board. The power supply required by OLED Display & NodeMCU is 3.3V. So connect their VCC terminal to 3.3V of NodeMCU.
PCB Designing for IoT Based Pulse Oximeter
The PCB for IoT Based Pulse Oximeter has been designed in EasyEDA online PCB making tool. Below is the front view and Back View of the PCB.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from ALLPCB at 1$ only.
PCB Ordering, Soldering & Mounting
You can use this Gerber file to order high quality PCB for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
After that you can solder all the necessary components as per circuit diagram and make the final product ready.
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 ESP8266.
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 ESP8266 project select the device as NodeMCU 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 “V7” & “V8“. Similarly, in gauge settings, set the output pin to “V7” & “V8”.
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 NodeMCU ESP8266-12E Board. But before that you need to install few libraries.
The library files can be downloaded from here:
1. Arduino MAX30100 Library
2. OkaOLED Library
3. Adafruit GFX Library
4. BlynkSimpleEsp8266.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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
#include <Wire.h> #include "MAX30100_PulseOximeter.h" #define BLYNK_PRINT Serial #include <Blynk.h> #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include "Wire.h" #include "Adafruit_GFX.h" #include "OakOLED.h" #define REPORTING_PERIOD_MS 1000 OakOLED oled; char auth[] = "N-81lOStH83VwUeNuKHOzpLVzqjFXhHO"; // You should get Auth Token in the Blynk App. char ssid[] = "BYNARK"; // Your WiFi credentials. char pass[] = "bynark@123"; // Connections : SCL PIN - D1 , SDA PIN - D2 , INT PIN - D0 PulseOximeter pox; float BPM, SpO2; uint32_t tsLastReport = 0; const unsigned char bitmap [] PROGMEM= { 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x18, 0x00, 0x0f, 0xe0, 0x7f, 0x00, 0x3f, 0xf9, 0xff, 0xc0, 0x7f, 0xf9, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xf7, 0xff, 0xf0, 0xff, 0xe7, 0xff, 0xf0, 0xff, 0xe7, 0xff, 0xf0, 0x7f, 0xdb, 0xff, 0xe0, 0x7f, 0x9b, 0xff, 0xe0, 0x00, 0x3b, 0xc0, 0x00, 0x3f, 0xf9, 0x9f, 0xc0, 0x3f, 0xfd, 0xbf, 0xc0, 0x1f, 0xfd, 0xbf, 0x80, 0x0f, 0xfd, 0x7f, 0x00, 0x07, 0xfe, 0x7e, 0x00, 0x03, 0xfe, 0xfc, 0x00, 0x01, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x00, 0x7f, 0xe0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; void onBeatDetected() { Serial.println("Beat Detected!"); oled.drawBitmap( 60, 20, bitmap, 28, 28, 1); oled.display(); } void setup() { Serial.begin(115200); oled.begin(); oled.clearDisplay(); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0, 0); oled.println("Initializing pulse oximeter.."); oled.display(); pinMode(16, OUTPUT); Blynk.begin(auth, ssid, pass); Serial.print("Initializing Pulse Oximeter.."); if (!pox.begin()) { Serial.println("FAILED"); oled.clearDisplay(); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0, 0); oled.println("FAILED"); oled.display(); for(;;); } else { oled.clearDisplay(); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0, 0); oled.println("SUCCESS"); oled.display(); 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(V7, BPM); Blynk.virtualWrite(V8, SpO2); oled.clearDisplay(); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0,16); oled.println(pox.getHeartRate()); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0, 0); oled.println("Heart BPM"); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0, 30); oled.println("Spo2"); oled.setTextSize(1); oled.setTextColor(1); oled.setCursor(0,45); oled.println(pox.getSpO2()); oled.display(); tsLastReport = millis(); } } |
Output Observation & Reading Value on Blynk from MAX30100 ESP8266
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.
Similarly you can check the OLED Display, the same values are displayed on screen.
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.
Video Tutorial & Demonstration
If you want to do this project with ESP32 Board, then you can follow this post: Monitor SpO2/BPM with ESP32 & MAX30100 Pulse Oximeter on Blynk






















27 Comments
Respected Sir/Madam, when I try compiling the given program in Arduino IDE, I get the following error:
In file included from C:\Users\Hrishikesh\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.cpp:20:0:
C:\Users\Hrishikesh\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.h:30:32: fatal error: Adafruit_I2CDevice.h: No such file or directory
#include <Adafruit_I2CDevice.h>
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Kindly assist me in solving this error.
Thanking you in anticipation.
Install SSD1306 & GFX Library for OLED Display.
I want publish more sensor to blynk, but can’t working..
the same problem 🙁 if you found the solution tell me please
I jumped for max 30100. In the examples, the library works, but it does not work in this project
pinMode(16, OUTPUT); ؟؟؟؟؟؟؟
How can I use this MAX30100 sensor with MLX90614 sensor? They both use I2C. I tried but MLX90614 never works with MAX30100. Only MAX30100 is working. If I comment pox.begin(); …, then only MLX90614 starts working but then MAX30100 cannot work. What am I doing wrong??
There is a design problem with the green MAX30100 sensor. Use the red-pink MAX30100 sensor which works perfectly.
But the green MAX30100 works perfectly with OLED display which is also using same I2C bus. Can it be the library issue which is not allowing to have MLX90614 in the same I2C bus with MAX30100??????
I tried creating Soft I2C for MLX9016 and the issue was still same, only MAX30100 was working and MLX90614 wasn’t. How can it allow some I2C devices to work with and not others??
This is not the library issue but the issue of green colored MAX30100 & Arduino IDE. I even tried MAX30100 with DS18B20 and some other sensors, i faced the same issue that you were facing.
Thanks for replying fast and I have ordered GY-MAX30100 now. I will update as soon as I receive them and try the code on it. Hope it gets successful ))
Hello, So i recevied the new GY-MAX30100(purple color) but the library doesn’t support this device, hence the communication cannot be built. Is there any other library for it??
None of the library is working for GY-MAX30100(purple color). Any suggestions please??
Thanks for the amazing project it helped me a lot ..
I’m beginner in this and I have some questions ..
what kind of power supply you used ? and what kinds can be also used?
another question is if I used the other type of MAX30100 ( the pink one with 5 holes ,I don’t know its name) would it solve the trouble shooting problem or not ?
and thanks for everything ..
Pink color sensor doesn’t have any design issue. It will work without having any problem
thanks for the fast reply ..
what about the power supply?
Supply 3.3V from arduino
Ok , thanks ^_^
Hello
I also have same problem if you found the solution then tell me please 😊 because it is part of my project so please tell me
help me !!!
Multiple libraries were found for “Blynk.h”
In file included from C:\Users\Dat\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.cpp:20:0:
Used: C:\Users\Dat\Documents\Arduino\libraries\blynk-library-master
C:\Users\Dat\Documents\Arduino\libraries\Adafruit-GFX-Library-master\Adafruit_GrayOLED.h:30:32: fatal error: Adafruit_I2CDevice.h: No such file or directory
Multiple libraries were found for “ESP8266WiFi.h”
#include <Adafruit_I2CDevice.h>
Used: C:\Users\Dat\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi
^
Multiple libraries were found for “Adafruit_GFX.h”
compilation terminated.
Used: C:\Users\Dat\Documents\Arduino\libraries\Adafruit-GFX-Library-master
Multiple libraries were found for “OakOLED.h”
Used: C:\Users\Dat\Documents\Arduino\libraries\OakOLED-master
Multiple libraries were found for “Wire.h”
Used: C:\Users\Dat\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\Wire
Multiple libraries were found for “MAX30100_PulseOximeter.h”
Used: C:\Users\Dat\Documents\Arduino\libraries\Arduino-MAX30100-master
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Excuse me,
I haven’t found MAX30100 oximeter it seems not provided here in my country, but I found MAX30102 is it okay if I used it instead of Max 30100.
please help me.
i am facing an issue as my oxymeter is not working and oled display is dispalying a message that pulse oxymeter initialization is failed.
MY max 30100 oxymeter is pink colored and i am facing this problem.
I am trying to find those internal resistors to remove them and replaced them by 4.7kohm external resistor. But I don’t know how to do it.
IS there any other solution to this problem.
Hello my friend, i has an issues same with you as i want to connect both mlx90614 and max30100 together. But still only max30100 that would function. If your problem has solved, can you share with me your experience to solved it? Very appreciate for your replies in future. Thank you!
can we use MAX 30102 instead of MAX30100??
the same here.
I even tried to test the oled screen so I disconnect the sensor. I only connect oled with nodemcu and tried i2cdetect to know the address of the oled, but it doesn’t show any address.
I also noticed a white material beside the oled pins and I’m afraid that the oled had combustion 🙁
if someone know something about this please help me
hi. I want to ask. what website/application you used to draw the circuit diagram?
How to cut the connection path which you’ve mentioned in 2nd method of troubleshooting of MAX30100 sensor?
can u give design and code for max30102 and oled with esp8266