Interfacing MAX30102 Pulse Oximeter & Heart Rate Sensor with Arduino: A Complete DIY Guide
1. Introduction
In today’s health-conscious world, monitoring vital signs like heart rate and blood oxygen levels has become increasingly important. The MAX30102 sensor, when combined with an Arduino, offers a cost-effective solution for creating personal health monitoring devices. This guide will walk you through the process of interfacing the MAX30102 Pulse Oximeter and Heart Rate Sensor with an Arduino, making it an ideal project for students, hobbyists and professionals alike.
⚠️ This is a learning project, not a medical device. The readings from a MAX30102 are approximate and are not for diagnosis, treatment or monitoring any medical condition. If you need accurate health data, use a certified medical device.
2. What is the MAX30102 Sensor?
The MAX30102 is an integrated pulse oximetry and heart-rate monitor biosensor module. It combines two LEDs (infrared and red), a photodetector, optimized optics and low-noise analog signal processing to detect pulse oximetry and heart-rate signals. Designed for wearable health devices, it’s compact and efficient.

3. Key Features and Specifications
- Power Supply: 1.8V (core) and 3.3V (LEDs)
- Operating Voltage: 1.8V to 3.3V
- Current Consumption: 600µA (measurement mode), 0.7µA (standby)
- Communication Interface: I2C
- Integrated Temperature Sensor: For ambient temperature compensation
- Dimensions: 14mm x 18mm
4. Applications of MAX30102
- Wearable Health Devices: Smartwatches and fitness bands
- Medical Monitoring: Portable pulse oximeters (as a learning prototype — see the warning above)
- DIY Projects: Health monitoring systems for students and hobbyists
- Academic Projects: Ideal for final year projects in engineering and medical fields
5. Required Components
To get started, you’ll need the following components:
| Component | Price / link |
|---|---|
| MAX30102 sensor module | Available on order — message us on WhatsApp (no listing yet) |
| Arduino UNO R3 DIP or compatible board | Rs 1,200 |
| 0.96″ OLED display (optional) | Available on order — message us on WhatsApp (no listing yet) |
| Jumper wires | Rs 180 |
| MB102 breadboard | Rs 250 |
6. Understanding the Pinout
The MAX30102 module typically has the following pins:
- VIN: Power supply (1.8V to 3.3V)
- GND: Ground
- SCL: I2C Clock
- SDA: I2C Data
- INT: Interrupt (optional)
Ensure you connect these pins correctly to your Arduino to avoid any issues.
7. How the MAX30102 Works
The MAX30102 operates by emitting light from its LEDs into the skin and measuring the amount of light that is either absorbed or reflected to its photodetector. The varying light absorption corresponds to the pulsing of blood through the body, allowing the sensor to determine heart rate and blood oxygen levels.
8. Wiring the MAX30102 with Arduino
Here’s how to connect the MAX30102 to the Arduino Uno:
| Connection | Where it goes |
|---|---|
| MAX30102 VIN | Arduino 3.3V |
| MAX30102 GND | Arduino GND |
| MAX30102 SCL | Arduino A5 |
| MAX30102 SDA | Arduino A4 |
| MAX30102 INT | Arduino D2 (optional) |
Ensure all connections are secure to prevent any communication issues. Never power the module from 5V — it runs on 3.3V.

9. Installing Necessary Libraries
Before coding, install the required libraries:
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for and install:
- MAX3010x by SparkFun
- Adafruit GFX Library (if using OLED)
- Adafruit SSD1306 (if using OLED)
These libraries provide functions to interface with the MAX30102 and display data easily.
10. Arduino Code for MAX30102
Here’s a complete program to read heart rate from the MAX30102. It uses the SparkFun MAX3010x library and its heartRate.h helper, which detects each heartbeat from the IR signal and calculates beats per minute (BPM).
About the #include "MAX30105.h" line: this is correct, not a mistake. The SparkFun library’s header file is named MAX30105.h, and the same MAX30105 class drives the MAX30102 (and the MAX30101) — the library supports all three chips through one class. Do not “correct” it to MAX30102.h, because no such header exists in this library. The real problems in the old code were the shattered fragments, the curly “smart quotes” (which will not compile) and the comma-joined lines — all fixed in the block below.
#include <Wire.h>
#include "MAX30105.h" // SparkFun MAX3010x library — same class drives the MAX30102
#include "heartRate.h"
MAX30105 particleSensor;
const byte RATE_SIZE = 4; // average of the last 4 beats
byte rates[RATE_SIZE];
byte rateSpot = 0;
long lastBeat = 0;
float beatsPerMinute;
int beatAvg;
void setup() {
Serial.begin(115200);
Serial.println("Initializing...");
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) {
Serial.println("MAX30102 not found. Check wiring/power.");
while (1);
}
particleSensor.setup(); // default settings
particleSensor.setPulseAmplitudeRed(0x0A); // red LED, low power
particleSensor.setPulseAmplitudeGreen(0); // green LED off
}
void loop() {
long irValue = particleSensor.getIR();
if (checkForBeat(irValue) == true) {
long delta = millis() - lastBeat;
lastBeat = millis();
beatsPerMinute = 60 / (delta / 1000.0);
if (beatsPerMinute < 255 && beatsPerMinute > 20) {
rates[rateSpot++] = (byte)beatsPerMinute;
rateSpot %= RATE_SIZE;
beatAvg = 0;
for (byte x = 0; x < RATE_SIZE; x++) beatAvg += rates[x];
beatAvg /= RATE_SIZE;
}
}
Serial.print("IR=");
Serial.print(irValue);
Serial.print(", BPM=");
Serial.print(beatsPerMinute);
Serial.print(", Avg BPM=");
Serial.println(beatAvg);
if (irValue < 50000) Serial.println(" No finger?");
}This code initializes the sensor and prints the infrared value and the heart rate. Put your fingertip gently on the sensor and keep still — the BPM settles after a few beats. This sketch gives heart rate only. For blood oxygen (SpO2) you need the spo2_algorithm library as well — see our biomedical patient monitoring system for the full version with SpO2.
11. Displaying Data on OLED
To enhance your project, you can display the readings on an OLED screen:
- Connect the OLED to the Arduino:
- VCC → 3.3V
- GND → GND
- SCL → A5
- SDA → A4
- Modify the code to include OLED display functions using the Adafruit libraries.
The OLED shares the same I2C bus (A4/A5) as the MAX30102 — both devices work on the same two wires because they have different I2C addresses. This visual representation makes the project more interactive and user-friendly.

