I'm using the following Python Code with the SparkFun IMU Breakout MPU-9250 SiP.
I'm calibrating the sensors before any movement begins. The Accelerometer and Gyroscope readings appear to be fine, however the readings I am getting from the Magnetometer are showing a wide range of values.
I have the MPU-9250 mounted with two motors/wheels in a robot on a raised platform (so it doesn't move during testing). I first calibrate the Magnetometer which reads near zero values. Upon starting and stopping the motors (again no real movement), the Magnetometer values swing pretty wildly (-10 + 20). What is really strange is when the motors are stopped, the Magnetometer values never goes back to near zero but it keeps these high values, again the bot never moves during this test.
I also isolated the 3.3v power to a clean source to make sure noise was not a factor at least in the power line.
I suspect this is either a problem with the calibration function, or the physical layout / circuit/device. Any thoughts on this are appreciated.
Raspberry Pi Zero W
MPU-9250 using I2C communication
3.3v source (also tried 3.5v & 3.7v)