Arnov Sharma
Published © MIT

Oximeter with MAX30100 Heart Rate Sensor and ESP32

A simple Oximeter Setup powered by an ESP32

BeginnerFull instructions provided1 hour5,091

Things used in this project

Hardware components

Maxim Integrated max30100
×1
PCBWay Custom PCB
PCBWay Custom PCB
×1
ESP32S
Espressif ESP32S
×1
Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

sch

Code

CODE for OXIMETER AND HEART MONITOR

C/C++
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"

#define REPORTING_PERIOD_MS     1000

// Create a PulseOximeter object
PulseOximeter pox;

// Time at which the last beat occurred
uint32_t tsLastReport = 0;

// Callback routine is executed when a pulse is detected
void onBeatDetected() {
    Serial.println("Beat!");
}

void setup() {
    Serial.begin(9600);

    Serial.print("Initializing pulse oximeter..");

    // Initialize sensor
    if (!pox.begin()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
    } 
  pox.setIRLedCurrent(MAX30100_LED_CURR_46_8MA);

    // Register a callback routine
    pox.setOnBeatDetectedCallback(onBeatDetected);
}

void loop() {
    // Read from the sensor
    pox.update();

    // Grab the updated heart rate and SpO2 levels
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
        Serial.print("Heart rate:");
        Serial.print(pox.getHeartRate());
        Serial.print("bpm / SpO2:");
        Serial.print(pox.getSpO2());
        Serial.println("%");

        tsLastReport = millis();
    }
}

RAW READINGS Serial Plotter

C/C++
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"

// Create a MAX30100 object
MAX30100 sensor;

void setup() {
    Serial.begin(115200);

    Serial.print("Initializing MAX30100..");

    // Initialize sensor
    if (!sensor.begin()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
    }

    // Configure sensor
    configureMax30100();
}

void loop() {
    uint16_t ir, red;

    sensor.update();

while (sensor.getRawValues(&ir, &red)) {
  Serial.print(red);
  Serial.print(", ");
  Serial.println(ir);
}
}

void configureMax30100() {
  sensor.setMode(MAX30100_MODE_SPO2_HR);
  sensor.setLedsCurrent(MAX30100_LED_CURR_50MA, MAX30100_LED_CURR_27_1MA);
  sensor.setLedsPulseWidth(MAX30100_SPC_PW_1600US_16BITS);
  sensor.setSamplingRate(MAX30100_SAMPRATE_100HZ);
  sensor.setHighresModeEnabled(true);
}

Credits

Arnov Sharma

Arnov Sharma

306 projects • 306 followers
Just your average MAKER

Comments