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.
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)
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.
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. ^_^