Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I measure the distance traveled by an iPhone using the accelerometer?

Tags:

iphone

While GPS works for long distance changes, I would like to measure a shorter distance by using the iPhone's accelerometer.

Say I want to measure a height of a box using an iPhone application. You'd start the application, press a button to start measurement at the bottom of a box, move your iPhone from to the top of the box, then press a button to stop measurement. The application would then calculate and display the height of the box.

How would I use the accelerometer to perform this kind of measurement?

like image 407
Matrix Avatar asked Sep 14 '10 09:09

Matrix


1 Answers

It is possible to do this, as I have implemented a more complex system on a sparkfun IMU.

There are a few components to do what you require accurately.

1) You need to filter the accellerometers signal using a low pass filter. This removes any noise that is not caused by your slow moving arm.

2) Integrate the 3 seperate acceleration values twice to go from acceleration to velocity, and then from velocity to distance.

3) The above method must be performed by keeing the phone in the same plane when you move it from the bottom of the box to the top. Any pitch/roll/yaw will disrupt the measurement(hint)

4) From above, to compensate for the pitch/roll/yaw, you can then include the built in gyro =]. Use this to map the vector obtained from the accellerometer to the starting point. Using this methodology you can measure the distance "through and object" by walking around it. (remember this gyro needs filtering too).

The final result depends on many factors such as, the effectiveness of your filter, the accuracy and sampling rates of your accellerometer and gyro, and the awsomeness of your mathematics and linnear algebra skills.

like image 148
Dbag Avatar answered Oct 19 '22 23:10

Dbag