Drift with MPU9250

Hi everybody,
I'm trying to build a quadcopter with arduino and the MPU9250. I've been using this library : GitHub - hideakitai/MPU9250: Arduino library for MPU9250 Nine-Axis (Gyro + Accelerometer + Compass) MEMS MotionTracking™ Device but I've tried also with Kris Winer's library ending up with the same problem.
Basically, I read correct data as long as the quadcopter is still, when I turn on even just 1 motor the Roll measurement starts to drift and becomes very noisy, you can see the difference between the images for motor_off and motor_on.
I report below also my calibration phase.. I've already tried to change the cutoff frequency of the LPF and samples rate without any luck.
Has anyone experienced the same problem? Who hasn't can anyway give me some advice?

/////////////////////////////////////////////////////////////

I2C clock speed is correctly set to 400kHz.
Accel Gyro calibration will start in 5sec.
Please leave the device still on the flat plane.
Mag calibration will start in 5sec.
Please Wave device in a figure eight until done.
Mag Factory Calibration Values:
X-Axis sensitivity offset value 1.18
Y-Axis sensitivity offset value 1.18
Z-Axis sensitivity offset value 1.13
Mag Calibration: Wave device in a figure eight until done!
mag x min/max:
297
107
mag y min/max:
-5
-184
mag z min/max:
7
-310
Mag Calibration done!
AK8963 mag biases (mG)
356.12, -165.72, -256.48
AK8963 mag scale (mG)
1.20, 1.28, 0.72

Its important to isolate the sensor from vibration and electronic noise - the drift performance of the sensors goes down rapidly with physical vibration. I suggest a soft visco-elastic mounting pad or similar if this could be an issue with your design.
Shielding can reduce electronic noise ingress, but basically keep the sensor well away from all high current wiring.

Thanks for your quick reply Mark, do you think it might be only a design problem? I've already tried to put some rubber (probably rubber it's not the proper translation) under each motor and the IMU, the situation got a tiny better but still not solved.
I'll try for sure to better damp the vibrations

Re drift (vibration is a separate issue):

Kris Winer's library has a fundamental error, and doesn't work at all with the MPU-9250.

None of the libraries will work unless the magnetometer and gyro are properly calibrated, with at least an offset and scale for each axis.

The "figure eight method" is not good enough. See this comprehensive tutorial for the best approach.

You need to isolate the sensor from vibrations really - motors have to be strongly mounted so they don't pull off the frame, sensors do not and can therefore be much more cushioned.

Actually I don't know whether the problem is related to drift or vibrations or a combination of the two.. I can say that with motors off the measurements are stable and look correct. With motors on it starts to give bad data

Motors and motor wiring have to positioned as far as possible from the magnetometer, as the associated magnetic fields can completely invalidate the measurement.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.