Interpreting EMI

I have been basing my log readings from PX4s log review page:
https://docs.px4.io/en/log/flight_review.html

I have had a few issues, only in the logs stating the craft may have some EMI.

By looking at the Norm of Electric Field vs. Thrust graph, it seems that the electric field is following the thrust curve, and according to PX4s page, this is an EMI issue.

The craft flies great, not twisting about the Yaw-axis, and seems very solid. Does anyone else have any input or ideas? I am, of course, really only worried about random fly aways. I calibrate the compass every time I go to a new area.

https://logs.px4.io/plot_app?log=ee056203-b947-479d-9993-25e98d9babe6

Hi,

Yes, try to

  1. move your compass as far away as possible from the power cables
  2. Twist your power cables

The influence of magnetic interference depends on many things, but one major is the earth magnetic field at your location. If you were to go to a place where the earth magnetic field is e.g. half the strength compared to where you are you might run into more severe problems

This is not needed since the calibration is for sensor offsets and scale factors which does not change if you switch geographical location (As long as you don’t have a very large temperature difference)

@CarlOlsson Thank you for your reply. I have relocated my GPS via taller mast, but did not seem to help the issue. I also do twist all power wires while building each craft as well.

You do mention that calibration adjusts scale factors. Does this not change with an increasing/decreasing electromagnetic field? (I am not at all trying to prove you wrong, rather grasp a better understanding) If there are any good reads you could suggest to me, I would be delighted.

As you can imagine there are tons of articles online regarding this very issue, but it is interesting you mention I should not have to re calibrate after transporting the craft. Since I do have to re calibrate at different sites (normally anything over 30 miles) do you think getting rid of this magnetic field following would decrease the amount of calibrations needed?

Also, just wondering from your experience, but I have noticed a great deal of EMI comes from power wires, ESCs, Power converters, and motors. From your personal experience which of these would cause the most EMI from least to most?

When you do the magnetometer calibration you rotate the vehicle to learn the scale factors and offsets of the individual sensor axes. So this is independent of the location.
However, for the absolute value of the earth magnetic field I am a bit unsure how PX4 handles it (the company I work for have developed an alternative magnetometer calibration that also calibrates the norm)
But anyway, for navigation the EKF will use the magnetometer measurements to initialize the earth magnetic field states so the norm doesn’t matter, only the direction.
(There is a check that the norm is not way too far off just to prevent the field states from collapsing but that should work even if the norm is not very well calibrated)

What do you mean with that you do have to re calibrate? Do you get an error message or worse flight performance?

In my experience the power wires are the main cause of magnetic interference, but I guess it really depends on the specific components and where they are placed on the vehicle. Some use coaxial power wires just for this reason.
Power converters on the other hand can create a lot of electromagnet noise influencing the GPS signal quality to a great extent.

@CarlOlsson

I did end up fixing the “following” issue, finally, due to some noisy components.

My reason for re calibrating at these sites further than 30 miles is due to “toilet bowling”. I can run 4-5 batteries through it no problem, but if I drive an extended distance the drone may or may not toilet bowl, so I recalibrate for safe measures. Im hoping now that I have completely eliminated the EMI this will hopefully reduce calibrations.

Also, if you can answer this: Do you guys not normally have to calibrate after hauling your drones?

No, we ship drones all over the world and a need for redoing magnetometer calibration is very rare

@CarlOlsson

I have finally addressed the “following” issue, but now I have some large, but random spikes in my logs now. I cant find any good reads on this issue, and was hoping you wouldn’t mind taking a look at this. These spikes seem very large but do not seem to have any relation to the thrust. Do you think this is an issue from your experience?

https://logs.px4.io/plot_app?log=065d5f48-c0b8-442c-a554-3ab20c2e9676

https://logs.px4.io/plot_app?log=432e630b-64e3-4f09-ae00-68e354a65fca

That looks strange. The spikes seems to only be present in the vehicle_magnetometer topic and not in the raw magnetometer measurements, at least it looks like that in the logfile, I don’t know why that would be the case.
In one of the logfiles some spikes are visible in the estimator innovations which are not rejected. So yes, this seems to be a real issue.

@CarlOlsson

I actually just found the solution minutes ago. The flight controller was too close to the GPS. Moving it 3.5cm away seemed to do the trick!

Okey, great to hear!

@CarlOlsson

I thought I had the problem fixed, but 4 of the 4 builds I have completed in the past week still has these spikes, although no thrust following. Do you or any of your colleagues have any suggestions on this issue? Have any of you come across this before? I have tried the previous 1.8.2 as well as the 1.9.1 px4 firmware as well but no luck eliminating it. It seems this has just started happening a couple weeks ago, shortly after “fixing” the EMI problem. I have my flight controller separated about 7cm from my power circuit and the GPS is about 3cm above the flight controller and 2cm to the right. Not sure if any of this matters, but trying to give adequate information. Thanks!

Also, do you all calibrate your drones with the battery plugged in during calibration?

I’ve seen the mag spikes. For the mpu9250 atleast (you’re using the LSM303D on the Pixhawk 1), there is a very strong correlation with heading and erroneous spikes. I actually found that while perfectly aligned (or passing through) at 0 and 255 (raw from the sensor), this is when the spikes would appear.

This feels like an arithmetic overflow in the IC, but I have no way to prove that. Anyways, you should test this and see if you see correlation between a certain angle and lots of spikes.

@dakejahl

I am using a Pixhawk 2.1 with a Here+ GPS. Are you suggesting I try to orient the controller and specify the offsets in the parameters in order to test?

I am suggesting you watch the mag data and slowly rotate the pixhawk. You should try to determine if there is any correlation with heading and mag spikes. I suspect that you will find that a certain heading is the culprit (based on your logs, looks like it’s at -150 degrees)

Assuming the problem happens at -150deg what do you think the suggested action for fixing it would be?

I have no idea, I never made it further than this. I found the issue was correlated with heading and accepted it. It shouldn’t really matter, I only saw slight yaw instability while getting lots of those erroneous spikes.

Please test this and let me know what you find! I am super curious, as I asked about this in the community a while ago and no one else seemed to notice/have the issue.

how close is your GPS from your flight controller? Mine is 4cm to the right and 9cm above (measuring from center of FC to middle of GPS) also my PDB is centered below the FC about 7.5cm apart. Im wondering if this is a correlation.

Only way to have correlation is with data. So… this is up to you to do some investigative work :slight_smile:

Sounds good. I will test this when the weather permits for me here and I will get back to you when I do!