Using magnets in a vehicle with a pixhawk


I’ve been using the pixhawk on a plane for over 2 years now. Back when I first started, my aircraft had a couple of tiny magnets which were used to secure the canopy. If I recall correctly, the magnets were about 15cm away from the pixhawk. This was a time when I was still learning and hence had several crashes for various reasons. One peculiar behaviour I remember from back then was the plane ‘toilet-bowl’-ing like some RC helis and quads. :confused:

This occurred occasionally and was relatively infrequent - about once in over 20 flights. I tried to figure out what the problem was and had no luck. I guessed that it would be an issue with the compass interfering with the magnets. I removed the magnets and did several other changes to the aircraft, I haven’t faced the issue since. Although I’m still not sure if it was the magnets that caused the problem, I haven’t used a single magnet in my aircraft since (better not risk it! :sweat_smile:).

I suppose some of you use magnets in your aircraft. Have you had any such experiences? where are the magnets placed in your aircraft? Am I being paranoid with the magnets? Is the pixhawk shielded from magnetic fields?

I would love to know the thoughts of the community on this.


The reason you do a compass calibration is to account for magnetic interference in the build of the craft.

So as long as the magnets do not interfere to strongly you should be fine. This happens when the calibration numbers become to large.


We are using magnetic clasping on both the nose and tail of our aircraft. We did have to re-position our GPS/compass further away from the nose to get the compensation numbers to be reasonable, but I haven’t seen any issues in flight. Since the magnets are a fixed disturbance to the local magnetic field, they are pretty easy to compensate for.

Nice to know!

So, in essence, I can use the compass calibration numbers to determine if the magnets are interfering strongly? That’d be a useful way of determining the interference

Can I make an assumption and say, if you remove the magnets, you will have to recalibrate the compass?

Correct! Likewise, it’s important that you are doing your calibration with all your magnets in place. For instance, if you are holding a hatch down with magnets, you need to have the hatch installed when you do your calibration because having both the magnets attached to each other will dramatically change the local magnetic field the compass calibration is trying to compensate for.

That is what I figured. Any recommendation as far as minimum distance from the magnets?

That will depend on the strength of your magnets. Let your compass calibration be your guide; if the compensation numbers are red, you’re too close to the magnets. Yellow is better, but green is best. I can tell you that 2" was way too close on our setup, but it’s working well at 8" away.