MAX30101 - how to use Green LED or Red LED for Heart rate monitoring

Hello,

I am using the MAX30101 with it’s arduino library (https://github.com/sparkfun/SparkFun_MA … or_Library) and noticed that it only uses the IR LED’s data when checking if there is a heartbeat:

  long irValue = particleSensor.getIR();
  if (checkForBeat(irValue) == true)

So I decided to try using the Red LED data to sense the heartbeat instead by changing it to:

  long rValue = particleSensor.getRed();
  if (checkForBeat(rValue) == true)

Now it no longer outputs correct BPM after placing a finger and BPM and Average BPM stays 0. The same happens for the Green LED. I think it has something to do with the checkForBeat() function in the heartrate.cpp function in the library, this part to be exact:

if ((IR_AC_Max - IR_AC_Min) > 20 & (IR_AC_Max - IR_AC_Min) < 1000)
    {
      //Heart beat!!!
      beatDetected = true;
    }
  }

Maybe the thresholds for (IR_AC_Max - IR_AC_Min) are different for Red and Green LED?

Can someone please help me out with this?

Poke around the datasheet https://cdn.sparkfun.com/assets/f/e/9/4/1/MAX30101.pdf