12. Common Issues and Troubleshooting
- Sensor Not Detected: Ensure correct wiring and that the sensor is powered from 3.3V (not 5V).
- No Readings: Check if the finger is properly placed on the sensor.
- Erratic Readings: Ensure minimal movement during measurement and proper ambient lighting.
13. Enhancing the Project
Consider adding features like:
- Data Logging: Store readings on an SD card.
- Wireless Transmission: Send data via Bluetooth or Wi-Fi.
- Mobile App Integration: Display data on a smartphone app.
These enhancements can make your project more robust and applicable in real-world scenarios. For a wireless version, see our ESP32 health monitoring patch — it reads the same kind of sensor and uploads the data to ThingSpeak.
14. Real-World Applications
- Student Projects: Ideal for final year projects in engineering and medical fields.
- DIY Health Monitors: Create personal health monitoring devices.
- Educational Tools: Teach students about biosensors and data analysis.
15. Conclusion – Why This Project Works
Interfacing the MAX30102 Pulse Oximeter and Heart Rate Sensor with Arduino is a rewarding project that combines electronics, programming and health monitoring. Whether you’re a student, hobbyist or professional, this project offers valuable insights into biosensing and data analysis.
Where to Buy the Parts
The Arduino UNO (Rs 1,200), jumper wires (Rs 180) and MB102 breadboard (Rs 250) are available at QKZee Technologies, Shop 20, 1st Floor, Al-Khalil Center, Hall Road, Lahore, and online at qkzeetech.com with delivery all over Pakistan — see the links above. The MAX30102 sensor module and the 0.96″ OLED display are available on order — message us on WhatsApp and we will arrange them for you.
Still Stuck?
If the sensor is not detected, or the BPM jumps around, message us — tell us what the Serial Monitor shows (the IR value and the BPM), whether you are powering the module from 3.3V, and we will help you find the fault.
FAQs
Why does the code say “MAX30102 not found”?
Check the wiring first: VIN to 3.3V (not 5V), GND to GND, SCL to A5, SDA to A4. Then check that the SparkFun MAX3010x library is installed. A loose SDA or SCL wire is the most common cause.
Why is my BPM jumping all over the place?
Keep your finger still and press gently — movement is the biggest cause of erratic readings. Bright light leaking into the sensor also disturbs it. The BPM needs a few beats to settle; the average (Avg BPM) is steadier than the instant value.
Why does the code include “MAX30105.h” for a MAX30102 sensor?
That is correct, not a mistake. The SparkFun library’s header file is named MAX30105.h, and the same class drives the MAX30102. Do not change it to MAX30102.h — no such header exists in this library.
Can this measure blood oxygen (SpO2) too?
Yes, but not with this sketch — it gives heart rate only. SpO2 needs the spo2_algorithm library and both the red and IR readings. See our biomedical patient monitoring guide for the full version.
Can I use the OLED and the sensor together?
Yes — both use the same I2C bus (A4/A5) because they have different I2C addresses. Wire the OLED’s VCC to 3.3V, GND to GND, SCL to A5 and SDA to A4, exactly like the sensor.
Is this a medical device?
No. This is a learning project. Its readings are approximate and are not for diagnosis, treatment or monitoring any medical condition. Use a certified medical device for real health data.
Conclusion
A MAX30102 with an Arduino is one of the best first biosensor projects: four wires, one library and a fingertip. Remember three things — power it from 3.3V, keep the finger still, and don’t trust the numbers for medical decisions. That is the whole project, and it works.






