Stufin
Home Quick Cart Profile

MAX30102 Pulse Oximeter Heart Rate Sensor Module

Buy Now on Stufin

Pin Configuration

  • MAX30102 Pulse Oximeter Heart Rate Sensor Module Pinout Explanation
  • The MAX30102 Pulse Oximeter Heart Rate Sensor Module is a compact, low-power, and highly integrated sensor module used for measuring heart rate and oxygen saturation (SpO2) levels. The module has a 7-pin interface, which is explained below:
  • Pinout Structure:
  • | Pin Number | Pin Name | Description |
  • | --- | --- | --- |
  • | 1 | VCC | Power Supply (3.3V or 5V) |
  • | 2 | GND | Ground |
  • | 3 | SCL | I2C Clock |
  • | 4 | SDA | I2C Data |
  • | 5 | INT | Interrupt Output |
  • | 6 | RDY | Ready Output |
  • | 7 | N/C | Not Connected ( reserved) |
  • Pin-by-Pin Explanation:
  • 1. VCC (Pin 1): This pin is used to power the MAX30102 module. It can be connected to a 3.3V or 5V power supply. Make sure to check the voltage level compatibility with your microcontroller or development board.
  • 2. GND (Pin 2): This pin is the ground connection for the module. It should be connected to the ground pin of your power supply or development board.
  • 3. SCL (Pin 3): This pin is the clock line for the I2C (Inter-Integrated Circuit) interface. It should be connected to the SCL pin of your microcontroller or development board.
  • 4. SDA (Pin 4): This pin is the data line for the I2C interface. It should be connected to the SDA pin of your microcontroller or development board.
  • 5. INT (Pin 5): This pin is an interrupt output that is triggered when new data is available or when an error occurs. It can be connected to an interrupt pin on your microcontroller or development board.
  • 6. RDY (Pin 6): This pin is a ready output that indicates when the module is ready to transmit data. It can be connected to a digital input pin on your microcontroller or development board.
  • 7. N/C (Pin 7): This pin is not connected and is reserved for future use. It should not be connected to any pin on your microcontroller or development board.
  • Connection Tips:
  • Use a 3.3V or 5V power supply for VCC, depending on your microcontroller or development board's voltage requirements.
  • Connect GND to the ground pin of your power supply or development board.
  • Ensure that the SCL and SDA pins are connected to the corresponding I2C pins on your microcontroller or development board.
  • Connect the INT and RDY pins to digital input pins on your microcontroller or development board, as needed.
  • Leave the N/C pin unconnected.
  • By following these connection guidelines, you can successfully integrate the MAX30102 Pulse Oximeter Heart Rate Sensor Module into your IoT project.

Code Examples

MAX30102 Pulse Oximeter Heart Rate Sensor Module Documentation
Overview
The MAX30102 is a pulse oximeter and heart rate sensor module that integrates a photoplethysmography (PPG) sensor and a low-noise analog-to-digital converter (ADC) to measure heart rate and oxygen saturation (SpO2) levels. This module is commonly used in wearable devices, medical equipment, and IoT projects.
Pinout
The MAX30102 module has the following pinout:
VCC: Power supply (3.3V or 5V)
 GND: Ground
 SCL: I2C clock
 SDA: I2C data
 INT: Interrupt output
Communication Protocol
The MAX30102 communicates through the I2C protocol.
Configuration and Initialization
Before using the MAX30102, it is necessary to configure and initialize the module. This involves setting the mode, sample rate, and LED currents.
Code Examples
### Example 1: Arduino Sketch for Heart Rate Monitoring
This example demonstrates how to use the MAX30102 to measure heart rate and display it on the serial monitor using an Arduino board.
```c
#include <Wire.h>
#define MAX30102_ADDRESS 0x57
void setup() {
  Serial.begin(9600);
  Wire.begin();
  
  // Initialize MAX30102
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x00); // Mode register
  Wire.write(0x03); // Enable heart rate mode
  Wire.endTransmission();
  
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x04); // Sample rate register
  Wire.write(0x01); // Set sample rate to 100 Hz
  Wire.endTransmission();
}
void loop() {
  int heartRate;
  
  // Read heart rate data
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x05); // Heart rate register
  Wire.endTransmission();
  Wire.requestFrom(MAX30102_ADDRESS, 2);
  heartRate = Wire.read() << 8 | Wire.read();
  
  Serial.print("Heart Rate: ");
  Serial.print(heartRate);
  Serial.println(" bpm");
  
  delay(1000);
}
```
### Example 2: Raspberry Pi Python Script for SpO2 Measurement
This example demonstrates how to use the MAX30102 to measure SpO2 levels and display them on the console using a Raspberry Pi.
```python
import smbus
import time
# Initialize I2C bus
bus = smbus.SMBus(1)
# MAX30102 address
address = 0x57
# Initialize MAX30102
bus.write_byte_data(address, 0x00, 0x03)  # Enable SpO2 mode
bus.write_byte_data(address, 0x04, 0x01)  # Set sample rate to 100 Hz
while True:
    # Read SpO2 data
    bus.write_byte(address, 0x06)  # SpO2 register
    data = bus.read_i2c_block_data(address, 0x06, 2)
    Spo2 = (data[0] << 8 | data[1]) & 0x03FF
    
    print("SpO2: {:.2f}%".format(Spo2 / 100.0))
    
    time.sleep(1)
```
### Example 3: ESP32 Code for Real-Time Heart Rate and SpO2 Monitoring
This example demonstrates how to use the MAX30102 to measure heart rate and SpO2 levels in real-time using an ESP32 board.
```c
#include <WiFi.h>
#include <Wire.h>
#define MAX30102_ADDRESS 0x57
void setup() {
  Serial.begin(115200);
  Wire.begin();
  
  // Initialize MAX30102
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x00); // Mode register
  Wire.write(0x03); // Enable heart rate and SpO2 mode
  Wire.endTransmission();
  
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x04); // Sample rate register
  Wire.write(0x01); // Set sample rate to 100 Hz
  Wire.endTransmission();
}
void loop() {
  int heartRate;
  int SpO2;
  
  // Read heart rate data
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x05); // Heart rate register
  Wire.endTransmission();
  Wire.requestFrom(MAX30102_ADDRESS, 2);
  heartRate = Wire.read() << 8 | Wire.read();
  
  // Read SpO2 data
  Wire.beginTransmission(MAX30102_ADDRESS);
  Wire.write(0x06); // SpO2 register
  Wire.endTransmission();
  Wire.requestFrom(MAX30102_ADDRESS, 2);
  SpO2 = Wire.read() << 8 | Wire.read();
  
  Serial.print("Heart Rate: ");
  Serial.print(heartRate);
  Serial.print(" bpm, SpO2: ");
  Serial.print(SpO2);
  Serial.println(" %");
  
  delay(1000);
}
```
Note: These examples are for illustrative purposes only and may require modifications to work with your specific hardware setup. Ensure you consult the MAX30102 datasheet and relevant documentation for your microcontroller or development board for more information on using this module.