MPU 6050 - Calculation of displacement

Hey,

we would like to calculate the displacement of the z axis with a MPU6050 and Arduino Uno. We know that this will become very inaccurate with time, but for our purpose it should be sufficient.
For that we use Jeff Rowberg’s I2C lib with the READABLE_REALACCEL output. To obtain the the acceleration in m/s^2 we divided the output by 16384 and then multiplied with 9,81 m/s^2. We not realy sure that 16384 is the right value for our calculations. How can we figure out what our sensitivity is? We used the default settings.
We calculated the displacement with this equation s=0,5at^2. But our calculated values deaviated significantly from the expected values. We moved the sensor approximately 0,30 m up and down, but our calculated values have a max amplitude of 0,0002 m. In the attached picture you can see our results.
Does anyone have an idea what went wrong? Even if we assume a sensitivity of 16G our values are still wrong. We really appreciate any help you can provide.

Displacement.png

You are trying to measure centimetres while riding in a dragster car that is doing a 12-second pass (1G). Unless your device is constrained on a rigid track then the tiniest misalignments will cause errors to exceed 100% in less than one second.

muhQ:
To obtain the the acceleration in m/s^2 we divided the output by 16384 and then multiplied with 9,81 m/s^2.

Are you first subtracting the output value when your accelerometer is at rest?

muhQ:
We calculated the displacement with this equation s=0,5at^2.

What is your time interval between measurements?

Are you first subtracting the output value when your accelerometer is at rest?

Do you mean the gravity? That is already removed from the output.

What is your time interval between measurements?

The time interval is 0,015 s.

muhQ:
Do you mean the gravity? That is already removed from the output.
The time interval is 0,015 s.

That's OK then.

For the first 0.015 second period you need to work out:
v = u + at (where u = 0 if starting from rest)

and you need to use:
s = ut + ½at²
to get the displacement in that time.

For the next 0.015s period you use the same equations with v from the previous period becoming u. To get the total displacement you will need to sum the displacements for each period.

If that doesn't work, I suggest you plot the acceleration (in m/s²) and the velocity measured during the 0.3m upward movement and see if they make sense.

Hey Archibald ,
thanks alot for your help. It seems that there was a mistake in my calculations. With your equations my calculated values are now close to the real values. Thanks! :wink:

muhQ:
Hey Archibald ,
thanks alot for your help. It seems that there was a mistake in my calculations. With your equations my calculated values are now close to the real values. Thanks! :wink:

That's good!

Essentially you are integrating twice by a numerical method to get from acceleration to displacement.