Can't get stable compass from NEO-7M on APM 2.8

Hi,

I’m hoping someone can help me - I can’t for the life of me seem to get a reliable compass bearing from my setup. I’ve scoured the google-webs but just can’t find anything that seems to fit.

In mission planner, I find that the bearing doesn’t follow the orientation of the quad. Not only is the bearing wrong, but as I rotate the quad, the bearing sometimes follows the rotation of the quad; other times does something completely different. Also, if I pitch or roll the quad, the bearing quite often changes.

My quad flies very nicely in stabilize mode. GPS locks quickly and accurately; I can even get a quick and accurate lock indoors. But if I activate loiter, my quad starts heading off in some direction; I have to quickly flick it back into stabilize to get it back.

A few questions, before providing some detail about my set up and what I have done:

  • Has anyone had success with the NEO-7M GPS (Chinese from eBay - see link below)?
  • What compass orientation setting should I use in Mission Planner?
  • How consistent should compass calibration offsets be?
  • How careful should I be when calibrating compass to avoid iron? For example, the roof of my house is corrugated iron - does this mean I should not calibrate indoors?
  • Is it possible I need to program / configure the NEO-7M GPS for APM?

I have tried as many different compass orientation settings (ROTATION_xxx) in mission planner as I can, but nothing seems to help - things change, but I don’t get a good result with any setting. I have oriented the NEO-7M GPS with its small arrow silk screened on the top case pointing forward.

I have tried multiple times to calibrate the compass, including unchecking “Use Auto Accept”. This way I can collect 1200+ samples, with reported error 0.01 or 0. I have manually set declination to the correct value for my location. I find that the resulting offsets from calibration vary considerably from one run to the next; values are typically around -70 for the first value, with the second and third values more variable within the range of about +/- 60. I have tried doing it inside and outside, being more or less careful about avoiding sources of iron.

With the external compass connected and correctly configured, I never get bad compass health warnings. The GPS locks quickly and accurately.

If I disconnect the external compass and replace the “internal compass” jumper, I get nearly perfect bearings reported in Mission Planner, except I get bad compass health warnings, which I can’t make go away, even though the internal compass seems to be doing a good job (at least as far as the orientation reported in Mission Planner goes). APM won’t arm if I use the internal compass, thanks to the bad compass health warnings.

My quad is an F450 clone, using the APM2.8 flight controller. I’ve loaded the latest firmware for APM (3.2.1) and have been through the wizard and hardware calibration / config steps. The GPS / compass is presumably Chinese, claiming to be “NEO-7M” “powered by Ublox”. The GPS / compass came in a kit from eBay: http://r.ebay.com/x1vO52. A couple of photos attached. The GPS / compass unit sits on a stanchion above the frame to avoid motor / electrical interference. As previously mentioned, I have removed the internal compass jumper, and have connected the compass lead to the port directly below the GPS port.

Hi, in the last picture, the compass is conneted to the l2c port. It should be plugged under the GPS port. And remove the mag Jumper.[it is still there].
and I think the compass orientation is
ROLL 180

Hi Hari,

Thanks so much for the quick response. Silly me - I did the lazy thing and provided photos from the eBay shop, rather than of my own drone. As you say, that last photo showed the incorrect wiring. In my case, I have connected the compass under the GPS port, removed the jumper and indeed tried ROLL 180.

So back to my questions: does anyone have some direct experience with this GPS / compass and can you provide some answers / suggestions?

I have updated the photos in the original post. Note that I currently have the jumper in the top position, which - according to this image - might be required to configure an external compass. In practice, I have found it makes no difference whether the jumper is present in the top position or not.

Hi,
I had the same setup, now on S500 frame.
I have removed the jumper. and it is working Perfectly.
Calibrate compass once again without the jumper and away from the roof and speaker magnets! Setup Simple Mode on a switch in transmitter and test fly in stabilize mode.

OK - thanks Hari. I have calibrated multiple times and out in the open as well - I just can’t get consistent results. Am starting to suspect the compass is not right. Did you have the same Chinese 7M model?

Thanks,

Nick

Hi Nick,
Yes. The same GPS module.
And can you explain your problem some more?

Thanks - what I am finding is that any of the ROTATION_xxx settings give me inconsistent compass directions. By this I mean that, as I rotate the quad around the 4 points of the compass, the heading display in Mission Planner doesn’t correspond. Sometimes the heading display follows the rotation of the quad, other times it goes in a different direction.

The other thing I’ve noticed is that sometimes the heading display in Mission Planner initially follows the rotation of the quad, but then rotates back to some other bearing quite slowly. I am starting to think that this might be because the gyros cause the initial (quick) rotation, but then the compass conflicts with the gyros, and this ends up “overruling” the gyro based bearing.

I don’t think it is a connectivity / board config problem, since I never get “bad compass health” warnings, so I assume that the APM is receiving good data from the compass.

But I can’t for the life of me figure out how to make it reliable.

I also note that calibration results are inconsistent. Per my earlier note, each time I calibrate, the three offsets can be quite different. I am not too sure what to expect - how sensitive is the whole thing to these values? Do small differences in offsets have little effect on compass accuracy?

Hope that helps.

Hi,
I am not an expert. as per my understanding APM2.8 doesn’t need a jumper for the external compass. Hope you have selected the external compass in Mission Planner and dissabled the internal compass.
A faulty module?
Let us wait for an expert to comment…

Yep - done that. Am wondering about a faulty module. Thanks for your help Hari.

Would be great if anyone who has had experience with symptoms like mine and / or a faulty compass could comment.

Nick

Just for some reading
https://discuss.ardupilot.org/t/external-compass-issues-with-apm-2-6-8/4398

Hi,
I follow a crazy way to solve the problem you are facing. But mine is a M8N. Under the rotation setting, I have tried from beginning to last option that are available in the drop down menu. And check every time if my orientation matches with the compass. At last I found one of them follows the orientation. Though it is time consuming but it worked for me. You can try this method and pls let me know if it works for you.

Thanks Pradeep, Hari,

So I did figure it out in the end. There was nothing wrong with the compass, it was just very difficult to figure out the correct orientation. I had to use ROLL 180 YAW 270, with a bit of twist of the GPS / compass unit before it all came good. Who knows how it was put together, but it does work - I can get a solid loiter and RTL is working just fine.

I learnt two things along the way, which might be helpful to other people:

  • The interaction between compass and gyros is confusing. The gyros respond quickly to rotation of the quad, which will show a short term (and correct looking) rotation in mission planner. If the compass is not oriented correctly, it will conflict with the gyros, and override in the longer term (a second or so later). This can cause a short term rotation in one direction and then back again.

  • It seems to be necessary to reboot the APM when changing compass orientation setting in mission planner. Although - superficially - compass display seems to change in mission planner after changing compass orientation setting, correct behaviour tended not to emerge until an APM reboot. Maybe the gyros / accelerometers need to be recalibrated against the new compass orientation?

In the end, I took the compass / GPS off the quad (to avoid confusing gyro / compass interaction) and messed around with it until I could make sense of its orientation / behaviour. Put it back on, applied the right orientation setting, rebooted and all was good. A little further twist in the compass / GPS was necessary to get it just right.

Anyway, hope that helps others. Seems like these Chinese units have the compass somewhat randomly oriented on the board…

Nick

Hi Nick,
glad to hear you have sorted it out.
Happy flying …

Hi Nick,

Happy to know that your quad is in air.

Happy flying.