How to calculate Distance from Accelerometer Data

  • Thread starter Thread starter Vikrant Mohanty
  • Start date Start date
  • Tags Tags
    Accelerometer Data
Click For Summary

Discussion Overview

The discussion revolves around calculating distance using accelerometer data from the MPU9250 motion sensor. Participants explore methods for real-time distance estimation, addressing challenges related to noise, drift, and sensor accuracy during movement.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their project objective of calculating distance in real-time using double integration of accelerometer data, while facing issues with noise and drift.
  • Another participant notes that complete elimination of displacement error is impossible and suggests minimizing sensor tilt and examining raw and filtered acceleration data.
  • A different participant identifies the approach as inertial navigation and suggests searching online for more information.
  • One suggestion involves calculating distance directly from acceleration values rather than using velocity in the displacement equation, emphasizing the importance of time increment selection.
  • Another participant mentions that integration can introduce noise and proposes using FFT methods for velocity and position calculations if processing power allows.
  • Questions arise regarding the "G" range settings of the sensor, with one participant assuming a 2G setting for walking and another confirming an 8G setting, discussing the implications for accuracy.
  • Participants discuss the appropriateness of range settings, with lower ranges suggested for walking to improve accuracy, while higher ranges may be better for detecting impacts.
  • One participant shares that they achieved better variation in movement with a 2G setting compared to an 8G setting, indicating a more stable output.

Areas of Agreement / Disagreement

Participants express differing views on the optimal "G" range settings for the accelerometer, with some suggesting lower settings for improved accuracy during walking, while others discuss the implications of higher settings. The discussion remains unresolved regarding the best approach to minimize errors in distance calculation.

Contextual Notes

Participants mention various factors that could affect the accuracy of distance calculations, including sensor tilt, sampling intervals, and filtering methods, but do not reach a consensus on specific solutions or methods.

Who May Find This Useful

This discussion may be useful for individuals working on projects involving motion sensors, particularly those interested in real-time distance calculations using accelerometer data in embedded systems.

Vikrant Mohanty
Messages
3
Reaction score
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
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?
 
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   Reactions: mechpeac
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.
 
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.
 
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?
 
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.
 
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?
 
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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
4K
Replies
11
Views
24K
Replies
9
Views
7K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 3 ·
Replies
3
Views
11K
  • · Replies 4 ·
Replies
4
Views
3K