I am coding a MPU-6050 accelerometer/gyro to provide me with the accelerations and rotational velocities. Now the code works as far as to provide me with all accelerations and angular velocities.
But the results are giving me marginally weird results. If I point the accelerometer that the positive z-axis points up I get marginally lower than expected readings FOR my altitude (should be around 9.7 but I get around 8.9). Now if i turn the accelerometer so that the positive z-axis I get larger than expected readings (I get over 10.1). The same is for all the other axis if I point them along gravity.
The low readings didnt alarm me at first because I thought the accelerometer is not placed perfectly straight. But the higher than expected readings are definitely alarming.
This means that the accelerometer neutral point seems somehow wrong (it under reads on the one side and over reads on the other). Do I need to calibrate the accelerometer? This seems nearly impossibly wince one will never get the accelerometer perfectly straight.
Please advise. Do you want to see my code?
After many many hours of research and fiddling I found out that nearly all electronic sensors have a bias. (bias is an offset)
Now even the accelerometers apparently have serious offsets. So what I ended up doing is building a small test stand that was balanced by four screws. By running an active while loop, and outputting live data from the accelerometer I was able to nearly zero the "other two" axis that were not pointing along gravity all the while gathering data. Once level, I ran the program for several minutes, averaged the results and thus found the bias. I did this 4/5 times per axis and found that the remaining error was due to noise and not recoverable. I had to obviously do this for all 3 axis.
Additionally I found that after I zeros the bias the readings were too high. I am not sure if what I did here was correct but it seemed the logical way to progress. Once all axis all the 3 axis were calibrated, they gave me different gravity readings respectively. All I did then was to add a correction factor to get the gravity reading I expect to get at my altitude. These correction factors were very small (eg 0.966.....) but in my opinion still significant.
Hope this helps anyone who was lost as I was