Description
Heart Rate click carries Maxim’s MAX30100 integrated pulse oximetry and heart-rate sensor. Developers of end-user applications should note that the readings can be negatively impacted by excess motion and changes in temperature. Also, too much pressure can constrict capillary blood flow and therefore diminish the reliability of the data. A programmable INT pin is also available to use.
Specification:
- 3.3V power supply.
- Optical sensor: IR and red LED combined with photodetector
- Measures absorbance of pulsing blood
- I2C interface plus INT pin
- 3.3V power supply
Interfacing MAX30100 Pulse Oximeter Sensor with Arduino
- Cut the trace in the place of the red line. This will disconnect all 4.7kΩ pull-up resistors from the 1.8V supply voltage.
- Now make a jumper as shown by the yellow line with a piece of wire or a solder blob. This will pull all the 4.7kΩ resistors up to 3.3V.
Here’s the board with and without the modifications:
After following these steps, connect the module to the Arduino UNO using the wiring diagram below:
The wiring is fairly easy. Simply connect the VIN pin to Arduino’s 3.3V and GND to ground. Connect the SCL pin to the I2C clock pin and the SDA pin to the I2C data pin on your Arduino. Finally connect the INT pin to digital pin 2.
Library Installation
There are several libraries available for the MAX30100 sensor. However in our example, we are using the one by OXullo Intersecans. This library exposes most of the features of the MAX30100 and offers simple and easy to use functions to calculate pulse rate and SpO2. You can download this library from within the Arduino IDE Library Manager.
To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries.
Filter your search by typing max30100. There should be a couple entries. Look for MAX30100lib Library by OXullo Intersecans. Click on the entry, and then select Install.
Example 1 – Measuring Heart-Rate (BPM) and Oxygen Saturation (SpO2)
This is where the fun really begins! In this example, we’ll measure heart rate (Beats Per Minute or BPM) and blood oxygen level (SpO2) of the person we’re monitoring.
Warning:
This sketch detects heart-rate and oxygen saturation optically. This method is tricky and prone to give false readings. So please DO NOT use it for actual medical diagnosis.
#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");
}
// Configure sensor to use 7.6mA for LED drive
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
// 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();
}
}
After uploading the sketch, keep your finger on the sensor as steady as possible and wait a few seconds for the readings to make sense. You will see a result like this.