Description
The MAX30102 is an integrated pulse oximetry and heart-rate monitor module. It includes internal LEDs, photodetectors, optical elements, and low-noise electronics with ambient light rejection. The MAX30102 provides a complete system solution to ease the design-in process for mobile and wearable devices. Communication is through a standard I2C-compatible interface. The module can be shut down through software with zero standby current, allowing the power rails to remain powered at all times.
Specifications
- Form color : Black
- Operating Voltage: 3.3v – 5v(Recommended to use 3.3v).
Applications
- Wearables
- Heart-rate monitor
- Pulse oximeter
Hardware required:
- MAX30102 Sensor
- Arduino UNO
- Breadboard
- Jumper wires
Interfacing MAX30102 pulse oximeter with Arduino
- If you’re facing issues with communication (especially SDA/SCL lines) or power supply consumption , Cut the trace in the place of the red line. This will disconnect all 4.7kΩ pull-up resistors from the 1.8V supply voltage.
- Now make a jumper as shown by the yellow line with a piece of wire or a solder blob. This will pull all the 4.7kΩ resistors up to 3.3V.
Setting up the Arduino IDE
- Download and Install the Arduino IDE
- Go to Tools > Board > Board Manager
- Type Arduino AVR Board and Click Install, Also install ESP8266 board when using nodemcu ESP8266 module in your Arduino IDE.
- If boards are not in the Board Manager, Go to file > Preferences
- Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json (For ESP8266 module), https://github.com/dmadison/ArduinoXInput_AVR.git (For Arduino) , press OK
- Repeat step 3 to install the board.
Installing the Library
- Go to , Tools > Manage Libraries
- Type “MAX30102″ and install the one by SparkFun Electronics or dowonload it here
See how to install library here
Upload the sample Sketch
#include <Wire.h>
#include “Adafruit_MAX30102.h”
Adafruit_MAX30102 sensor;
void setup() {
Wire.begin();
Serial.begin(115200);
while (!Serial);
if (!sensor.begin()) {
Serial.println(“MAX30102 not found!”);
while (1);
}
Serial.println(“MAX30102 initialized.”);
}
void loop() {
int IR, red;
if (sensor.check()) {
IR = sensor.getIR();
red = sensor.getRed();
Serial.print(“IR: “); Serial.print(IR);
Serial.print(” Red: “); Serial.println(red);
Serial.print(“Mean Diff: “);
Serial.println(meanDiff(IR));
}
delay(10);
}
long meanDiff(int M) {
#define LM_SIZE 15
static int LM[LM_SIZE];
static byte index = 0;
static long sum = 0;
static byte count = 0;
long avg = 0;
sum -= LM[index];
LM[index] = M;
sum += LM[index];
index = (index + 1) % LM_SIZE;
if (count < LM_SIZE) count++;
avg = sum / count;
return avg – M;
}