I think the LPF should not be so aggressive.
if you want automatic pulse measurement that remains to be seen, a pretty picture is a different story


you can adjust filter as you see fit


Quote Originally Posted by richard View Post
the filter is not really the issue, its the variability of the data that is problematical, every 128 sample is subtly different.
light leakage, finger pressure and position and even finger compression time lead to wildly variable readings. my max30102 housing is probable not ideal either
i use for this filter
fv = fv*x + nv*(y)

where x+y = 1, fv = average nv = new value

in pbp terms x y
ave = (ave ** 60000) + (buffer[index] ** 5535 ) ;60000 + 5535 = 65535

or
ave = (ave */ 250) + (buffer[index] */ 5 ) ;250+ 5 = 255

depending on finesse required, the introduced phase shift has no bearing on the result either.
it may not be as fast as your method but has better control and in this case speed is of no importance



@ PutMulResult?D _average ;RED AVERAGE
ave = DIV32 128 ;RED AVERAGE
reg = OVF_COUNTER
i2cread sda,scl,ADDR,reg,[reg ]
DEBUG 13,10,"OverFlows ",DEC reg,9,dec ave,9,hex ave
FOR index = 0 TO 255 step 2
ave = (ave ** 57000) + (buffer[index] ** 8535 )
lpfdata[index>>1]=ave
;.....lpf..;;;;----red-----;;;;======-ir-========
DEBUG 13,10,dec ave,9,dec buffer[index],9,dec buffer[index+1]

NEXT
' RETURN