I've just looked at the datasheet and it says there's a maxiumum zero-g offset for the accelerometers of 90mg (or 25 typical) - so that's 8192*90/1000 = 737 maximum, or 205 normally!!
So it's hardly surprising that some people are finding the step count going crazy - @Mr_Ploppy's accelerometer isn't broken or defective, it's actually well within spec.
what happens if we increase the threshold? It seems like it may be a benefit looking at those stats you posted. Sure, it has a 0.5% change during a walk, but for driving/housework/etc which were always an issue it's 50%+ better!
Maybe instead of accMag-8192 we have a long-term average of accMag that we subtract? that way it effectively auto-calibrates.
I think I'd mentioned this at the time with this updated peak detector, but the old one required that the acceleration be below a threshold, then above in order to trigger - and I don't think it would have suffered as much with this. We could always look at doing a slightly different method of peak detection.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks @Mr_Ploppy, that's great!
I've just looked at the datasheet and it says there's a maxiumum zero-g offset for the accelerometers of 90mg (or 25 typical) - so that's 8192*90/1000 = 737 maximum, or 205 normally!!
So it's hardly surprising that some people are finding the step count going crazy - @Mr_Ploppy's accelerometer isn't broken or defective, it's actually well within spec.
The datasheet (https://kionixfs.kionix.com/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf) does hint that the offsets can be due to things like stress (so the PCB expanding/contracting slightly and squashing the accelerometer) so it may not even be something we can calibrate for as it may change depending on temperature.
So...
accMag-8192
we have a long-term average of accMag that we subtract? that way it effectively auto-calibrates.I think I'd mentioned this at the time with this updated peak detector, but the old one required that the acceleration be below a threshold, then above in order to trigger - and I don't think it would have suffered as much with this. We could always look at doing a slightly different method of peak detection.
1 Attachment