# how to calculate heart rate and spo2 from maxrefdes117

hello,
i am interfacing the the maxrefdes117(max30102) with microcontroller. i m able to read the register of red and ir led. the data is of 3 byte and my problem is that how to calculate heart rate and spo2 from it.

thanks

hi ,
i am doing interfacing of maxrefdes117 (max30102) heart rate and pulse oximeter. my problem is that how i will calculate the the heart rate and spo2 by using ir and red led data.
i am getting the data from the IR AND RED LED DATA but i am unable to understand the algorithm .
give the simple way to get the data from register output.

thanks

Don't cross-post!!!!!!!!!!!!!!!!!!!!!!!!!!!!

His other identical post: http://forum.arduino.cc/index.php?topic=549947.msg3749591#msg3749591

.

You could always open a Maxim Integrated account and download their sample Arduino code:
https://www.maximintegrated.com/content/dam/files/secured/design-tools/software/6300/RD117_ARDUINO_V01_00.zip

the same sample from github

i used this example but i don't understand the concept of heart and spo2 calculation . can u explain how this calculation done . in my coding i am able to read the data from ir and red led but i want to know the process to calculate hr .
thanks

You have to read the datasheet to understand the algorithm written here
https://github.com/MaximIntegratedRefDesTeam/RD117_ARDUINO/blob/master/algorithm.cpp
Maybe there is also an application note that explain it better.

This calculation of heart rate is done in the function "maxim_heart_rate_and_oxygen_saturation(}". To me, it looks like they are looking for the number of samples between peaks in the data. Some comments in the code lead me to believe that there are 25 samples per second so each sample is 0.04 seconds (40 milliseconds). Multiply by the samples between peaks and divide into 60 seconds (60000 milliseconds) and that gives you beats per minute.

You can read the function here:

i don't understand the concept of heart and spo2 calculation

Plenty of info on the web, for example, so do your research and reading.

How to read the values of IR and red led . What is the address for fetching the values?

kalpesh11:
How to read the values of IR and red led . What is the address for fetching the values?

Looks like it is done with this function call:

`````` maxim_max30102_read_fifo((aun_red_buffer+i), (aun_ir_buffer+i)); //read from MAX30102 FIFO
``````

The function is in max30102.cpp. Looks like it reads six bytes from register address REG_FIFO_DATA. The first three bytes are a 24-bit RED value and the next three are a 24-bit IR value. For the UNO, which has limited RAM, the library uses 16-bit numbers and only keeps the top 16 bits. For processors with more memory it returns all 24 bits in a 32-bit long integer.