UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

MAX30100 Class

Module: max30100

The MAX30100 is an integrated pulse oximetry and heartrate monitor sensor solution. It combines two LEDs, a photodetector, optimized optics, and low-noise analog signal processing to detect pulse oximetry and heart-rate signals.
I2C sensor which can be used to read: Heart-rate Peripheral capillary oxygen saturation temperature
max30100.png

Methods

MAX30100

(
  • i2c_bus
)
Number

Oximeter and heart-rate sensor constructor
Initialize Oximeter and heart-rate sensor. Note, the I2C address is 0x57.

Parameters:

  • i2c_bus Number

    Target I2C bus

Returns:

Number:

sensor context pointer

sample

() Max30100_value

Sample a single set of infrared/red values
Note, all setup (sample rate, LED current, and pulse width must be done prior to calling this sample method.

Returns:

Max30100_value:

One IR/R sample

sample_continuous

(
  • gpio_pin
  • buffered
  • cb
)

Continuously sample Infrared/Red values.
This method requires a GPIO pin which is used to signal sample/samples ready. The INT * pin is open-drain and requires a pullup resistor. The interrupt pin is not designed to sink large currents, so the pull-up resistor value should be large, such as 4.7k ohm. The RCWL-0530 PCB which this library was designed with had the I2C lines and INT pin pulled up to 1.8v.
Note, all setup (sample rate, mode, LED current, and pulse width must be done prior to calling this sample method.

Parameters:

  • gpio_pin Number

    GPIO pin for interrupt (input from sensor INT pin)

  • buffered Boolean

    Enable buffered sampling. In buffered sampling mode, the device reads 16 samples at a time. This can help with I2C read timing. buffered == true, enable buffered sampling buffered == false, single-sample mode

  • cb Callback

    Pointer to instance of Callback class. If parameter is left NULL, a default instance of the Callback class will be used which prints out the IR/R values.

sample_stop

()

Stop continuous sampling. Disable interrupts.

read

(
  • reg
)
Number

Read Oximeter and heart-rate sensor registers

Parameters:

  • reg MAX30100_REG

    Target register to read

Returns:

Number:

Data returned from sensor

write

(
  • reg
  • wr_data
)

Write Oximeter and heart-rate sensor registers

Parameters:

  • reg MAX30100_REG

    Target register to write

  • wr_data Number

    Target data to write

version

() Number

Get sensor version Sensor version is a 2 byte value: upper byte = PART ID lower byte = REVISION ID
example: version() return 0x1105 0x11 = PART ID 0x05 = REVISION

Returns:

Number:

Sensor version

temperature

() Number

Get temperature reading from device

Returns:

Number:

rd_data Temperature in degrees Celsius

mode

(
  • mode
)

Set the sampling mode (none vs red only vs SpO2)

Parameters:

  • mode MAX30100_MODE

    Target sampling mode

mode

() MAX30100_MODE

Get the sampling mode

Returns:

MAX30100_MODE:

Current sampling mode

high_res_enable

(
  • enable
)

Enable or disable high-resolution mode

Parameters:

  • enable Boolean

    High-resolution enable true == SpO2 ADC resolution of 16 bit with 1.6ms LED pw

high_res_enable

() Boolean

Get the high-resolution enable bit

Returns:

Boolean:

Current high-resolution bit value

sample_rate

(
  • sample_rate
)

Set the sample rate

Parameters:

  • sample_rate MAX30100_SR

    Target sample rate

sample_rate

() MAX30100_SR

Get the sample rate

Returns:

MAX30100_SR:

Current sample rate

pulse_width

(
  • pulse_width
)

Set the LED pulse width

Parameters:

  • pulse_width MAX30100_LED_PW

    Target LED pulse width

pulse_width

() MAX30100_LED_PW

Get the LED pulse width

Returns:

MAX30100_LED_PW:

Current LED pulse width

current

(
  • ir
  • r
)

Set the current for the infrared and red LEDs

Parameters:

  • ir MAX30100_LED_CURRENT

    LED current enum

  • r MAX30100_LED_CURRENT

    LED current enum

current_ir

() MAX30100_LED_CURRENT

Get the infrared LED current

Returns:

MAX30100_LED_CURRENT:

current_r

() MAX30100_LED_CURRENT

Get the red LED current

Returns:

MAX30100_LED_CURRENT:

reset

()

Reset sensor
When the RESET bit is set to one, all configuration, threshold, and data registers are reset to their power-on-state. The only exception is writing both RESET and TEMP_EN bits to one at the same time since temperature data registers 0x16 and 0x17 are not cleared. The RESET bit is cleared automatically back to zero after the reset sequence is completed.

sleep

(
  • sleep
)

Put device into power-save mode. While in power-save mode, all registers retain their values, and write/read operations function as normal. All interrupts are cleared to zero in this mode.

Parameters:

  • sleep Boolean

    Enter/exit power-save mode

Properties

_callback

Callback