MAX-30100 Heart Rate Sensor for Arduino Review and Code

This post talks about using the MAX-30100 Heart Rate Sensor with an Arduino.

MAX-30100 Heart Rate Sensor

The MAX-30100 Heart Rate sensor allows reading heart rate and is an integrated pulse oximeter. This allows roughly detecting the percentage of oxygenated blood and the rate at which your heart is beating.

These type of sensors are commonly used in fitness trackers and in the medical industry to measure a patients oxygen level.

This unit mounted on a small PCB which allows processing the output from the MAX-30100 and exposes a nice I2C interface. This can be used by an Arduino or similar to read the data from the sensor.

One nice feature is that the voltage regulators on the PCB allows using it with 3.3 Volts or 5 Volts both of which are standard voltages on hobbyist boards.

Two grounded circles are cut out of this PCB and allow it to be anchored to your PCB or part of your design. The PCB I purchased did not originally have the pins soldered on which means you can choose how you wish to mount the device.

Wiring it up to an Arduino

This sensor will typically have five pins but we only need four of them to connect to the Arduino.

Pin on SensorPin on ArduinoComments
VIN5VThis can also be connected to the 3.3V line and should work normally.
GNDGND
SCLA5 or SCLFor most Arduino’s the SCL pin will be A5. However you may need to confirm this.
SDAA4 or SDAFor most Arduino’s the SDA pin will be A4. However you may need to confirm this.
INTNot connectedThis pin does not need to be connected.

Programming the Arduino with the MAX-30100 Heart Rate Sensor

To talk to the Max-30100 Heart Rate Sensor I am going to use the SparkFun MAX3010x Pulse and Proximity Sensor Library. This means that I don’t need to write the code to talk to the I2C interface directly.

This can be obtained by adding the “SparkFun MAX3010x Pulse and Proximity Sensor Library” in the “manage library” section of the Arduino IDE or by downloading it from github.

To connect the MAX30105 Breakout code from github and modified it somewhat.

#include <Wire.h>
#include "MAX30105.h"

MAX30105 heartbeatSensor;

void setup()
{
  Serial.begin(115200);
  
  //Init the sensor and check if its working
  if (!heartbeatSensor.begin(Wire, I2C_SPEED_FAST))
  {
    Serial.println("Connection to MAX30100 failed, check all wires and power.");
    while (true) {
      delay(1000); //Run forever as this failed.
    }
  }

  byte ledBrightness = 0x1F; //Options: 0=Off to 255=50mA
  byte sampleAverage = 8; //Options: 1, 2, 4, 8, 16, 32
  byte ledMode = 3; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green
  int sampleRate = 100; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
  int pulseWidth = 411; //Options: 69, 118, 215, 411
  int adcRange = 4096; //Options: 2048, 4096, 8192, 16384
  
  heartbeatSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange);
}

void loop()
{
  Serial.println(heartbeatSensor.getIR());
}

First with this code the header files for the Wire interface and the MAX3010* family are imported and the heartbeatSensor is declared.

In the setup function the Serial is first initialised to run at 115200 baud rate. Once done the heartbeat sensor is started. If this fails to start it means there is an issue with the I2C connection and it prints out a message and stops.

If this is then working the sensor is setup according to the recommended settings. Noted above are the various configurations recommended by SparkFun however I have kept it to the defaults.

In the loop method the sensor value is printed down the serial line. To visualise this you can use the serial plotter. This will show spikes when your heart pumps and your blood oxygen level rises.

Final Review

Overall this MAX-30100 is a nice sensor to show basic information such as pulse data.

The MAX-30100 has been succeeded by the MAX-30101 and MAX-30102 both which are recommended by Maxim as a replacement. These are similarly designed to the MAX-30100 so these will likely work the same.

You can also use it to work out approximate oxygen concentration but I have not done this here.

Overall this is a nice simple sensor to measure the heart rate of someone.

Would buy again!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.