How to calculate Distance from Accelerometer Data

In summary, the beginner's project is to calculate distance by using accelerometer data that varies even when the sensor is stationary. The issue they are facing is that the displacement estimate changes continuously. They are using an algorithm that takes previous displacement values and adds current displacement values to achieve an accurate estimate of distance.
  • #1
Vikrant Mohanty
3
0
Hi All,
I am a beginner in embedded world. Currently I am working on MPU9250 motion sensor. My objective of project is to calculate the distance in real time using accelerometer. e.g. If I am at point A (i.e located at 5cm on X-axis) and I am willing to move towards point B (i.e. located at 50cm on X-axis) then the movement from A->B should show changes in distance as 5,6,7,---10---50 cm. Similarly movement from B->A should show changes in distance as 50,49,48----30,29,----5 cm.

My project is very generic and it is to be implemented on embedded processor, so I don't need any costlier algorithm like kalmaan etc. I had gone through many forums for accomplishing this task. I am using double Integration and also filtering the noise and managing the drift as well.

The issue I am currently facing is that, I am getting data , which varies even when the sensor stand still. Due to which the final estimated distance is getting change continuously. Also when I move the sensor the overall estimated displacement is coming out to be very low. Also the changes in X,Y & Z are not so simultaneous during changes in position. Please suggest me some direction to eliminate the issue.

Currently my displacement algorithm is -
V[t] = V[t-1] + (A[t]+A[t-1])*T/2-----Where T is my sampling interval set by RTOS. 100msec
Pos[t] = Pos[t-1] + (V[t]+V[t-1])*T/2Thanks
 
Engineering news on Phys.org
  • #2
You will never completely eliminate the issue--you will always have some displacement error. You can try to identify individual sources of error and control the ones that are controllable. If you are using single axis acceleration to determine displacement, then you should minimize the "tilt" of the sensor at all times throughout the motion. If your end result looks very low, what does your intermediate data look like? Does the raw acceleration data correspond to the actual applied accelerations? Does your filtered acceleration data look reasonable? Can you reduce your sample interval or is that a hard limit of the RTOS? What is the full-scale range setting are you using? What is the maximum acceleration you are applying?
 
  • #3
What you described is called inertial navigation. A Google search for that phrase returns 1500000 hits. I'm sure you can find much useful info online.
 
  • Like
Likes mechpeac
  • #4
You can calculate the distance by directly using your test acceleration values rather than velocity by using (A*T^2)/2 rather than the velocity in the second factor of your "Pos[t] = Pos[t-1] + (V[t]+V[t-1])*T/2" equation.

The resulting accuracy will be determinate upon the time increment you select for each acceleration value interval.
 
  • #5
The integration adds quite a bit of noise, you can use the FFT method for calculating velocity and position if you have enough processing power.
 
  • #6
I looked at the data sheet for this and I was wondering what "G" range you programmed it for. I assume that if you are walking around with this device that you programmed it for the 2G range.

How are you reading the device? Are you sure you are getting samples at precise intervals?
 
  • #7
Aaron Crowl said:
I looked at the data sheet for this and I was wondering what "G" range you programmed it for. I assume that if you are walking around with this device that you programmed it for the 2G range.

How are you reading the device? Are you sure you are getting samples at precise intervals?
Yes I am getting samples at precise interval. May I know what makes you assume that the device is programmed for 2g since I haven't post any readings of the device.

Moreover the device is programmed for 8g as I am using a TI sensortag which provide all necessary software settings. With this settings I had confirmed gravity vector at parallel surface i.e. x=0, y=0, z=1. Similar readings obtained for all other surface when placed resting. Also for any quick movement I found the acceleration changing from low to high value.
If you can guide me specifically about your assumption I can check accordingly.
 
  • #8
Low range settings may be more appropriate for walking. You would get better accuracy. Higher range settings would be better suited for detecting things like impacts. 8g sounds pretty high but I could be wrong. Are you maxxing the output value when you quickly move the device? If not, you could try a lower setting.

Could you describe how you are filtering the data and what the sample rate is?
 
  • #9
Hello Aaron,

Yes, with 2G setting I got quite a good variation for movement. For 8G setting this was not the case, as I have to give a fast jerk for obtaining it. Thanks for your advice. Now, the output seems to be more stable.
 
  • #10
Glad to help.
 

1. How do I convert accelerometer data to distance?

The distance traveled by an object can be calculated by multiplying the square of the time interval by half of the acceleration. This equation assumes constant acceleration over the given time interval.

2. What units should I use for the accelerometer data and distance?

The units used for accelerometer data and distance will depend on the specific accelerometer and the desired unit of measurement. Acceleration is typically measured in meters per second squared (m/s²) and distance can be measured in meters (m) or centimeters (cm).

3. Can I use the accelerometer data to calculate distance in any direction?

Most accelerometers measure acceleration in three axes: x, y, and z. By using a combination of the three axes, the distance traveled in any direction can be calculated.

4. How accurate is the distance calculation from accelerometer data?

The accuracy of the distance calculation will depend on the accuracy of the accelerometer, the sampling rate, and any external factors that may affect the data. It is important to calibrate the accelerometer and carefully consider any external factors when calculating distance.

5. Are there any limitations to using accelerometer data to calculate distance?

Accelerometers have limitations such as sensitivity to external factors like temperature and vibration, as well as potential errors in measurement due to sensor drift. Additionally, the distance calculation may not be accurate for objects with varying acceleration or when there are sudden changes in acceleration. It is important to carefully consider these limitations when using accelerometer data to calculate distance.

Similar threads

  • General Engineering
Replies
4
Views
2K
  • General Engineering
Replies
4
Views
5K
  • Introductory Physics Homework Help
Replies
5
Views
1K
Replies
4
Views
8K
Replies
1
Views
1K
Replies
9
Views
7K
Replies
14
Views
1K
Replies
2
Views
2K
  • Advanced Physics Homework Help
Replies
11
Views
1K
Back
Top