The MAX30102 is an integrated pulse oximetry and heart-rate monitor sensor module. It combines two LEDs, a photodetector, optimized optics, and low-noise analog signal processing to detect pulse oximetry and heart-rate signals. The MAX30102 is widely used in wearable health devices, fitness trackers, and medical monitoring devices due to its small form factor and low power consumption.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply (1.8V to 3.3V) |
2 | SDA | I2C Data Line |
3 | SCL | I2C Clock Line |
4 | INT | Interrupt pin (active low) |
5 | IR | Infrared LED cathode |
6 | R | Red LED cathode |
7 | GND | Ground |
#include <Wire.h>
#include "MAX30105.h" // Include the MAX30105 library
MAX30105 particleSensor;
void setup() {
Serial.begin(115200); // Initialize serial communication at 115200 baud rate
Wire.begin(); // Initialize I2C
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) { // Initialize sensor
Serial.println("MAX30102 was not found. Please check wiring/power.");
while (1);
}
particleSensor.setup(); // Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0x0A); // Set Red LED amplitude
particleSensor.setPulseAmplitudeIR(0x0A); // Set IR LED amplitude
}
void loop() {
long irValue = particleSensor.getIR(); // Read IR value
if (irValue > 50000) { // Check if the sensor is covered
// Read the heart rate and SpO2 levels
float heartRate, spO2;
if (particleSensor.checkForBeat(irValue) == true) {
if (particleSensor.getSpO2(&spO2, &heartRate)) {
Serial.print("Heart Rate: ");
Serial.print(heartRate);
Serial.print(" bpm - SpO2: ");
Serial.print(spO2);
Serial.println("%");
}
}
} else {
Serial.println("No finger?");
}
delay(1000); // Wait for 1 second before next reading
}
Q: Can the MAX30102 be used on a 5V system? A: The MAX30102 operates at 1.8V to 3.3V. A logic level converter is required for 5V systems.
Q: How can I improve the accuracy of the readings? A: Ensure a snug fit against the skin, minimize motion, and avoid direct sunlight on the sensor.
Q: What is the I2C address of the MAX30102? A: The default I2C address is 0x57 (7-bit).
Q: Can the MAX30102 measure heart rate through clothes? A: No, the sensor needs to be in direct contact with the skin for accurate measurements.