The magnetometer on my drone is measuring an inconsistent norm of the magnetic field. I’ve tried placing the magnetometer in several locations, sometimes near metal parts and wires that have current flowing, and sometimes 3+ inches away from any of those components, and regardless of that, the norm of the magnetic field is inconsistent (where the magnetometer is visible in the image is roughly the furthest I tested it from all of those kinds of components). By inconsistent, I mean fluctuation by roughly ±0.3. It is only inconsistent if I move/rotate the magnetometer, either independent of the rest of the frame or with the frame. If the magnetometer moves/rotates, it measures a different norm. When I don’t move/rotate the magnetometer, it measures a consistent magnetic field.
I’ve confirmed that the GPS unit (with magnetometer) wiring is correct. I’ve tried powering the full system by the LiPo battery, including the Raspberry Pi 5 companion computer with the AI hat, and I’ve tried powering only the flight controller (Kakute H7) with a USB cable from my PC, and in both scenarios, I measured the same performance.
I’m suspicious that the metal case around the Raspberry Pi 5 may be causing magnetic interference, but it is supposed to be aluminum, which isn’t magnetic. Since I’ve placed it 3+ inches away from any critical component, I almost think it might be a software problem. I didn’t recalibrate the magnetometer every time I placed it in a new location, but I have calibrated it. It was just several inches away from every testing location. I also bought a second GPS and magnetometer unit, and it got the same results.
Any help would be appreciated, and please let me know if any more information is needed.
Here are a few logs with varied positions of the magnetometer. I have tested it many more times, but these are characteristic of the full set. Note that at the times when the norm is consistent, that means I’m holding it still, and when it’s inconsistent, that means I’m moving it. Also, there is other data that is invalid, but I believe the magnetometer is the root cause of those problems.
https://logs.px4.io/plot_app?log=33b0b64b-f02a-4804-ac5b-7585c9d767c8 (closest log I’ve had to a valid one)
Image of my drone:
