Find the Acceleration and Distance from the Output of an Accelerometer Sensor

AI Thread Summary
To calculate acceleration and distance from an accelerometer, it is essential to understand that the sensor outputs acceleration data in specific units, which may not directly translate to meters or centimeters without conversion. The formula v = u + 1/2(a * t^2) is not suitable for this application; instead, integration of acceleration data is required to derive velocity and distance. Accurate distance measurement necessitates knowing the time interval between readings, which can be determined from the sensor's output frequency. Errors can accumulate significantly when integrating acceleration data, especially if the sensor experiences rotation or varying acceleration. For better accuracy, combining accelerometer data with a vehicle speed sensor (VSS) is recommended, as it provides a more reliable measure of velocity and position.
varul92
Messages
2
Reaction score
0
My question is kindof related to physics, as I have an Accelerometer sensor through which I am able to get the sensor data as following:

x = 192
y = 433
z = -453

I need to convert these values in such a way so that It will share Acceleration in cm or meters,
And also what concept I should use to find out the distance through acceleration?

While searching something useful I found out the formula

v = u + 1/2(a * t^2)

Is this right formula to use for finding distance but still the major issue is how to find the time from these sensors

Note: I am using Arduino to get the output from these sensors
 
Physics news on Phys.org
varul92 said:
I need to convert these values in such a way so that It will share Acceleration in cm or meters
You will need to check the documentation to find what units are provided. Note that cm and m are units of distance, not acceleration.

varul92 said:
While searching something useful I found out the formula

v = u + 1/2(a * t^2)

Is this right formula to use for finding distance
No, this formula will not work for your application. You will need to use ##a=\frac{d^2}{dt^2}x##.
 
Last edited:
The way to track positions from accelerometer and gyroscope outputs is to iteratively perform the integrations and calculations of the 6 degree of freedom (6DOF) equations of motion. If you are certain that there are no rotations, it is a lot simpler.
 
  • Like
Likes Fededevi
varul92 said:
And also what concept I should use to find out the distance through acceleration?
Did you google "position from inertial sensor" or similar. It is a very common application, and there are various methods and tools available.
 
varul92 said:
While searching something useful I found out the formula

v = u + 1/2(a * t^2)
There are three well known (so-called suvat) equations which tell you about motion under linear acceleration. This link has them all in one place and they are worth learning off by heart - or at least having them very much to hand. They apply ONLY to motion under constant acceleration. If the acceleration is varying over time the you need to use Integral calculus based calculations.
Suvat will help you calculate any of the s,u,v,a,t values if you know all the others. You have to pick the right formula to use i.e. the one with the required answer on the left or at least the quantity you need in it somewhere so you can re-arrange the equation to bring it on the left.
One very important thing about accelerometers is that when you consider motion under gravity, an accelerometer will register zero when the measured object is in free fall because the same (g) acceleration is applied to the meter and the object. This is not a problem if you bear it in mind.
PS this sort of dead reckoning position finding method can have enormous errors!
 
  • Like
Likes Fededevi
sophiecentaur said:
this sort of dead reckoning position finding method can HAS enormous errors!

Edited to reflect my experience. I have used accelerometers to (attempt to) measure position. And I was using industrial grade PCB accelerometers with 12 bit A/D converters in a system with 1 LSB of noise. Translated into English, that last sentence is "And I was using equipment far better than your LIS3DHTR".

Start a project like this by first plotting acceleration while running simple tests: Accelerometer stationary in various positions, waving band and forth, etc. When you fully understand the relationship between what you are doing with the accelerometer and the output of the accelerometer, then the next step is to calculate velocity. Save the position for last, and only after successfully getting velocity.
 
  • Like
Likes sophiecentaur
the major issue is how to find the time from these sensors
You don't need the absolute time, you just need to know the time passed since the last reading of the sensor. The specs of the IC say that the sensor outputs the acceleration at up to 5khz, So your timestep for integration should be 1/5000s if you use it at that frequency.

I want to point out that you can't obtain the movements in 3D with only the accelerometer data, unless you completely restrict the sensor rotation and you know the initial orientation.
And you can't even calculate the orientation with the data even if the device is at rest.
For example if the sensor is at rest on a table orthogonal to gravity so the axis are reading something like [ 0, 0, 1], you can rotate the sensor on the table plane without it detecting any change.
Or for example if the sensor is free-falling you loose the gravity reference vector and you can't detect any rotation at all which makes subsequent calculations basically guesses.
 
  • Like
Likes FactChecker
@varul92 I notice that you haven't replied to these responses. It could be that the responses have assumed too much about what you know. Could you give PF an idea of your present level of knowledge and also more about the project you are involved in?
 
  • #10
Hi @sophiecentaur

Sorry For the late replies, I am using this accelerometer in my car with ESP8266 to find out the distance my car has been traveled from the initial point to the final point after a specific interval of time specified in the program by me. Mentioned above formulae by me were searched from Arduino forums but I wasn't sure to make it work with my device I need some good suggestion to make it work.

I am thankful and even going through all the replies everyone mentioned and will update you shortly with my results too
 
  • #11
varul92 said:
I am using this accelerometer in my car with ESP8266 to find out the distance my car has been traveled from the initial point to the final point after a specific interval of time specified in the program by me.
Are you talking about the linear distance of the path traveled or about the distance "as the crow flies" between the initial and final position?
In the first case, forward acceleration of the car can be simply integrated to velocity and then integrated again to distance. You should understand that small errors can accumulate. Also, initial velocity must be zero or known and input.
In the second case, you definitely need the full complexity of an inertial reference system, with gyroscopes to determine the direction that the car is pointed.
 
Last edited:
  • #12
So this is a car acceleration / velocity / distance project. That is important information.

As several people have pointed out, integrating acceleration twice amplifies errors. One source of error is pitch error. The car pitches up under acceleration, plus no road is perfectly level. A simple accelerometer sees pitch as acceleration.

A better approach would be to use the accelerometer to sense the beginning of acceleration, plus tap into the vehicle speed sensor (VSS) to get velocity and position. The VSS signal can be counted to get position directly and accurately, and differentiated to get velocity. The primary error in the VSS signal is the exact tire diameter, which you can get from a calibration run. Another error, of course, is spinning the wheels. Other sensors measure wheel rotation for the anti lock brake system. Tapping into the wheel sensor of a nondriven wheel will get you actual velocity when the driven wheels are laying rubber.

Velocity from the VSS signal is available from the OBD buss, but that source has latency. Latency means that the velocity on the OBD buss is delayed from the actual velocity. The OBD buss is a good source of velocity for normal driving, but not so good for measuring drag race performance.
 
  • Like
Likes Dale
Back
Top