Nightmare compass calibration - Solved

I’m facing big problems of compass calibration with two Pixhawk boards from Mrobotics and 3.4.5 firmware.
Compass are two M8N Gps with integrated compass (HMC5983) from Drotek and two stand alone HMC5983 external compass.

  1. One of the M8N DRotek gps that worked properly on a original Pixhawk always give high Z offset, over 560 .

  2. The other M8N Drotek Gps

    • even if it is aligned with the Pixhawk , the heading red line in Mission Planner is less or more 90° rotated
    • The red heading line continues slowly to rotate over 360° even if the drone is steady
    • With 3.4.5 the internal compass disappear when I2C connector from the Gps Mag is connected, with 3.3.3 both are present.
  3. Using the I2C splitter seems to make things even worst .

I did everything I could to obtain a proper compass calibration , upload again the firmware, compass are far from esc , iron , power lines .
I2C wires are short, far from power lines , I use outdoor calibration with USB connection since it gets samples faster.

With 3.4.5 and “auto complete” option sometimes the calibration is successfull even if just one axis is rotated.

Guys , a real nightmare , that cost me hours and hours of work and failure as the only final result.

I just use dennis baldwin method for compass calibration at 6.30 of this video

Look the video carefully
It works always for me

1 Like

Did that way and other many time.

In fact the calibration can be successfull but then I got wrong heading , even 80° and a lot of error messages related to compass like “EKF2 IMU1 ground mag anomaly, Yaw realigned”

Where is your power board?

Does under or next to pixhawk pass any power cables?

Power cables could make the imu go crazy

Power board, from Airbotix, is under the Pixhawk and as cables path never gave any problems in previous drones.

I found out that the two Mrobotics Pixhawk boards have a problem with I2C bus .

I have install a Zubax CAN BUS Gps with compass and baro onboard and all the problems disappear .

So it is obvious to me that the reason is that the compass is not anymore on I2C bus.

@lucamax, Have you talked to Mrobotics about the bad I2C bus? I would be curious to hear what they have to say.


I wrote to Jordi but he did not answer.

I tried to add some pull up resistor on the I2C bus with 3,4K but things get worst , without an osciloscope here where I am is pretty impossible to check the I2C bus.

Interesting. Do you have anything unique about your compass setup on the I2C bus (ie long wires, routed close to power bricks, etc)? I am surprised that the MRobotics Pixhawks have issues

Jordi answer and ask me to send back the boards to check them.

Nothing unique, I also tried to mount an external compass with very short cables , 3 cm , but did not help, and since the CAN bus Gps & compass mount in the same location is perfect the problem is on the I2C bus .

On both Mrobotics Pixhawk , with 4 different I2C compass, the heading is wrong , with an error about 80 - 100°, when the copter is stil the heading is changing all over 360° slowly , like a clock hand.
In flight, EKF tries to correct the heading and generate all sort of EKF and Compass message errors.

The good thing is that I never lost control of the copter , flew mostly in stabilize and althold modes but also when compass was allowing it Loiter mode never got toilet bow effect I guess because I always had very good Gps fix , 10 - 16 satellites with 0,4 - 0,8 Hdop.
EKF seems to work properly now on 3.4.5 .