I am using the BMX160 for an inclinometer application. 1. I am seeing out of bounds readings when trying to do a 6 point max/min calibration to find the axis offsets. I have the device set up as follows: /* Select the Output data rate, range of accelerometer sensor */
sensor.accel_cfg.odr = BMI160_ACCEL_ODR_200HZ;
sensor.accel_cfg.range = BMI160_ACCEL_RANGE_2G;
sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4; I would expect the max/min value in 2G mode to be around the listing below (+/-) 17039. However, if the unit is bumped or spun too fast when finding the max values for each axis, I get very large, seemingly invalid values greater than +/-22000. Is there a way to cap the values at +/- 2g only or a register that indicates the reading overflowed the G setting? Is there some sort of setup issue I need to fix? 2. Is there any specific setup/bandwidth recommended for an inclinometer application? I am off around 3 degrees at 60 degrees. I would expect using a 3 axis incline calculation with good offset calibration that I should be able to get within 1 degree right? I know for 1 axis, it becomes much less sensitive past 30-45 degrees. Should I be switching the axis as I move past 45 degrees? I thought using the other two axis helped mitigate this issue... xcom = (x_max + x_min) / 2;
xpp = x_max - x_min;
x = ((float)m_axis_data.x - xcom) / ((float)xpp);
ycom = (y_max + y_min) / 2;
ypp = y_max - y_min;
y = ((float)m_axis_data.y - ycom) / ((float)ypp);
zcom = (z_max + z_min) / 2;
zpp = z_max - z_min;
z = ((float)m_axis_data.z - zcom) / ((float)zpp); float x2 = (float)x * (float)x; float y2 = (float)y * (float)y; float z2 = (float)z * (float)z; result = (float)y / sqrtf(x2 + z2); 3. Is there a better calibration I should be doing? It needs to be fairly simple for production.
... View more