The MAX30102 is an integrated pulse oximetry and heart-rate monitor sensor solution. 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 devices, fitness accessories, and medical monitoring devices due to its high sensitivity, small form factor, and low power consumption.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Supply voltage for the sensor (3.3V to 5V) |
2 | SDA | I2C Data Line |
3 | SCL | I2C Clock Line |
4 | INT | Interrupt pin. Active low |
5 | IRD | Infrared LED cathode |
6 | RD | Red LED cathode |
7 | GND | Ground |
#include <Wire.h>
#include "MAX30105.h" // Use the appropriate library for MAX30102
MAX30105 particleSensor;
void setup() {
Serial.begin(115200);
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 IR signal is strong enough
Serial.print("Heart rate: ");
Serial.print(particleSensor.getHeartRate()); // Get heart rate
Serial.print(" bpm - SpO2: ");
Serial.print(particleSensor.getSpO2()); // Get SpO2 value
Serial.println("%");
} else {
Serial.println("No finger detected.");
}
delay(1000);
}
Q: Can the MAX30102 be used on a 5V system? A: Yes, the VIN pin can handle 3.3V to 5V, but the logic levels for I2C should be level-shifted if necessary.
Q: How can I improve the accuracy of the sensor? A: Ensure stable contact with the skin, avoid motion artifacts, and filter the signal in software if needed.
Q: What is the I2C address of the MAX30102? A: The default I2C address for the MAX30102 is 0x57 (7-bit address).
Q: Can the MAX30102 measure heart rate through clothes? A: No, the sensor needs to be in direct contact with the skin to measure heart rate and SpO2 accurately.