RAJESH SINHA
Published © CERN-OHL2

MAX30100 with Arduino and 16x2 Display

Monitor heart rate and oxygen levels using the MAX30100 sensor with Arduino and display real-time data on a 16x2 LCD screen.

BeginnerFull instructions provided7 hours984
MAX30100 with Arduino and 16x2 Display

Things used in this project

Story

Read more

Schematics

rajesh_kumar_3yl5aWkStO.png

Code

code for this project

Arduino
#include <LiquidCrystal_I2C.h>
#include "MAX30100_PulseOximeter.h"
 
// Create the lcd object address 0x27 and 16 columns x 2 rows 
LiquidCrystal_I2C lcd (0x27, 16,2); //we can find the address through I2C address scanner
 
#define REPORTING_PERIOD_MS     1000
 
PulseOximeter pox;
uint32_t tsLastReport = 0;
 
void onBeatDetected()
{
    Serial.println("Beat!");
}
 
void setup()
{
    Serial.begin(115200);
    Serial.print("Initializing pulse oximeter..");
    lcd.init ();
    lcd. backlight ();
    lcd.print("Initializing...");
    delay(3000);
    lcd.clear();
 
    // Initialize the PulseOximeter instance
    // Failures are generally due to an improper wiring, missing power supply
    if (!pox.begin()) {
        Serial.println("FAILED");
        for(;;);
    } else {
        Serial.println("SUCCESS");
    }
     pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
 
    // Register a callback for the beat detection
    pox.setOnBeatDetectedCallback(onBeatDetected);
}
 
void loop()
{
    // Make sure to call update as fast as possible
    pox.update();
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
        Serial.print("Heart rate:");
        Serial.print(pox.getHeartRate());
        Serial.print("bpm / SpO2:");
        Serial.print(pox.getSpO2());
        Serial.println("%");
 
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print("BPM : ");
        lcd.print(pox.getHeartRate());
        
        lcd.setCursor(0,1);
        lcd.print("SpO2: ");
        lcd.print(pox.getSpO2());
        lcd.print("%");
 
        tsLastReport = millis();
    }
}

Credits

RAJESH SINHA
14 projects • 11 followers
Hey there! I'm Rajesh. I'm passionate about building innovative projects.mail id:- rajeshkumar15022004@gmail.com
Contact

Comments

Please log in or sign up to comment.