How to simple calibrate compass in ardupilot like DJI Drone?

I use firmware version (Arducopter) 4.0.4. Now I have to calibrate all 6 axes of the compass every time.
How to simple calibrate compass in ardupilot like DJI Drone (use only 2 axis for calibration).

look like this video

You only need to do the compass calibration once with Ardupilot. Even if you move to a new site compass calibration should not be needed unless you’ve made major physical changes to layout and magentic field producing items like power wiring.

If your aircraft is asking for compass calibration repeatedly then something is wrong.

Let us know more specifics if you need help - frame, flight controller, GPS brand/model, battery type, errors, a link to a .bin log file.
It might be an idea to enable logging disarmed ->set LOG_DISARMED,1 and reboot.
Wait for problems to be captured in logs, get the .bin log file and host it somewhere like Dropbox and post a link to it here.
Disable LOG_DISARMED,0 afterwards.

2 Likes

Thank you for your prompt reply.
But I just want a 2 axis compass calibrate like a DJI. Can I set it in the parameters? Or do I need to modify the firmware?

Thank you.

That would be a major firmware modification. Unlike our perception of a traditional compass being essentially a 2D device just pointing north, the solid state compasses used in electronics are a 3D device measuring the magnetic field lines as they pass through the device in every direction.
I’m not sure what assumptions DJI are making in their calibration procedure, maybe you could find an old compass chip somewhere that only needs 2D calibration but they’ve long been discontinued (as far as I know) and it’d still be a firmware mod or at least a new compass driver.

EDIT: and of course we only need to do this compass calibration once, so it shouldn’t be a big issue. Go outside away from everything, wait for a GPS 3D fix and then do the compass cal procedure. Any issue you experience after that can be solved and lots of people here can help.

2 Likes

Thank you so much. :slight_smile: :slight_smile: :slight_smile:

Hey, even im looking into only 2 axis calibration for my drone. Can you please share if you got any solution for it ??

2 axis calibration??? The magnetometers are a 3D device, it’s not like an old fashioned hand-held compass.
You only need to do the compass calibration once if that’s what you are worried about - you can move to new locations and never need to calibrate the compass again (unless you make physical changes)

1 Like

Thank you so much for your response!

Can we set an external magnetometer as the primary compass (by configuring COMPASS_PRIO1 = 1 and COMPASS_EXTERNAL = 1), disable the noisy internal compass (via COMPASS_USE), and enable auto-calibration features such as GPS_YAW_OFFSET, COMPASS_LEARN = 2 (automatic learning), and COMPASS_AUTO_ROT (auto rotation detection), to achieve reliable 2D-only calibration and yaw stability over time?
Or could these settings still result in risks such as magnetic drift, heading misalignments, GPS dependency failures, or even critical flight issues like loss of control or drone crash during missions, especially in outdoor and farming field conditions?

Yes, you should.

Those settings are OK. The real question is: How good all your other settings?

Are you specifically referring to factors like magnetic noise, GPS quality, vibration isolation, EKF tuning, GPS mounting, auto-tuning, failsafe setup, battery EMI, and temperature drift?

If so, besides configuring COMPASS settings properly, what additional solutions or precautions would you personally recommend to ensure reliable yaw stability and prevent critical failures in real outdoor field operations?

Use ArduPilot methodic configurator software and read the entire ArduCopter tuning guide from top to bottom.

2 Likes

Sure .Thank you so much !!

I have a concern regarding compass calibration on my drone. Currently, my drone requires a compass calibration each time I move to a new location in order to achieve a stable flight. However, I understand that magnetometers are 3D devices and, ideally, should not require frequent recalibration unless there are physical changes to the system.

Could you please guide me on how to achieve a reliable, one-time compass calibration that remains effective even when operating in different geographical locations? I want to ensure consistent performance and flight stability without needing to recalibrate every time I change flying spots.
@xfacta

One of the common things that affects compass calibration is LiIon batteries and their precise position and orientation. If you have LiIon batteries then you should have some system in place so the pack is always positioned the same for every flight.
If the main battery wires are too close to the compass, there may be nothing to be done except reposition the compass. Wiring should all be secured.

Just provide a .bin log and we can use magfit to see what’s going on.

1 Like

Hey
If I follow the method of isolating an external compass or sensor on a mast or boom (10–15 cm above the drone frame), disable the internal compass, and calibrate just the external compass by moving it independently (not the entire heavy drone), and then either:

use COMPASS_LEARN = 2 for in-flight auto-calibration,
or
manually calculate compass offsets by fitting a sphere to raw MAG data and setting `COMPASS_OFS_ parameters directly in firmware..

→ will this approach reliably provide accurate yaw, heading, and compass stability in heavy drones over time, especially in field conditions?

Also, if anyone has actually done this successfully, could you please:

  • Share your method (step-by-step) or
  • Mention any tools/scripts used (e.g., MAGFit, Python, MATLAB) or
  • Provide links to sources, videos, or log analysis examples showing this works in practice
    please ?

Yes.
If you can get the compass calibrated enough to fly, then do some ascents/descents, circles, straights and a figure 8 if you can - a variety of flight. Try the large vehicle mag cal.
Use AltHold mode for safety, it’s possible Loiter might have issues if the compass is not great.

Then we can do a complete offline calibration in MagFit that can be left in place.

ArduPilot MAGFit

3 Likes

Oh, by the way - you need to move the compass with the flight controller and all.
The GPS should have a good 3D fix.

I pulled that doco link from Rover, but it’s the same for Copter.

1 Like