You are reading a single comment by @jeffmer and its replies. Click here to read the full conversation.
  • I had a go with using a DC filter to remove the bias and here are the results. First. here is the simulated performance of the current Pedometer with RAW_THRESHOLD = 17:

    X_STEPS = 6, RAW_THRESHOLD = 17
    File, Expected, Simulated, Diff, %, (Original)
    HughB-walk-6605.csv, 6605, 6215, -390, 94.10 %, (3223)
    HughB-walk-2350.csv, 2350, 2204, -146, 93.79 %, (1042)
    HughB-walk-a3070-b3046.csv, 3070, 2936, -134, 95.64 %, (1909)
    HughB-walk-a10021-b10248.csv, 10021, 9107, -914, 90.88 %, (12222)
    HughB-drive-36min-0.csv, 0, 52, 52, 0.00 %, (1199)
    HughB-drive-29min-0.csv, 0, 109, 109, 0.00 %, (1153)
    HughB-drive-a3-b136.csv, 3, 82, 79, 2733.33 %, (535)
    HughB-work-66.csv, 66, 68, 2, 103.03 %, (980)
    HughB-work-66.csv, 66, 68, 2, 103.03 %, (980)
    HughB-mixed-390.csv, 390, 408, 18, 104.62 %, (1871)
    HughB-general-a260-b573.csv, 260, 361, 101, 138.85 %, (3854)
    HughB-housework-a958-b2658.csv, 958, 1728, 770, 180.38 %, (5762)
    MrPloppy-stationary-0.csv, 0, 0, 0, 0.00 %, (1)
    TOTAL DIFFERENCE 1508
    

    Now here are the results with using a DC Filter and reducing the threshold to 15:

    NSAMPLE = 12
    X_STEPS = 6, RAW_THRESHOLD = 15
    File, Expected, Simulated, Diff, %, (Original)
    HughB-walk-6605.csv, 6605, 6054, -551, 91.66 %, (3223)
    HughB-walk-2350.csv, 2350, 2164, -186, 92.09 %, (1042)
    HughB-walk-a3070-b3046.csv, 3070, 2858, -212, 93.09 %, (1909)
    HughB-walk-a10021-b10248.csv, 10021, 9903, -118, 98.82 %, (12222)
    HughB-drive-36min-0.csv, 0, 45, 45, 0.00 %, (1199)
    HughB-drive-29min-0.csv, 0, 58, 58, 0.00 %, (1153)
    HughB-drive-a3-b136.csv, 3, 67, 64, 2233.33 %, (535)
    HughB-work-66.csv, 66, 65, -1, 98.48 %, (980)
    HughB-work-66.csv, 66, 65, -1, 98.48 %, (980)
    HughB-mixed-390.csv, 390, 407, 17, 104.36 %, (1871)
    HughB-general-a260-b573.csv, 260, 400, 140, 153.85 %, (3854)
    HughB-housework-a958-b2658.csv, 958, 1825, 867, 190.50 %, (5762)
    MrPloppy-stationary-0.csv, 0, 0, 0, 0.00 %, (1)
    TOTAL DIFFERENCE 1399
    

    NSAMPLE is a parameter of the filter:

    //Exponential Moving Average DC removal filter alpha = 1/NSAMPLE
    
    int DCFilter_sample_avg_total = 8192*NSAMPLE;
    
    int DCFilter(int sample) {
        DCFilter_sample_avg_total += (sample - DCFilter_sample_avg_total/NSAMPLE);
        return sample - DCFilter_sample_avg_total/NSAMPLE;
    }
    

    @HughB It appears that the accuracy gets worse on your shorter walks and better on your longer walk with this approach.
    The main advantage is that it deals with the Mr Ploppy problem even if you set the threshold as low as 10.

About

Avatar for jeffmer @jeffmer started