Search code examples
maxheartrate

Reading MAX30101 HR and SP02 data


I am trying to calculate heart rate and peripheral capillary oxygen saturation (SPO2) from a MAX30101 High-Sensitivity Pulse Oximeter and Heart-Rate Sensor. I understand when I am in HR mode my sample has 3 bytes, and when I am in SPO2 mode, sample has 6 bytes. I don't understand what to do after getting the raw data.

I know that for SpO2 I need to use a ratio R=(ACred/DCred)/(ACir/DCir),and after that SpO2=104-17R ( as shown in this datasheet: https://pdfserv.maximintegrated.com/en/an/AN6409.pdf), but I don't know how to get AC i DC components, or how to get HR. There is not any specific info about it in the datasheet. Can someone explain it to me, or provide an example? I am only able to return raw data.

Here is part of code I've created for reading one sample using the stm32ide:

void max_readFIFO_one_sample(uint8_t mode)
{
    if (mode= hr)
    {

        ret= HAL_I2C_Master_Transmit(&hi2c1, MAX_ADDRw, 0x05, 1, HAL_MAX_DELAY);
        ret= HAL_I2C_Master_Receive(&hi2c1, MAX_ADDRr, temp, 3, HAL_MAX_DELAY);
    }
    else if (mode == spo2)
    {
        uint8_t temp[6] = {0};
        ret= HAL_I2C_Master_Transmit(&hi2c1, MAX_ADDRw, 0x05, 1, HAL_MAX_DELAY);
        ret= HAL_I2C_Master_Receive(&hi2c1, MAX_ADDRr, temp, 6, HAL_MAX_DELAY);
    }


}

Solution

  • You have to use DC Filtering because the electrical nature of the response leaves it full of noise. You need to find a way to smooth the jagged curve that's produced so you can get a more stable and useable response (less noise). The article you mention describes one way to do it, but there are others, including just taking average values. The gist: you need to treat the range of signal values as a specific signal value at a specific time in order to get meaningful results. You have to find a way to turn the analog continuous value into a digital discrete value.