This WiFi Smart Oximeter helps you scan Spo2 and BPM using MAX30102 and ESP32 and display the values on the Smartphone
In this tutorial, I will explain how to build your own WiFi Based Smart Oximeter using MAX30102 and ESP32 in detail. The project is simple and easy to build. You only need two components — ESP32 and a MAX30102 Sensor. You just attach the sensor to your fingertip and you will be able to view SPO2(oxygen saturation) and Heart Rate(BPM) Readings on a smartphone in just a few seconds.
For this project, the ESP32 board will be programmed using the Arduino core. You can use the Arduino IDE, VS Code with PlatformIO or any other compatible IDE.
Step 2: Project Overview
I have also put up a video showing how to build this project. Do check it out –
Step 3: How It Works??
- We use ESP32 to read the raw MAX30102 sensor readings — IR and Red light is transmitted and read
- ESP32 then processes these raw values to calculate the SPO2 and Heartrate
- The final readings are sent to the mobile for display using Blynk
- The app can be customized as required. Storing, Logging and Retrieval of historical data can be implemented on the app if required
Step 4: Prerequisites
Before proceeding with this tutorial, make sure you have the following setup –
1. Parts Required
To follow this project you need:
a) MAX30102 Pulse Oximeter: Any MAX30102 sensor will work, but make sure the sensor and the I2C Signals work on the right voltages. There are many poor-quality boards that do not confirm Maxims specs and will give incorrect values and may not work.
I have found this sensor to work best — MAX30102 Pulse Oximeter. Other sensors fail during I2C Communication or have incorrect voltage on the communication lines.
b) ESP32 NodeMCU Board: Use ESP32 Only. Arduino UNO will not be able to run the Maxim Algorithm due to memory limitations.
c) Jumper wires: for making the connections between the ESP32 and the sensor Click on the above links to purchase the products or go directly to www.probots.co.in to find all the parts for this projects! We have 5000+ such products for all your DIY projects.
Step 5: Arduino IDE and ESP32 Boards Add-on
We’ll program the ESP32 using Arduino IDE. So, you must have the ESP32 add-on installed in the Arduino IDE. Follow this article for detailed instructions: Installing ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)
3. Libraries To build this project, you need to install the following libraries on your Arduino IDE:
a) SparkFun_MAX3010x_Sensor_Library (Install available on Arduino Library Manager and also on GitHub)
b) Blynk (Install available on Arduino Library Manager and also on GitHub)
4. Blynk App
A smartphone with the Blynk app Installed
You can install the first library using the Arduino Library Manager. Go to Sketch > Include Library > Manage Libraries and search for the library name.
Step 6: Connections
The Connections are simple and straightforward
Step 7: Getting the App Ready
We will use the Blynk Platform to create an app that will fetch data from ESP32 and display it on the smartphone. The steps to create the app –
1. Create a new Blynk app on your phone
2. Add 2 x Gauge and 2 x Labeled Value Widgets and associate one of each with Virtual Pins V3 and V4. You can label and format the data as required. We use V3 for BPM and V4 for SPO2.
The ESP32 will transmit the pulse readings to the V3 pin and the SPO2 readings to the V4 pins. On creating the app, you will get a Blynk Auth Token. Note it down as you will need it later while programming the ESP32.
Step 8: How the Code Works
The code for this project is available on the GitHub page: WiFi Oximeter
Let’s take a quick look at the relevant parts of this code.
Insert your Blynk app auth key in the auth character array. This is used to identify your ESP32 and App on the Blynk Server. You will receive the auth key after creating the Blynk app in the previous step.
char auth = " "; // You should get Auth Token in the Blynk App.
Insert your network credentials in the following variables for the ESP32 to connect to your local wifi network:
char ssid = " "; // Enter you WiFi SSID here
char pass = " "; // Enter you WiFi Password here
Step 9: Demonstration
Upload the program and you should start seeing values on your Blynk App. Once you attach the sensor to your fingertip, you will start seeing the BPM and SPO2 reading immediately. Notice that the readings update almost instantaneously whenever there’s a change.
If you are keen on building this project, reading the following two articles will help you understand working of the MAX30102 oximeter and how to get the best accuracy out of it. I strongly recommend you read them.
Getting Started with MAX30102: Part 1
Getting Started with MAX30102: Part 2
Source: How to Build a DIY WiFi Smart Oximeter Using MAX30102 and Arduino ESP32