The SparkFun Heart Rate Monitor and Pulse Oximeter is a compact sensor module designed to measure heart rate and blood oxygen levels using photoplethysmography (PPG) technology. This module is ideal for health monitoring applications, including fitness tracking, medical devices, and wearable technology. Its small size and ease of integration make it a popular choice for both hobbyists and professionals.
Common applications and use cases:
Pin | Name | Description |
---|---|---|
1 | VIN | Power supply input (1.8V to 3.3V). Connect to the 3.3V pin of your microcontroller. |
2 | GND | Ground connection. Connect to the ground of your circuit. |
3 | SDA | I2C data line. Connect to the SDA pin of your microcontroller. |
4 | SCL | I2C clock line. Connect to the SCL pin of your microcontroller. |
5 | INT | Interrupt pin. Can be used to signal data availability (optional). |
Below is an example of how to interface the SparkFun Heart Rate Monitor and Pulse Oximeter with an Arduino UNO using the I2C protocol.
#include <Wire.h> // Include the Wire library for I2C communication
#include "MAX30102.h" // Include the library for the MAX30102 sensor
MAX30102 sensor; // Create an instance of the MAX30102 class
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
Wire.begin(); // Initialize I2C communication
// Initialize the MAX30102 sensor
if (!sensor.begin()) {
Serial.println("MAX30102 initialization failed!");
while (1); // Halt the program if initialization fails
}
Serial.println("MAX30102 initialized successfully!");
}
void loop() {
// Variables to store heart rate and SpO2 readings
int heartRate;
float spo2;
// Read data from the sensor
if (sensor.check() == true) {
heartRate = sensor.getHeartRate(); // Get heart rate in BPM
spo2 = sensor.getSpO2(); // Get blood oxygen saturation percentage
// Print the readings to the Serial Monitor
Serial.print("Heart Rate: ");
Serial.print(heartRate);
Serial.print(" BPM, SpO2: ");
Serial.print(spo2);
Serial.println(" %");
} else {
Serial.println("Sensor data not available.");
}
delay(1000); // Wait for 1 second before the next reading
}
Note: The above code assumes you have installed the MAX30102 library. You can install it via the Arduino Library Manager.
No Data from the Sensor:
Inaccurate Readings:
I2C Communication Errors:
Q: Can this module be powered with 5V?
A: No, the module operates within a voltage range of 1.8V to 3.3V. Using 5V may damage the sensor.
Q: How do I improve the accuracy of the readings?
A: Ensure proper skin contact, minimize motion during measurements, and reduce ambient light interference.
Q: Can I use this module with a Raspberry Pi?
A: Yes, the module communicates via I2C, which is supported by the Raspberry Pi. Ensure proper voltage level shifting if needed.
Q: What is the typical range for SpO2 readings?
A: Healthy individuals typically have SpO2 levels between 95% and 100%. Lower values may indicate health issues.
Q: Is this module suitable for medical-grade applications?
A: No, this module is intended for educational and hobbyist purposes. It is not certified for medical use.