title: Accelerometer to relative position
body: <p>Before I reinvent the wheel I wanted to see if anyone can share code or tips for the following:</p>
  
  <p>In order to get relative position of the iPhone, one needs to</p>
  
  <ul>
  <li>Set the accelerometer read rate</li>
  <li>Noise filter the accelerometer response</li>
  <li>Convert it to a vector</li>
  <li>Low pass filter the vector to find gravity</li>
  <li>Subtract gravity from the raw reading to find the user caused acceleration</li>
  <li>Filter the user caused acceleration to get the frequencies you are interested in ( probably bandpass depending on the application)</li>
  <li>Integrate to find relative speed</li>
  <li>Integrate to find position</li>
  </ul>
  
  <p>So what I'm hoping is that people have already written some or all of the above and can provide tips, or better yet code.</p>
  
  <p>A few questions I haven't found the answer to:</p>
  
  <p>What is the frequency response of the iPhone accelerometer?  What hardware filters exist between the accelerometer and the analog to digital converter?</p>
  
  <p>What is the fastest reading rate the accelerometer delegate can be called without duplicating reading values?</p>
  
  <p>Differences in the above for the various phones?</p>
  
  <p>Any good tips for designing the filters, such as cutoff frequency for separating gravity and user motion?</p>
  
  <p>Any code or tips for the integration steps?  Any reason to integrate in the cartesion coordinate system rather than as vector, or vise versa?</p>
  
  <p>Any other experiences, tips, or information that one should know prior to implementing this?</p>