Design flaw causes degraded int. magnetometer performanc

The PX4 FMU (auto pilot) board contains a 3 axis magnetometric sensor used as an electronic compass. The PX4 IO board, usually sandwich mounted on the PX4 FMU, has a switching type power regulator that hosts a little ferro-magnetic transformer. Since the regulator (on the IO board) is situated only 15 mm from the magnetometer sensor (on the FMU board) the fields from this transformer/regulator interferes with the sensor. Most likely the board designer did not realize this problem. The workaround would be either to use an external magnetometer or to modify the power regulator (messy).

Still, as far as I know, there are people using the PX4 FMU+IO with the on-board compass. My guess is that the Ardupilot firmware signal processing does its best compensating for the corrupted compass data, but it sure would be better off with clean sensor readings.

This video briefly illustrates the problem and the impact it has on magnetometer output data.
Sorry for the standing format video…


Hi Tom,
I think you may have a significant point, my PX4 has been problematic from the start with compass offset and this makes sense.
Clearly a really good 2nd test would be a 1 or 2 inch connector extender between the PX4FMU and PX4IO.
I think the problem, possibly, was treating the little TI DC DC converter as a monolithic device, which it isn’t.
I will definitely check into this further and give the developers a link to your forum item here.
Best Regards,

Hi Tom,
I have made a post of this on the developer discussion site, I believe you have found something significant.

Hi Gary,

Thank you for noticing my post so promptly and forwarding it to the developers list!
I agree totally with your step 2 proposal (though I don´t have an extender, hope you do…) and the “monolitic” designer thinking. Forgetting the regulator is actually a magnetic field generator :?

Please keep us posted if you get any response from developers.


the 3DR compass/GPS is 5v tolerant, no worries about using it with the PX4. the Pixhawk also has 5V on the I2C and the module has its own power system ensuring 3.3v to the mag.


The output of the compass on the 3DR GPS/Compass module 3.3vdc logic, but not on the 3DR standalone compass which has 5vdc logic output when run on 5vdc. The voltage available on the PX4 I2C connector is 5vdc and the level translator on the standalone compass is hooked to Vin.
TCIII Developer

@TCIII and @proficnc

So if I get this right, you both agree that PX4 and the 3DR GPS+Compass unit works well together, logic levels compatible? Correct?

Yes, you can use the combined GPS+Compass unit on the PX4.

Thanks :sunglasses:

Hi Tom,

Been through a lot with this.

First: as Bill, Phil and Tom said above, yes you can use the combination GPS/Magnetometer module with either the PX4 or Pixhawk and they will work fine due to outputting 3.3 volt signal levels which are compatible with the PX’s.

Second: you should not use the 3DR standalone magnetometer because it outputs 5 volt signal levels.

In addition, your video and my presentation of it have generated a major XXXXstorm of responses which I will attempt to summarize.

You are generally better off using an external magnetometer both to get the sensor away from (some) on board noise and primarily from external DC magnetic fields such as those generated from the batteries, power distribution board and ESC wiring and also from AC fields such as the ESCs, motors and motor wiring.

However, although it is true that your video does illustrate a genuine offset caused by the transformer on the power supply, it is entirely possible it represents a fixed offset and as such, so long as it doesn’t saturate the compass, it is reasonably compensated for with the normal offset setting process.

However if varying power consumption by the PX4 causes that offset to vary then that variance cannot be compensated for and that is something we don’t really know yet (or how severe a problem it might be).

Basically they (Lorenz and Craig) are saying that from current experience, if the PX4 is clear of outside magnetic influences the on-board compass can be used effectively, but they also acknowledge that due to the extreme difficulty of mounting the flight controller free of outside influences as well as the high internal offsets for both the PX4 and Pixhawk an external magnetometer is a superior solution.

As to whether the PX4FMU / PX4IO has a dynamic (and unfixable) offset problem caused by the variable transformers power consumption, the jury is still out as to whether there is one or whether it is significant enough to be a problem in any case. And they are in current use.

In the newer Beta versions of the firmware, the offset numbers that are allowable for the magnetometer have been increased enough to generally allow the PX4 and Pixhawk (which also has high natural offset numbers) to arm and to not fail the checks.

Copter 3.1 firmware will be getting put out for general release within a week or so at which time the normal release code should contain sufficiently high offset numbers to allow the PX4 and Pixhawk to normally pass the magnetometer arming checks too.

Bottom line by all means use the external GPS/magnetometer if you can and keep it as far away from the assorted magnetic influences as possible.

You can move it around the copter while powered up and hooked up by USB and looking at the raw magnetometer output as you were in the video to find the best place with the smallest offset to put it.

I will probably be detailing this on the wiki soon and I will be checking for variable offset caused by varying the load on the power supply / transformer with more to come

Thank you for your input and your video and your input it has resulted in some worthwhile activity.

Best Regards,


Thanks for the update Gary!

Well, I am glad that the issue got “attention” from the developers community :wink:
Looking forward to the outcome of the consequense analysis in progress, as you outlined in your latest posting.
By the way, seems like it is not actually a transformer, rather just an inductance (part of a LC filter), but the mag field issue /sensor saturation (?) remains the same. Anyhow I suppose nobody disputes that the short distance between the switching regulator and the mag sensor is… unfortunate :unamused: ?

As you mentioned, the surrounding mag field is prone to vary with the regulator output current. In some installations the load might be reasonabely stable/ constant. But if anybody would dare to utilize the PX4 IO board 5V outputs for anything that is not constant (e.g. controllable LED illumination, aux servo, camera supply Power…) then I guess the load-, and consequently the offset-variations, would become unacceptably high.

Anyhow, personally I will be using the external Compass+GPS unit - problem solved.
See, even if it turns out that the offset and noise can be reasonably dealt with by the software, I would not feel comfortable to use it in a professional mapping drone, relying on a compass sensor located just 15 mm from a magnetic field generator.

Best / Tom

OK, The facts…
3DR compass, stand alone mag_hmc5883l_v11 pcb…
there is a jumper to select the 3.3 and 5v, and a level shifter to cope with 5v. all good, see attachment.
on the combined module…
you can see that all is well as well… :slight_smile:

both can work at 5v.

I think the problem is that for PX4 and Pixhawk you can’t jumper the external mag to 3.3 volt, because the PXs provide 5 volt power on the I2C potrt even though they need 3.3 volts in.