12-05-2023 09:21 PM
Hello, I am currently attempting to extract data from the accelerometer. The raw data shows this and I cannot find scaling factors from datasheet Table 93. Is there a way to change acceleration to m^2/s?
Solved! Go to Solution.
12-07-2023 03:07 PM
Hi Newguy,
As you accel used 8G range, you can call this function lsb_to_mps2(data.x, 8, 16) to get m^2/s value.
/*!
* @brief This function converts lsb to meter per second squared for 16 bit accelerometer at
* range 2G, 4G, 8G or 16G.
*/
static float lsb_to_mps2(int16_t val, float g_range, uint8_t bit_width)
{
float half_scale = ((float)(1 << bit_width) / 2.0f);
return (GRAVITY_EARTH * val * g_range) / half_scale;
}
12-27-2023 02:21 AM
It's working for me, sorry for the late reply.
Thanks a lot.
12-27-2023 02:31 AM
Welcome, Newguy.
12-27-2023 03:58 AM
Additionally, can you explain to be what is the difference between wake-up acceleration and acceleration?
I am using linear acceleration in order to remove the gravity component, is this a good idea?