n-elia / MAX30102-MicroPython-driver

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

Code on RPi Pico #4

Closed ebolisa closed 3 years ago

ebolisa commented 3 years ago

Hi, Testing the library code (no changes made) on a Pico board and getting pretty much a linear output. What is possible wrong? TIA

Cap

n-elia commented 3 years ago

Hi ebolisa! First of all, let me know which is your particular board, and which is your sensor (the original Maxim, or a clone?). Then, please try to scale the y-axis, e.g., plot the Columna B only with an y-axis ranging from 18000 to 22000. Thank you!

ebolisa commented 3 years ago

Thanks for getting back to me. I'm using the Raspberry Pi Pico and the sensor board may be a clone: https://www.pantechsolutions.net/max30102-pulse-oximeter-heart-rate-sensor-module-i2c-interface. As for the graph, I'm using OpenOffice and I don't control it that well so I'm attaching some raw data. data.csv Cap EDIT: Updated sensor's link.

ebolisa commented 3 years ago

Ok, Made progress. Had a crash course on Calc. But how do I output in a range from 0 to 100% for Oxy. And < 200 for HR? TIA Cap

n-elia commented 3 years ago

You're very welcome.

So, as I could see in your link, this is a MAX30100, so I am not sure that this library will work. However, we can further investigate. Let's check something:

  1. The csv that you posted contains 26 points only. if I remember well, with the default settings, the sensor will provide 50 samples per second, therefore you should plot at least 200 samples (4 seconds) to see an heart signal that makes sense.
  2. You can easily check the acquisition frequency with the code proposed in the readme; please make sure to have at least 50Hz
    # Get the estimated acquisition rate
    acquisition_rate = sensor.getAcquisitionFrequency()
  3. How are you logging data? Is it fast enough to get all the samples?

Let me know!

n-elia commented 3 years ago

Nice to see that it works well!

You have to do some math to obtain SpO2 and HR. I put some hints in the last lines of the readme, here.

Please share your code if you manage to perform those computations locally, I am interested, too!

ebolisa commented 3 years ago

Sorry, I posted the wrong sensor's link so, I updated my post.

ebolisa commented 3 years ago

Will do. Thanks again.

n-elia commented 3 years ago

Fine! Then, I'm going to close this issue.

Please feel free to open a topic in the "Discussion" section if you want to look for help for implementing HR/SPO2 evaluation, or if you want to share some progresses.

Bye, Nicola