Disabling internal compasses to arm the drone

Hi everyone,

I am using pixhawk 3 pro with an external GPS running on PX4 firmware.

I am facing mag sensor inconsistency even after calibrating the pixhawk multiple times. Hence I decided to disable the internal compasses so that I could arm the drone.

Based on this post(PixRacer - 3 compasses (external, 2x internal)?), my understanding is that Mag0 is the external compass by default. Hence I re-installed the firmware. Enabled the Mag0 with ‘No Rotation’ and also set it as the Primary magnetometer. Mag1,Mag2 and Mag3 were disabled by setting the parameter CAL_MAGx_EN as DISABLED, where x is 1,2 or 3.

This yielded a working set-up where I could arm the drone and the compass was pointing in the right direction. However, the next time, I switch on the pixhawk, I now find that there has been an automatic switch. Mag0 is set to Internal Mag which is ENABLED. Mag1 is set as NO ROTATION which is disabled and the compass direction in the flight mode display is wrong. Also Mag2 and Mag does not even have a CAL_MAGx_EN parameter to disable it. The Primary Mag is still set to Mag0. So I do the correction of setting the Mag0 back to external(NO ROTATION) and Mag1 to Internal Mag.

The airframe I am using is Traxxas Stampede vxl 2wd. Even though I am able to arm the drone, due to this compass issue, the direction of the compass shown in the map is wrong and it results in the wrong direction of motion while we try navigating from one waypoint to another.

This issue has happened multiple times. I am not sure what is causing this. I would really appreciate if someone could point out what I am doing wrong and how this issue can be resolved.

Please find attached the pic of the parameter set of the mags.


1 Like

What type of external gps are you using?
How is it mounted in regards to the pixhawk unit?
Have you tried your tests outdoors?
What firmware version you are using?

I have had many issues with pixhawk 3 pro magnetometer myself - that’s why all the questions. I know for fact your procedure would work with a pixhawk 4.

1 Like

Hi @cooldude,

Thank you for your reply.

Reg your questions:

  1. I am using Sirius RTK GPS (Ublox NEO-M8N + LIS3MDL Magnetometer)

  2. The pixhawk is kept in a box and the external gps is mounted on a gps mount outside the box at small height from the box(based on length limit of the gps wire).

  3. Yes. The testing was done outdoors but this flipping still happens.

  4. I am using PX4 firmware version 1.8.0.

What do you think could be causing this issue?


Hi everyone,

I have a suspicion that it is related to the device ID of the external/internal compasses.

Is there a way to see the device ID of the external and internal compasses other than in the parameters section?


1 Like

I agree with you - must be a device Id issue. I personally don’t know of any way to view those besides parameters. Have you tried enabling only one of the compasses at a time - just to make sure you can at least get just one working. Maybe try a different gps-compass module, just to make sure there are no issues with the actual pixhawk board…

One more thing, pixhawk 3 pro has an internal lis3mdl compass so I think it may be conflicting with your external one…

1 Like

Hello, As you mentioned about Traxxas rover frame, can you use the rover airframe with firmware version 1.8.0 ? i ask because i can not get any PWM output from pixhawk to control throttle and steering when armed. Did you face this problem?
Do you try to adjust EKF magnetometer param? I think it could help you deal with mag inconsistent.

Hi @saengphet,

Great to see your reply. Actually, the problem you mentioned, I had faced in ardupilot(rover airframe). I am suspecting the configuration of rover airframe might be somehow different from normal. I haven’t tried rover airframe in px4. I will try and get back to you soon.

Could you specify which parameter correspond to EKF magnetometer? I am not sure I understand the parameter to be adjusted and by how much.


Hi again !!

  1. For rover airframe in px4, I uploaded firmware version 1.6.5 with QGC version 3.2.1, everything work perfectly !!

  2. EKF params are quite complicated, Try to slightly increase “COM_ARM_MAG”, the default value is 0.15 Gauss -> change to 0.17 -> 0.19 and so on. However, if you increase this param too much, it means something wrong with your mag sensor or try to better calibration, at least 360 degree turn 2 times per axis. I use the same hardware as yours.

  3. board and GPS placement, please ensure that these are installed far enough from magnetic interference or other magnetic sources such as high voltage servo, motor.

  4. In my case, External compass is MAG2, so if you want to disable internal compass, change “CAL_MAG0_EN = Disabled” and “CAL_MAG1_EN = Disabled”

Hi @saengphet,

Thank you very much for the reply. I will try changing the COM_ARM_MAG limits then. Most often, I have the correct heading now after few calibrations. But midway during navigation, the compass flips sometimes and gets confused about the heading.

Also I get a accel read error sometimes. Then I switch off and then switch on the pixhawk again which temporarily resolves the issue. Do you/does anyone know a permanent fix for this as this has happened a couple of times?


Do you think this problem come from hardware? Do you have another board to test? Becuase I never found this problem on my pixhawk 3 pro with RTK GPS.

Hi @saengphet,

Thanks for your insight.

I have a suspicion that the power source(battery) might be causing interference more than I expected. Is there a particular way to shield the compass(internal) from the power source? Especially when you are looking for a compact system?

Try twisting the power wires. That helps to cancel out any magnetic field it generates. You can also try wrapping it with copper tape (same as what they use in electric guitars).

Good luck.,

hi pixhawk can you send the file px4_fmu-v4pro_default.px4 of px4 1.6.5 version.

hi saengphet, pixhawk can you send the file px4_fmu-v4pro_default.px4 of px4 1.6.5 version.