n-elia / MAX30102-MicroPython-driver

A Maxim MAX30102 driver ported to MicroPython. It should also work for MAX30105.
MIT License
56 stars 21 forks source link

Calculating SPO2 and Heartrate #21

Closed IamMugiChan closed 1 year ago

IamMugiChan commented 1 year ago

Hi there

I have successfully run the sample file however is it possible to compute

Heart Rate and SpO2 using this library?

n-elia commented 1 year ago

Hi,

this library has the only scope of providing you an access to the MAX30102 sensor when using MicroPython. Therefore, you can only get the RAW data.

To compute HR and SpO2, you have to code your own application. I left some hints about that here. There are some C++ implementations that could be ported in Python.

Feel free to start a new discussion if you want to ask the community or to share your findings (greatly appreciated). Also, you may take a look or start a new thread on MicroPyhton forum.

Bye, Nicola

IamMugiChan commented 1 year ago

Device Used: mh-et live max30102 Library Used: https://pypi.org/project/micropython-max30102/

Reading Sample No Finger Input: `

Now we can say that the device is reading ...

module configuration: sensor.set_sample_rate(400) sensor.set_fifo_average(8) sensor.set_active_leds_amplitude(MAX30105_PULSE_AMP_MEDIUM)

given this data from function red_reading = sensor.pop_red_from_storage() ir_reading = sensor.pop_ir_from_storage()

how can we compute the SpO2 and the Heart Rate? any ideas or sample?