title: How do I improve the accuracy of this pedometer algorithm?
body: <p>I've tried several ways of measuring the steps a user makes with an iPhone by reading the accelerometer, but none have been very accurate.  The most accurate implementation I've used is the following:</p>
  
  <pre><code> float xx  = acceleration.x;
   float yy  = acceleration.y;
   float zz = acceleration.z;
  
   float dot = (mOldAccX * xx) + (mOldAccY * yy) + (mOldAccZ * zz);
   float a = ABS(sqrt(mOldAccX * mOldAccX + mOldAccY * mOldAccY + mOldAccZ * mOldAccZ));
  
   float b = ABS(sqrt(xx * xx + yy * yy + zz * zz));
  
   dot /= (a * b);
  
   if (dot  &lt;= 0.994 &amp;&amp; dot &gt; 0.90) // bounce
   {
  
    if (!isChange)
    {
  
     isChange = YES;
     mNumberOfSteps += 1;
  
    } else {
     isChange = NO;
    }
   }
  
   mOldAccX = xx;
   mOldAccY = yy; 
   mOldAccZ = zz;
  }
  </code></pre>
  
  <p>However, this only catches 80% of the user's steps.  How can I improve the accuracy of my pedometer?</p>