Class Max30102

  • All Implemented Interfaces:
    DeviceInterface, AutoCloseable

    public class Max30102
    extends Object
    implements DeviceInterface
    maxim integrated High-sensitivity Pulse Oximeter and Heart-rate Sensor. Datasheet
     INT  IRD  RD   GND
     GND  SCL  SDA  VIN
    
     INT: Interrupt pin
     IRD: The IR LED ground of the MAX30102 chip, generally not connected
     RD: RED LED ground terminal of MAX30102 chip, generally not connected
     GND: Ground
     SCL: I2C Clock
     SDA: I2C Data
     VIN: The main power input terminal 1.8-5V
    
     3-bit pad: Select the pull-up level of the bus, depending on the pin master voltage,
     select 1.8v or 3_3v (this terminal contains 3.3V and above)
     
    The active-low interrupt pin pulls low when an interrupt is triggered. The pin is open-drain, meaning it requires a pull-up resistor (min 4.7kOhm). Credit to: https://makersportal.com/blog/2019/6/24/arduino-heart-rate-monitor-using-max30102-and-pulse-oximetry https://github.com/sparkfun/SparkFun_MAX3010x_Sensor_Library https://github.com/doug-burrell/max30102/blob/master/max30102.py
    • Constructor Detail

      • Max30102

        public Max30102()
      • Max30102

        public Max30102​(int controller)
    • Method Detail

      • reset

        public void reset()
      • shutdown

        public void shutdown()
      • wakeup

        public void wakeup()
      • getRevisionId

        public int getRevisionId()
      • setup

        public void setup​(Max30102.SampleAveraging sampleAveraging,
                          boolean fifoRolloverOnFull,
                          int fifoAlmostFullValue,
                          Max30102.Mode mode,
                          Max30102.SpO2AdcRange spo2AdcRange,
                          Max30102.SpO2SampleRate spo2SampleRate,
                          Max30102.LedPulseWidth ledPulseWidth,
                          float led1CurrentMA,
                          float led2CurrentMA)
        Setup the device. * Note actual measured current can vary widely due to trimming methodology
        Parameters:
        sampleAveraging - number of samples averaged per FIFO sample
        fifoRolloverOnFull - whether or not the FIFO rolls over when full
        fifoAlmostFullValue - set the number of data samples remaining in the FIFO when the interrupt is issued (range 0..15). E.g. if set to 0, the interrupt is issued when there are no data samples remaining in the FIFO (all 32 FIFO words have unread data, i.e. the FIFO is full), if set to 15, the interrupt is issued when there are 15 data samples remaining in the FIFO (17 unread)
        mode - Operating mode
        spo2AdcRange - SpO2 ADC range
        spo2SampleRate - SpO2 sample rate
        ledPulseWidth - LED pulse width (us)
        led1CurrentMA - LED-1 pulse amplitude (range 0..51 mA) *
        led2CurrentMA - LED-2 pulse amplitude (range 0..51 mA) *
      • getDataPresent

        public int getDataPresent()
      • clearFifo

        public void clearFifo()
      • getFifoWritePointer

        public int getFifoWritePointer()
      • getFifoReadPointer

        public int getFifoReadPointer()
      • readTemperatureCelsius

        public float readTemperatureCelsius()
      • pollForData

        public int pollForData()
        Poll the sensor for new data - call regularly. If new data is available, it adds data to the queues
        Returns:
        number of new samples obtained