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.

 

View solution in original post

PaulD1
Super User
Super User

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,490)