You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi @user107850,

    Thanks for your work on this! I did pull in and try your changes (and they were in 'cutting edge' Bangle.js firmwares for a while), but actually I think the most recent changes came after I'd moved to a new algorithm myself, so I didn't end up trying those I'm afraid.

    I felt like the problem initially was that the original, super-basic step counter actually did a half decent job of step counting for normal walking (it was within 10%). The issue was for everything else.

    The Oxford step counter was undoubtedly better for walking, but it actually (at least initially) seemed even worse for non-walking activities, and I had the same issue as @HughB understanding what was really going on so I couldn't easily make useful changes (although looking back, your 'pipeline of stages' explanation suddenly makes things look a lot clearer!).

    Given the reasonably large memory overhead and complexity, I figured I was better off starting from scratch with something I understood as it seemed like the overall algorithm should have been really simple.

    I did however shamelessly steal a few of the Oxford Step counter ideas though - developing on desktop first with a data-driven approach (https://github.com/gfwilliams/step-count­) and using that great filter generating website.

    As @HughB mentioned, initially I thought that a bandpass filter would help me filter out low frequency elements of the accelerometer data as well as high, but while on the whole it worked well, a big spike of acceleration would create ringing that looked like a bunch of steps. We moved to a low pass filter (then finally to the exact Oxford step counter one!), and @HughB added peak detection code (which then didn't require high pass filter) and a state machine to count steps.

    I feel like it's actually working pretty well now (although I still wonder whether filtering on X/Y/Z separately and then getting magnitude would help with false steps).

    However, there is always room for improvement, and getting students at Malmö involved would be amazing if there's interest. I'm happy to do a competition, but last time that was mentioned, there wasn't too much interest :(

    Apart from step counting there's heart rate as you say, which is potentially very interesting. It seems the manufacturer supplied algorithm (which is a binary blob that we don't really have access to the code for) uses accelerometer data (probably to discount readings) but is able to work off very low res data (like maybe 4 samples/sec) which means vastly improved energy usage since we currently run at 50 sps I believe.

    There's also a whole area of 'exposure adjustment' where the LED power is scaled in order to get the best readings. We're actually using the manufacturer-provided version which we reverse engineered at the moment on Bangle.js 2, but it just takes forever.

    There's also sleep tracking which would be really cool (and maybe other options around that). I imagine that's something that could definitely be handled in a data-driven way if we had a few captures of accelerometer data over the course of the night.

About

Avatar for Gordon @Gordon started