I'm using this Arduino code to calibrate and read from an MPU6050 accel/gyro sensor from an Arduino Mega.
The calibration and reading of values seemed to go well. However, I'm seeing some inconsistent values reported from the gyroscope. When my apparatus is placed flat, it correctly read a pitch of 0 degrees. When I tilt it forward by 90 degrees, it reads a fairly accurate -89.6 degrees. However, when I tilt it backward at -90 degrees...it reads -26 degrees.
Why is this? Could this be caused by mis-calibration, interference, or is it possible my MPU6050 is damaged or defective?
The default orientation of the board is with it flat, so the z-axis points "up". However, I've mounted the sensor with the y-axis pointing "up" and the z-axis points forward/backward. Would this effect calibration? Other than having to remap, my axis when reading data (which I'm doing), I haven't read any warnings about needing to explicitly enter this re-orientation into the MPU6050 code.