SparkFun BasicAHRS_I2C giving unstable readings.
I am using the SparkFun Arduino Sketch from here.
It is giving me these results:
X-acceleration: 91.43 mg Y-acceleration: 249.51 mg Z-acceleration: 1042.05 mg
X-gyro rate: -0.549 degrees/sec Y-gyro rate: 0.557 degrees/sec Z-gyro rate: 1.595 degrees/sec
X-mag field: -164.35 mG Y-mag field: -240.16 mG Z-mag field: -20.73 mG
Temperature is 27.9 degrees C
and then the next result (when MPU9250 is still) is:
X-acceleration: 91.49 mg Y-acceleration: 252.75 mg Z-acceleration: 1039.49 mg
X-gyro rate: -0.076 degrees/sec Y-gyro rate: -0.130 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: -175.07 mG Y-mag field: -222.24 mG Z-mag field: -27.64 mG
Temperature is 27.9 degrees C
Notice how the temperature has remained constant, acceleration has remained constant (although im not why there is a reading if the MPU9250 is stationary) and the mag field is fairly close. However, the Gyro values are not close.
Could I have a bad MPU9250?
I am using the Mega.
Edit: Added a complementary filter from here, however they have not added a comp filter for the z value as can be seen from my screenshot of the serial monitor:
I think this is because they have the MPU6050 and not the MPU9250. I believe the MPU9250 has the magnetometer which can be used to 'help' the drift?
How could I use the magnetometer to help counter the drift?
End goal: rotate a gameobject in unity with the MPU9250 with minimal drift and maximum accuracy.