oxullo / Arduino-MAX30100

Arduino library for MAX30100, integrated oximeter and heart rate sensor
GNU General Public License v3.0
190 stars 134 forks source link

Missing beats! #14

Closed DallySon closed 7 years ago

DallySon commented 7 years ago

Dear Sirs,

Thanks so much for your great job! It is really helpfull!

But I have problem, my sensor GY-MAX30100 with your library missing my beats. (may be every 2nd beat, or even 2-3 everyting).

I use coverglass (policorb. about 1mm or lab coverglass 0.1mm - same result).

output looks like: Beat! Heart rate:39.55bpm / SpO2:94% / temp:34.31C Heart rate:39.55bpm / SpO2:94% / temp:34.31C Beat! Heart rate:33.36bpm / SpO2:94% / temp:33.00C Heart rate:33.36bpm / SpO2:94% / temp:33.00C Beat! Heart rate:31.18bpm / SpO2:94% / temp:34.00C Heart rate:31.18bpm / SpO2:94% / temp:34.00C Beat! Heart rate:30.39bpm / SpO2:94% / temp:33.56C Heart rate:30.39bpm / SpO2:94% / temp:33.56C Beat! Heart rate:30.17bpm / SpO2:94% / temp:34.56C Heart rate:30.17bpm / SpO2:94% / temp:34.56C Beat! Heart rate:30.10bpm / SpO2:94% / temp:34.31C Heart rate:30.10bpm / SpO2:94% / temp:34.31C Beat! Heart rate:30.07bpm / SpO2:94% / temp:34.81C Heart rate:30.07bpm / SpO2:94% / temp:34.81C Beat! Heart rate:29.95bpm / SpO2:94% / temp:34.56C Heart rate:29.95bpm / SpO2:94% / temp:34.56C Beat! Heart rate:30.01bpm / SpO2:94% / temp:35.13C Heart rate:30.01bpm / SpO2:94% / temp:35.13C Beat! Heart rate:30.03bpm / SpO2:94% / temp:34.50C Heart rate:30.03bpm / SpO2:94% / temp:34.50C

But real pulse in this time about 80-90bps.

I connect pin 'INT' of board to my arduino INT0(2).

what can be reason of this problem?

Really hope on your help!

Thanks so much!

DallySon commented 7 years ago

Maybe I have to correct filter values? ( raw data bigger or smaller than have to be) But I don't know where and how I have to do it. Help me please.

reaper7 commented 7 years ago

I have exactly the same problem with similar values

DallySon commented 7 years ago

Did you resolve this problem? If so - how?

reaper7 commented 7 years ago

no :( we have probably too thin veins ;)

DallySon commented 7 years ago

may be for thise device :) but for another thigs - its look good :) So.. let's awaiting for Wizard "oxullo" - he will escape us!! I still hope..

yutakau commented 7 years ago

Me too. I was wondering just same issue.

oxullo commented 7 years ago

I have been running tests with at least 12 people. While it runs great for me in any condition, with a very low chance to miss beats, I reckoned that the average performance of the beat detector is definitely low.

Low perfusion (yes, @reaper7) seems to me the primary obvious cause: it causes the S/N ratio to decrease to the point that tiny pressure changes of the finger on the sensor's window cause the beat detector to overshoot, with a long recovery time.

Anybody willing to provide me recordings of the raw data recorded?

DallySon commented 7 years ago

Thanks for explaning. BUt what can I to do - for resolving this issue?

mtx512 commented 7 years ago

I'm using max30100 with a cortex M4, reviewed your algorithm and implemented something similar but heart rates results are inconsistent. The low pass filter seems to work well. Fortunately M4 has fpu so maths operations are faster however I think this may be a problem on a Arduino. The other area to consider is that there can be buffer overflows on the max30100.

Attached are samples from a test run, I'm seeing short periods where IR/RED samples are elongated which causes beat detection to restart, have you experienced this? See attached graph, labels are wrong top are IR values, bottom is low pass filter. screenshot from 2017-03-18 11 27 21

In the sample data file 1st column is a count (ignore), 2nd is RED and 3rd is IR. output_max30100_2.txt

oxullo commented 7 years ago

@mtx512 thanks for the data and the hint, I'll be looking at them next week. Does the data come from your port? Can you link the fork? And did you scope-checked if your code runs in less than 10ms?

oxullo commented 7 years ago

@DallySon I'll be adding a public interface for setting the bias current of the IR LED, so you can experiment easily with different values. If you can't wait (sorry but I have very limited amount of time), just modify the library, changing the constant IR_LED_CURRENT to something less than the current 50mA

https://github.com/oxullo/Arduino-MAX30100/blob/master/src/MAX30100_PulseOximeter.h#L24

DallySon commented 7 years ago

Thanks so much. I have time now to wait! Just don't forget about me.

oxullo commented 7 years ago

@DallySon you'll find the newly added interface on v1.0.1, feel free to experiment different currents for the IR LED. I noticed that with 7,6mA I experienced a very stable detection, but my test was completely empiric and a-scientific.

oxullo commented 7 years ago

@mtx512 I timed the execution of the time-critical code and it stays always below 500µs (ATMega328p @16Mhz). There's plenty of time for 100Hz sampling, even though I noticed a fairly irregular jitter on the wait code. I'll try to see whether I can move to a timer. If you want to elaborate on another ticket, feel free to open it!

pradeeps15 commented 6 years ago

Firstly, a great library and the forum has been really helpful. I am having problem with this sensor and getting incosistent heartbeat. Mostly getting stable SPO2 at 93% to 96% though. I was wondering if adjusting the current might help. Also, I must add that I have gone through a lot of issues raised earlier to troubleshoot my RCWL 0530 board to make it work on the Arduino UNO R3 and it does pass the Tester code and present with some readings in the Minimal example and another code based on your libraries by 14core. Is it necessary to cover the MAX30100 IC with a glass cover to get consistent results? I will debugging using the Rolling_Graph. I am new to Arduino and MAX30100 and could really use the help. Thanks.

FarzanehK commented 4 years ago

Module Max100 cannot detect hyoxia. Dear Pradeeps15 We have the same problem with green MAX30100, even for hypoxia patient, the SpO2 does not decrease to less than 93%. Would you please let me know if you have solved your problem about SpO2 values?

Bests

Firstly, a great library and the forum has been really helpful. I am having problem with this sensor and getting incosistent heartbeat. Mostly getting stable SPO2 at 93% to 96% though. I was wondering if adjusting the current might help. Also, I must add that I have gone through a lot of issues raised earlier to troubleshoot my RCWL 0530 board to make it work on the Arduino UNO R3 and it does pass the Tester code and present with some readings in the Minimal example and another code based on your libraries by 14core. Is it necessary to cover the MAX30100 IC with a glass cover to get consistent results? I will debugging using the Rolling_Graph. I am new to Arduino and MAX30100 and could really use the help. Thanks.