cancel
Showing results for 
Search instead for 
Did you mean: 

Accelerometer Reading Issue

K_P_D
Associate II
Posted on May 14, 2018 at 15:01

Hi There,

I am using the STM Accelerometer(LIS2DE12) with STM(stm32l432kb) controller.

While getting the readings from the Accelerometer it gives the random value continuously. Even it shows false value at steady position.

Here some how I am facing problem and need some idea and suggestion to solve this issue. If some one has the document , relevant data and sample code for it please let me know and help me.

Thanks

12 REPLIES 12
Posted on May 23, 2018 at 21:21

Velocity is integral of the

https://en.wikipedia.org/wiki/Acceleration

 so you have to integrate the acceleration in discrete domain, for example like this:

velocity = velocity + acceleration * (1.0f / data_rate_Hz);

The accleration must be in m/s2, it means multiply the acceleration in g by 9.81m/s2.

Posted on May 28, 2018 at 06:30

Hi

Batek.Miroslav

‌,

One more question I need to ask that from these velocity = velocity + acceleration * (1.0f / data_rate_Hz) formula, we can measure the decrease in velocity(Deceleration).

Posted on May 30, 2018 at 09:14

Hi

Batek.Miroslav

‌,

While making and developing the code to measure the velocity using accelerometer, as per yoursuggested equation

velocity = velocity + acceleration * (1.0f / data_rate_Hz) formula, and at output side i am getting a continuous increment in velocity without moving, i.eat steady position, the accelerometer. Can you let me know and guide me for why i am getting this result of velocity.

If you any other details of inside the code you ask me, I will let know the details

Here I am sharing my small basic sample code for your reference:

acceleration = ax; // ax is acceleration from the X-Axis and acceleration is Multiply by g(9.81) with X-Axis ACC.

initial_velocity = velocity ; // assigning previous velocity to initial velocity ..... v = u +at .... u = v ... after next data

velocity = (initial_velocity + (acceleration * (0.005))); // Here i have selected the Data rate(ODR) of ACC. at 200Hz

Kindly update me if there is an issue or any error in calculation ....

Thanks in Advance ...