ICM20 SCALE FACTOR

By lexluthor , 30 January 2019

I read in a blog that in order to scale the output from the sensor 2's complement should be done on output and then divide it by the sensitivity scale factor.
Here's the code that I am using:

//2's complement
gyro_val.x = (gyro_val.x ^ max) + 1;
gyro_val.y = (gyro_val.y ^ max) + 1;
gyro_val.z = (gyro_val.z ^ max) + 1;

//Sensitivity
g_x = (gyro_val.x / 16.4);
g_y = (gyro_val.y / 16.4);
g_z = (gyro_val.z / 16.4);

But the problem here is that even when the sensor is stationary, the output is not 0 or near to it.
So what could be the solution for it?

phpbb Topic ID
37402