# Velocity and Acceleration from Accelerometer values

Hi,

I am trying to compute the velocity and acceleration from the accelerometer. So far I have been unsuccessful in getting the desired results. I have tried filtering the raw data using Butterworth filter and then double integrating the magnitude of acceleration to get the magnitudes of velocity and displacement respectively.

I also tried computing using the basic equations of v=u+at and v^2-u^2=2aS. But the results seem nowhere close to what it should be.

What should be the best approach towards calculating the velocity and displacement?

Also, at rest the magnitude of the acceleration of the sensor is in the range of 0.3-0.4 m/s^2. Is this noise consistent with the sensor? and what is the best way to nullify it as it keeps on varying through the simulation?

I appreciate your time and help over this.
Thanks.

• What should be the best approach towards calculating the velocity and displacement?

This is not something we will comment on. We give you the sensor data, it is up to you to do what you want with it.
Read some white papers on this subject matter; much research has been dedicated to this already and is available on the internet.

Also, at rest the magnitude of the acceleration of the sensor is in the range of 0.3-0.4 m/s^2. Is this noise consistent with the sensor?

Read the datasheet: www.mbientlab.com/documentation and check the BMI160 datasheet from bosch to get error rates.

and what is the best way to nullify it as it keeps on varying through the simulation?

• edited April 2

I'm looking at the same problem as @Aiman is. My issue is the behaviour of the accelerometer when it comes to measuring gravity when the sensor is not moved at all. I would have expected measurements with noise but around 1g. In reality it is quite off from 1g and this "off" is also dependent on the orientation of the sensor. I'm trying to come up with my own calibration but this behaviour makes it really hard to use the sensor for calculating velocities, let alone trajectories...

And yes, I've read the datasheet and it is of no help with this issue.

• Real world data isn't perfect. It is your job to do averaging and noise filtering. You can read about great techniques for this online and look at basic averaging and low pass filters.

You could also consider using the gravity free acceleration output of sensor fusion.

• I know that sensor data is noisy and how to deal with that. My question is: is this orientation dependent error something that is normal behaviour of this sensor or it could it be a faulty sensor? I have tested with two different MetaMotion and have seen the same behaviour.

Linear acceleration of the sensor fusion module unfortunately doesn't help as it contains a constant acceleration even if the sensor is not moving at all. With an error here of about 0.3m/s^2, this leads to a velocity error of 3 m/s after only 10s of recording.

If it were a constant offset, it could be easily removed. But my tests show that it is a) depending on the orientation and b) even changes, i.e. sensor in orientation A yields offset O, moving to a different orientation and then back to A will give an offset that is not O.

In the end this might just mean that for reconstructing velocities this sensor is just not usable.