1. Introduction
The MAX30102 is an advanced biomedical sensor capable of measuring heart rate (BPM) and blood oxygen saturation (SpO2). It works using infrared and red LEDs and is widely used in wearable and health monitoring devices with the Raspberry Pi.
2. Components
- Raspberry Pi 4 Model B
- MAX30102
- Jumper wires
- Breadboard (optional)
3. Circuit and Connections

MAX30102 Pulse Oximeter & Heart Rate Sensor Pinout Diagram
I2C Connection Table
| MAX30102 Pin | Raspberry Pi |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO2 (Pin 3) |
| SCL | GPIO3 (Pin 5) |
👉 Default I2C Address: 0x57
4. Detailed Step By Step Circuit Working
- Sensor emits red and IR light into the skin
- Blood absorbs light differently based on oxygen level
- Reflected light is captured by photodiode
- Internal processing calculates pulse and SpO2
- Data is sent to Raspberry Pi via I2C
5. Libraries to be Included
sudo apt update
sudo apt install python3-smbus i2c-tools
pip3 install smbus2 max30102
Enable I2C:
sudo raspi-config
→ Interface Options → I2C → Enable
6. Code (Python)
import max30102
import hrcalc
import time
sensor = max30102.MAX30102()
while True:
red, ir = sensor.read_sequential()
hr, hr_valid, spo2, spo2_valid = hrcalc.calc_hr_and_spo2(ir, red)
if hr_valid:
print("Heart Rate:", int(hr), "BPM")
if spo2_valid:
print("SpO2:", int(spo2), "%")
print("----------------------")
time.sleep(1)
7. Detailed Step By Step Code Working
- Initializes MAX30102 sensor
- Reads red and IR values
- Processes data using
hrcalc - Calculates:
- Heart Rate (BPM)
- SpO2 (%)
- Displays results continuously
8. Tips
- Place finger gently on sensor
- Avoid movement for accurate readings
- Ensure proper contact with skin
- Use stable power supply
- Allow few seconds for stable values
9. Uses
- Pulse oximeters
- Fitness trackers
- Health monitoring systems
- Wearable devices
- Medical IoT applications
10. Conclusion
The MAX30102 is a powerful sensor for health monitoring. With Raspberry Pi, it enables advanced biomedical and IoT applications.