cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fbsx503
Regular Visitor

Steps counter - pedometer

Hello. Can i please get help with building an app that counts the number of steps? I already know that i have to use acceleratin.x acceleration.y acceleration.z but i do not know how to do so. Should i use timers? Compare latitudes and longitudes? Use a mathematical logical formula?
1 ACCEPTED SOLUTION

Accepted Solutions
BrettR
Advocate IV
Advocate IV

Haven't used Acceleration before but sounds like a cool idea. 

 

If I was you I would start by setting up a basic app that displays the acceleration.Z (Up and down) in a label and Acc.Y (forward and back).  Then go for a quick walk and keep an eye on which way the numbers are going, and where they start when the app first loads.  That should give you an idea of when you should 'record a step'.

 

Next, you'd also need something to keep looping to check what the values are of Z & Y.  if the loop checks and the value is higher than the limit you have set for a 'step', then get it to update a variable or something.  A timer could handle the looping every 0.5 seconds or so, and an if statement on the timer to check if the values fall inside/outside your range.

 

My guess is it wouldn't be super accurate, but it's a good start.  To make it more accurate, potentially get the timer to loop much quicker, every 0.1 seconds.  and save the current Acc.Y to a variable.  if the new value is higher than the previous value then you'd save it as a 'step'.

 

You could use Lat/Long, but then you'd have to do some step averaging based on the distance someone has walked.  e.g. 1 step every 1.2 metres or something.

 

View solution in original post

4 REPLIES 4
BrettR
Advocate IV
Advocate IV

Haven't used Acceleration before but sounds like a cool idea. 

 

If I was you I would start by setting up a basic app that displays the acceleration.Z (Up and down) in a label and Acc.Y (forward and back).  Then go for a quick walk and keep an eye on which way the numbers are going, and where they start when the app first loads.  That should give you an idea of when you should 'record a step'.

 

Next, you'd also need something to keep looping to check what the values are of Z & Y.  if the loop checks and the value is higher than the limit you have set for a 'step', then get it to update a variable or something.  A timer could handle the looping every 0.5 seconds or so, and an if statement on the timer to check if the values fall inside/outside your range.

 

My guess is it wouldn't be super accurate, but it's a good start.  To make it more accurate, potentially get the timer to loop much quicker, every 0.1 seconds.  and save the current Acc.Y to a variable.  if the new value is higher than the previous value then you'd save it as a 'step'.

 

You could use Lat/Long, but then you'd have to do some step averaging based on the distance someone has walked.  e.g. 1 step every 1.2 metres or something.

 

PaulD1
Community Champion
Community Champion

I think this is a very interesting from the perspective of 'could it be done' with Power Apps, but if this is for a serious App I'd advise that you probably don't want to do this with PowerApps.

I don't think that a timer will continue to run and record the accelerometer data if Power Apps is not running in the foreground on the device which I think makes Power Apps impractical in this scenario.

Don't most phones these days have a low power co-processor that can track steps? Maybe you could easily access that from a native app.

Fbsx503
Regular Visitor

How do I do that from a native app and what do you mean exactly? i am kind of new to this. Can you explain more please?

Fbsx503
Regular Visitor

I tried recording the change of numbers of accY and accZ but the numbers keep on changing even if the phone is fixed on a table. is that normal? And why would I consider it a step if the value goes higher than the range? What if it gets lower? This is what I am trying to know I cant find how a single step is measured using x,y and z. Shouldn't there be a fixed formula to deduce the number of steps accurately?

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,245)