You are reading a single comment by @Rudi and its replies. Click here to read the full conversation.
  • Hi there!
    I've also been experimenting with pedometer accuracy and would like to share my results.
    I'm using several parameters - currently just as constants in the JS code:

    // Max step duration (ms)
    const cMaxTime = 1200;
    // Min step duration (ms)
    const cMinTime = 240;
    // Max difference between consecutive steps (%)
    const cMaxDiff = 50;
    // Min number of consecutive steps
    const cMinSteps = 5;
    // Step sensitivity as per http://forum.espruino.com/comments/15186­837/
    const cSensitivity = 400;
    

    The trouble I'm running into is that getTime() seems to have a resolution of 80ms, which gives me trouble with really quick steps. When two steps are only 200ms apart, the jitter will often exceed the 50% set in cMaxDiff. Since I'm not a terriffic runner, that is not a problem for me, but for some it might be.

    Maybe you would like to look into my code and use the best from both our attempts.

    Thanks a lot!


    1 Attachment

  • Sun 2020.04.05

    post #14 'The trouble I'm running into is that getTime() seems to have a resolution of 80ms'

    Hi @Rudi, just ran some tests fetching the getTime() value from within an interval. From 100msec, 10msec, 1msec it can be seen that the call returns a value extremely close to that which is expected, even with a small interpreter execution duration.

    dur = 100
      time at [ 1 ]  85118.3  9614868164  diff: 0.0  9997558593
      time at [ 2 ]  85118.4  9612426757  diff: 0.1  0003662109
      time at [ 3 ]  85118.5  9616088867  diff: 0.1  0000610351
    
    dur = 10
      time at [ 1 ]  84861.25  775146484  diff: 0.00  997924804
      time at [ 2 ]  84861.26  773071289  diff: 0.01  004028320
      time at [ 3 ]  84861.27  777099609  diff: 0.00  994873046
    
    dur = 1
      time at [ 1 ]  84824.128  57055664  diff: 0.000  9765625
      time at [ 2 ]  84824.129  54711914  diff: 0.000  94604492
      time at [ 3 ]  84824.130  49316406  diff: 0.000  9765625
    

    raw data with visual spacing remeoved

    dur = 100
      time at [ 1 ]  85118.39614868164  diff: 0.09997558593
      time at [ 2 ]  85118.49612426757  diff: 0.10003662109
      time at [ 3 ]  85118.59616088867  diff: 0.10000610351
    
    dur = 10
      time at [ 1 ]  84861.25775146484  diff: 0.00997924804
      time at [ 2 ]  84861.26773071289  diff: 0.01004028320
      time at [ 3 ]  84861.27777099609  diff: 0.00994873046
    
    dur = 1
      time at [ 1 ]  84824.12857055664  diff: 0.0009765625
      time at [ 2 ]  84824.12954711914  diff: 0.00094604492
      time at [ 3 ]  84824.13049316406  diff: 0.0009765625
    



    Checked the source for acceleration thresholds?

    https://github.com/espruino/Espruino/blo­b/master/libs/banglejs/jswrap_bangle.c#L­90
    https://github.com/espruino/Espruino/blo­b/master/libs/banglejs/jswrap_bangle.c#L­366



    It's more likely to be the print() statements scattered throughout.

About

Avatar for Rudi @Rudi started