Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6866961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:14:57+00:00 2026-05-27T03:14:57+00:00

I have to develop the same functionality as of this Pedometer App I have

  • 0

I have to develop the same functionality as of this Pedometer App

I have observed this Pedometer app in very high detail.

It’s not a perfect pedometer app. For example, if you stay/sit at one place and shake your hand, it also detects steps counts and distance.

Ignore this ideal and gravity behavior, because in the instructions of this app it’s already been mentioned that you should tie up your iPhone or you should place it in your pocket to count steps.
This way, I have found this app working very well, it detects almost all steps.

My problem is: I have developed one sample according to the above logic, but it’s not working up to that level. For example, sometimes it detects 2-3 steps at the same time. And sometimes it works fine.

My code:

In viewDidLoad:

[[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.2] 

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    const float violence = 1.2;
    static BOOL beenhere;
    BOOL shake = FALSE;
    if (beenhere) return;
    beenhere = TRUE;
    if (acceleration.x > violence || acceleration.x < (-1* violence))
       shake = TRUE;
    if (acceleration.y > violence || acceleration.y < (-1* violence))
       shake = TRUE;
    if (acceleration.z > violence || acceleration.z < (-1* violence))
       shake = TRUE;
    if (shake) {
       steps=steps+1;
     }
  beenhere = false;
}

What am I doing wrong? I am not able to determine the threshold. If I make it high, it won’t detect minor steps. If I make it small, it registers 3-4 steps simultaneously.

Is there any other implementation required to do this, or some tweaks in this code?

I have seen all other similar Stack Overflow links. Nothing I have found performs up to this level.

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:14:58+00:00Added an answer on May 27, 2026 at 3:14 am

    Been counting snores, not steps, but have some of the same issues. No actual answers, but some suggestions:

    1. Require a time interval between steps. Yes, someone can be walking slowly or jogging, but even at the fastest there is a time interval of maybe 1/5 second between steps. If "impacts" appear more rapid than that they’re likely just from rebound/rattling.
    2. Rather than your fixed threshold (violence) employ a variable threshold, based on a moving average of previous events.
    3. Consider keeping separate x, y, and z thresholds, based on the assumption that the phone will not, over a short period of time, change orientation.
    4. Rather than just ignoring events stronger than a certain level, consider ignoring those outside a range, with limits specified by two thresholds (one perhaps a fraction of the other).
    5. Consider what happens when you walk — there is a forward/backward acceleration of the body that is quite rhythmic, along with a "shock" as the foot strikes the ground. It may be best to attempt to ignore the shock (a fairly short-term signal) and instead look for the rhythmic forward/backward motion.

    Another suggestion

    Testing this beast "live" would be impossible. (I can imagine you trying to jog along while holding the laptop in front of you, trying to get the debugger console to focus.) What you should do is first rig your app to make some recordings (ie, write files) containing the raw measurements, then re-rig your app (#ifdefs would be handy here) to be able to "play back" those measurements so that you can step through the app with the debugger and observe its behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to my client requirement I have assigned to develop calender app same as
I have develop an XNA game on computer 1. When I send it to
Hi i have develop and deploy one multilingual (english uk and swedish) website at
I have to develop an application which parses a log file and sends specific
I have to develop an application using C#.net that has to be run once
I have to develop software for a USB scale that, when you press a
I have to develop a tool in C# that retrieves some data from an
I have to develop a database for a unique environment. I don't have experience
We have to develop an Ecommerce site with 20+ pages of static content which
I have to develop an application with which my client will do visual design.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.