Real-Time Health Monitoring: MAX30100 and Arduino Tutorial

0
Interfacing MAX30100 with Arduino

....Welcome back to The Electronics Creator Blog!

Hello, I’m Pankaj Joshi, Welcome back to The Electronics Creator Blog and today we’re diving into interfacing the MAX30100 Pulse Oximeter & Heart-Rate Sensor with Arduino, along with an I2C LCD Display for live readings. In this post, you’ll learn how to set up the MAX30100 to track heart rate and blood oxygen levels, displaying the results on an LCD for easy viewing. Whether you’re building a fitness tracker or a health-monitoring device, this guide will walk you through each step!

Introduction to the MAX30100 and I2C LCD Display

The MAX30100 is a small yet powerful sensor that measures both pulse rate and blood oxygen levels (SpO₂). Combining it with an I2C LCD display allows you to see real-time health data without connecting to a computer. This makes it ideal for health devices, fitness tracking, and portable monitoring projects.

Required Components

  • MAX30100 Sensor Module – For heart rate and SpO₂ measurement.
  • I2C LCD Display (16x2) – A display with I2C interface to show results.
  • Arduino Uno – This example uses an Uno, but other Arduino models are compatible.
  • Jumper Wires – For connections.
  • Breadboard (Optional) – For organized wiring.

Wiring the Components

Wiring the MAX30100 to Arduino

MAX30100 Pin Arduino Pin
VCC 5V
GND GND
SCL A5 (SCL)
SDA A4 (SDA)

Wiring the I2C LCD to Arduino

I2C LCD Pin Arduino Pin
VCC 5V
GND GND
SDA A4 (SDA)
SCL A5 (SCL)
Arduino Code Box

/*  
  Subscribe to www.youtube.com/theelectronicscreator  

  Connections: 
  - SCL PIN - A5 
  - SDA PIN - A4 
  - INT PIN - D2

  This code reads data from the MAX30100 sensor and displays it on the Serial Monitor and an I2C LCD. 
  I hope you learned something new from this video. 
  Thanks for choosing The Electronics Creator!
*/

#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#include <LiquidCrystal_I2C.h>

#define REPORTING_PERIOD_MS 1000

PulseOximeter pox;
 BPM, SpO2;
 tsLastReport = 0;

LiquidCrystal_I2C lcd(0x27, 16, 2); // Adjust the address to 0x27 or 0x3F depending on your LCD

void onBeatDetected() {
  Serial.println("Beat Detected!");
  digitalWrite(2, HIGH);  // Turn the LED on when a beat is detected
  delay(100);              // Keep it on for a short duration
  digitalWrite(2, LOW);   // Turn the LED off
}

void setup() {
  Serial.begin(115200);
  pinMode(2, OUTPUT); // Set pin 2 as an OUTPUT for the LED
  
  // Initialize the LCD
  lcd.begin();
  lcd.backlight();
  lcd.print("Initializing...");
  
  // Initialize Pulse Oximeter
  Serial.print("Initializing Pulse Oximeter...");
  if (!pox.begin()) {
    Serial.println("FAILED");
    lcd.setCursor(0, 1);
    lcd.print("Oximeter Failed");
    while (true); // Stay in this loop if initialization fails
  } else {
    Serial.println("SUCCESS");
    lcd.setCursor(0, 1);
    lcd.print("Oximeter Ready");
    pox.setOnBeatDetectedCallback(onBeatDetected); // Set the beat detection callback
    delay(2000);
    lcd.clear();
  }
}

void loop() {
  // Update Pulse Oximeter readings
  pox.update();
  BPM = pox.getHeartRate();
  SpO2 = pox.getSpO2();
  
  // Report readings to Serial Monitor and LCD
  if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
    Serial.print("Heart rate: ");
    Serial.print(BPM);
    Serial.print(" SpO2: ");
    Serial.print(SpO2);
    Serial.println(" %");

    lcd.setCursor(0, 0);
    lcd.print("Heart Rate: ");
    lcd.print(BPM);

    lcd.setCursor(0, 1);
    lcd.print("SpO2: ");
    lcd.print(SpO2);
    lcd.print(" %");
    
    tsLastReport = millis(); // Update the last report time
  }
}

Watch the Tutorial

For a visual walkthrough of the process, check out my YouTube tutorial linked above!

Conclusion

In this tutorial, we successfully interfaced the MAX30100 with an Arduino to measure heart rate and blood oxygen levels while displaying the results on an I2C LCD. This setup can be a great foundation for health monitoring projects. Don't forget to experiment with your own modifications!

Happy Coding!

If you found this blog helpful, please share it with your friends or leave a comment below. I’d love to hear your feedback and any projects you’ve created with this setup!

Post a Comment

0Comments
Post a Comment (0)