How to Build a WiFi Smart Oximeter using MAX30102 and ESP32

In this tutorial, I will explain step by step how to build your own WiFi Based Smart Oximeter using MAX30102 and ESP32. 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 your SPO2(oxygen saturation) and Heart rate(BPM) on a smartphone in a few seconds.

For this project, the ESP32 board will be programmed using the Arduino core. You can either use the Arduino IDE, VS Code with PlatformIO or any other suitable IDE.

Project Overview

The following shows the project in action:

Left to right – ESP32, Sensor held between the hands and the live values being displayed on a smartphone.

How it Works??

1. We use ESP32 to read the MAX30102 sensor readings

2.ESP32 then processes these raw values to calculate the SPO2 and Heartrate.

3.The final readings are sent to the mobile for display using Blynk.

4.The app can be customized as required. Storing, Logging and Retrieval of historical data can be implemented on the app if required.

Prerequisites

Before proceeding with this tutorial, make sure you check all the following prerequisites.

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.

b) ESP32 NodeMCU Board: Use ESP32 Only. Arduino UNO will not be able to run the Maxim Algorithm due to memory limitation.

c) Breadboard

d) Jumper wires

You can use the preceding links or go directly to www.probots.co.in to find all the parts for your projects! We have  2000+ such products for all your DIY projects.

2) Arduino IDE and ESP32 Boards Add-on

We’ll program the ESP32 using Arduino IDE. So, you must have the ESP32 add-on installed. Follow the next tutorial if you haven’t already:

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.

Connections

The Connections are simple and straightforward –

ESP32MAX30102 Sensor
3V3VIN
GNDGND
SDA (GPIO21)

SDA
SCL (GPIO22)

SCL

The left column shows the pins on the ESP32 and the right column shows the pins of the MAX30102 Sensor. Just connect the pins together using jumper wires.

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 2xLabeled 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.

How the Code Works

The code for this project is available on the GitHub page: ProbotsGit

Let’s take a quick look at the relevant parts of this project.

Insert your Blynk app auth key here. 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

Demonstration

Run 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, the links provided below will help you build it

Part 1

Part 2

2 thoughts on “How to Build a WiFi Smart Oximeter using MAX30102 and ESP32

Leave a Reply

Your email address will not be published. Required fields are marked *