MAX30101 - IR LED only

Hello - I wanted to ask if anyone has been able to use only the IR LED when taking measurements with the MAX30101.

I see in the examples you can choose from Red, IR+Red, and IR+Red+Green, but have been digging through the source files and it appears that it might be possible to select the IR led only, I am just not sure if that is possible with the provided functions.

From line 75 on https://github.com/sparkfun/SparkFun_MA … MAX30105.h

  Multi-led configuration mode (page 22)
  void enableSlot(uint8_t slotNumber, uint8_t device); //Given slot number, assign a device to slot
  void disableSlots(void);

It seems that you might be able to enableSlot for just the IR LED, and referring to page 22 on the datasheet…

<LINK_TEXT text="https://cdn.sparkfun.com/assets/8/1/c/9 … sheet.pdf
">https://cdn.sparkfun.com/assets/8/1/c/9/0/MAX30101_Datasheet.pdf
</LINK_TEXT>

this seems possible…but looking through the .cpp files the information is a bit confusing (lines 240-244)

https://github.com/sparkfun/SparkFun_MA … X30105.cpp

void MAX30105::setLEDMode(uint8_t mode) {
  // Set which LEDs are used for sampling -- Red only, RED+IR only, or custom.
  // See datasheet, page 19
  bitMask(MAX30105_MODECONFIG, MAX30105_MODE_MASK, mode);
}

I have two of the sensors coming in a few days so I can’t test anything out yet, but wanted to ask if advance if anyone has done this before.

Thank you!

Before you starting pouring too much time into the code, make sure you double check the functions written in those source files to what the MAX30101 can really do. Those source files you’re referencing are for the MAX30105. There could be some compatibility issues going back and forth

Ah - good catch. I hadn’t considered that.

I’ll update here if I get it working - just testing the sensors now.

Thank you

Easy solution turned out to be enabling all 3 of the LED’s when calling particleSensor.setup(), and then setting the pulse amplitudes for the red and green to 0 so that the IR led is the only active LED.

Added a few lines to the Example1 in Arduino for anyone that is curious.

/*
  MAX30105 Breakout: Output all the raw Red/IR/Green readings
  By: Nathan Seidle @ SparkFun Electronics
  Date: October 2nd, 2016
  https://github.com/sparkfun/MAX30105_Breakout

  Outputs all Red/IR/Green values.

  Hardware Connections (Breakoutboard to Arduino):
  -5V = 5V (3.3V is allowed)
  -GND = GND
  -SDA = A4 (or SDA)
  -SCL = A5 (or SCL)
  -INT = Not connected

  The MAX30105 Breakout can handle 5V or 3.3V I2C logic. We recommend powering the board with 5V
  but it will also run at 3.3V.

  This code is released under the [MIT License](http://opensource.org/licenses/MIT).
*/

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

MAX30105 particleSensor;

// NOTE: Amplitude values: 0x00 = 0mA, 0x7F = 25.4mA, 0xFF = 50mA (typical) 0x1F default
uint8_t r_amp = 0x00; //off
uint8_t ir_amp = 0x1F;  //on -default
uint8_t g_amp = 0x00; //off

#define debug Serial //Uncomment this line if you're using an Uno or ESP
//#define debug SerialUSB //Uncomment this line if you're using a SAMD21

void setup()
{
  debug.begin(9600);
  debug.println("MAX30105 Basic Readings Example");

  // Initialize sensor
  if (particleSensor.begin() == false)
  {
    debug.println("MAX30105 was not found. Please check wiring/power. ");
    while (1);
  }

  particleSensor.setup();
  particleSensor.setPulseAmplitudeRed(r_amp);
  particleSensor.setPulseAmplitudeIR(ir_amp);
  particleSensor.setPulseAmplitudeGreen(g_amp);
}

void loop()
{
 
  debug.print(" R[");
  debug.print(particleSensor.getRed());
  debug.print("] IR[");
  debug.print(particleSensor.getIR());
  debug.print("] G[");
  debug.print(particleSensor.getGreen());
  debug.print("]");

  debug.println();
}