07-19-2019 04:14 PM
I want to ask that why am I getting wrong accelerometer values. I am calculation roll using the formula atan2(z,x) and getting degrees with minor error when sensor is in 3g configeration. When I configure it to 12g then the sensor gives wrong values from 0 degree to 5 degree because it gives values of x-axis in negative. When in 3g configeration, the sensor goes like this: 0, 1, 2, 1, 3, 2, 4, 3, 5...... The sensor drops a degree and then increment the angle. There is error in these values because accelerometer is not giving correct values.
Any suggestion for my problem?
Solved! Go to Solution.
07-24-2019 04:07 AM
There are some suggestions ,hope it will be helpful to solve your problem:
1.Sensitivity under 3g range and 12g range are different. Resolution for roll angle measurement are different.
2.Suggest calibrate the accelerometer under 3g and 12g mode. Remove the offset from measurement values.
3.Test again , please provide data log (accelerometer X, Y, Z)
07-24-2019 07:04 AM
Thanks for replying. When I am rotating the sensor in potive x-axis direction, then the values of accelerometer should also increase. But instead of continously increasing, the values increases as well as decreases. You can see the datalog attached. In the data log, first three columns are of accelerometer x, y and z respectively. And 8th column is of "Roll" in degrees. These are the rotation from 0 to 8 degree approximately.
07-25-2019 11:35 AM
Is this a duplicate issue from this one ? If yes, could you please marked the thread as "solved" ?
07-25-2019 02:19 PM - edited 07-25-2019 02:22 PM
Yes. Thanks a lot. Found problem in the conversion of the data from the sensor. Was using signed short int, which was causing the problem. I changed it to signed int and it solved my problem. Thanks for the help. ^_^