Registering when a user takes a step?

I'm having a little trouble with this subject and I was wondering if anyone could help me out.

Essentially, for this app I'm trying to create it needs to register when a user takes a step. I've tried many things but I still can't figure out how to do this.
Here's my set up:

when attribute game.accelerometer.x is greater than .5 change attribute game.day's steps to game.day's steps + 1 (for the phone in a user's pocket upright)
when attribute game.accelerometer.x is less than -.5 change attribute game.day's steps to game.day's steps + 1 (for the phone in a user's pocket upside down)

How exactly would be the best way to register a step? Because with this app running in the background, every time the user puts their phone into their pocket it just messes up the whole accelerometer... Could I recalibrate by setting game.accelerometer to 0? And what would be the best rules/accelerometer values to register a step?

I know this is a very complex question, or it actually might not be, but I'm honestly stumped and any help would be greatly appreciated. Thanks a ton.

-Conifer Apps

Best Answer

  • RThurmanRThurman Posts: 2,881
    edited March 2014 Accepted Answer

    @Hopscotch said:
    ... where is @RThurman when one needs him?

    Rising from a long winter's nap!

    Pedometers are also fairly inaccurate. I just did several five-step tests with a cheap digital pedometer and got answers that varied from 4 to 7. (The kids got a kick out of watching me pace and count.)

    A pedometer becomes more accurate with when measured in thousands of steps. For example, you might have only walked 3800 steps, but the pedometer might display 4000.

    As a first approximation, I'd try a rule that tests the absolute value of all 3 accelerometer directions. If if the absolute value of x or y or z is greater than .5 then count it!

    Then tape a cheap pedometer to your device and and walk several hundred paces. Then see if it gives similar values. If testing shows similar values (within 10 % of each other) then you have it. If the values are off by more than 10% then start adjusting the threshold (the .5) up or down.

    As a second approximation. Start looking for trends when comparing the two devices. For example if your device is showing twice as many steps as a 'real' pedometer then you need to divide by half. (Or perhaps it will be the other way around.)

Answers

  • Conifer_AppsConifer_Apps Member Posts: 100
    edited March 2014

    Just to clarify - I need a pedometer rule.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    You would need to track a sudden variation in any direction, expecting the user to keep the phone in a fixed orientation during their 30min walk, including handeling the phone to change music ...

    Have you experimented if you can distinguish between normal movement and taking a step that high on the body? Even when knowing the exact orientation?

  • Conifer_AppsConifer_Apps Member Posts: 100

    @Hopscotch‌ - the way that worked best for me was not registering individual steps, but rather registering two repeated motions from the same leg and counting it as 4, but I can't get the accelerometer values right...

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited March 2014

    o.O, pattern recognition to find the steps, with noise filtering to remove random body movement.

    Hmm, tracking accelerometer values every 0.x seconds into a table, tracking the highest last variation and finding the previous time that value occured in the table. This should give a step frequency ... where is @RThurman when one needs him? :)

  • Conifer_AppsConifer_Apps Member Posts: 100

    @Hopscotch - If I'm following you right, you're saying to do a little step research first by tracking the step values into a table - then I could log a debugging statement showing what the step accelerometer values are, average them together, then set that as the threshold? Hmmm... Never thought of that. Ill give that a go right now and tell you what I get.

  • Conifer_AppsConifer_Apps Member Posts: 100

    Aww... Shucks... Can't log a debugging statement from an actual device... Although I don't think that that was what you were after.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited March 2014

    No, I was thinking of tracking the maximum values on the fly, getting the threshhold while live data is being read. It will be different for every person anyway.

    Tracking the biggest change, regardless of the direction. Thus it would not matter if the phone slips from horisontal to vertical in the pocket while walking.

    hmm, a table might even be unnecessary... thinking

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited March 2014

    Thanks @RThurman, same thoughts here. You just described it so much more ellequently :)

  • Conifer_AppsConifer_Apps Member Posts: 100
    edited March 2014

    Hmm... @Hopscotch‌ @RThurman‌ oohhhh... I totally get it! Absolute value of all the accelerometer values to register it as a step... When absolute value of accelerometer x,y,z > .5 then change attribute game.day's steps to game.day's steps + 1. Then I can do some tests and figure out what I need to divide it by. I'm also assuming that Gamesalad has an absolute value function? I'll give it a try. Thanks guys.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Great! Good luck, I am interested to see your progress.

  • Conifer_AppsConifer_Apps Member Posts: 100

    Cool. I'll mark this question as answered and make a new discussion and mention you two when I figure it out.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Best of luck, I see great possibilities related to the new networking feature in the pro version.

  • Conifer_AppsConifer_Apps Member Posts: 100

    Yes, I have some very cool ideas in mind. So far, dividing by 1.4 seems to be the most accurate when registering changes in all three accelerometer values, but I haven't done any formal testing. Yet. Thanks for your help :) .

Sign In or Register to comment.