darkdave

  • ***
  • 152
UBLOX NEO M8N GPS and Compass
« on: May 03, 2016, 10:58:54 pm »
In China they sell this GPS + Compass as part of a Revolution package including the FC and the oplink. I cant find much information in English about this GPS + Compass combo and how suitable it is for Revolution and how to install it with Libre/Revolution.

UBLOX NEO M8N GPS
https://item.taobao.com/item.htm?spm=a230r.1.14.16.zih8XT&id=520965327986&ns=1&abbucket=9#detail

Would appreciate any feed back in relation to:

1. Hardware guide for this device
2. Installation guide for libre with this GPS+Compass 2 in one device (I got the GPS working but not the compass) , especially on the compass side of things.
3. Comments on suitability this device is for working with libre/revo



hwh

  • *
  • 1018
Re: UBLOX NEO M8N GPS and Compass
« Reply #1 on: May 03, 2016, 11:12:30 pm »
I can't see on the picture if it has one connector or two.   If it has two then
https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+setup
and
https://librepilot.atlassian.net/wiki/display/LPDOC/Aux+Mag+Setup+and+Calibration
talk about using external I2C compass modules.

If it only has one connector you'd have to take it apart and see if it has a mag chip in it and solder wires on to get it working.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: UBLOX NEO M8N GPS and Compass
« Reply #2 on: May 03, 2016, 11:15:17 pm »
Like Hank says, this GPS should have compass inside but not the two I2c wires connected to the compass sensor.

There is a couple of users that have Mag issues with this model.
Maybe all Mag that do not pass QC will be available without  i2c wires.

You should use the next branch to allow the I2C mag setup, see this thread.
https://forum.librepilot.org/index.php?topic=1110.0

Another good candidate for GPS/i2c mag is this one:
http://www.goodluckbuy.com/ublox-neo-m8n-flight-controller-gps-with-protective-shell-for-pix-px4-pixhawk.html

You may need some jst connectors and do some soldering.

Mateusz

  • *
  • 808
Re: UBLOX NEO M8N GPS and Compass
« Reply #3 on: May 03, 2016, 11:16:21 pm »
On the picture it seems only 4 wires are provided (TX,RX,VCC,GND). This is only GPS signal.
Magnetometer is not broken out, and you would need to add cable yourself and connector. I have the same unit, but I am not using it, was getting spikes with it, not sure if it was hardware quality issue or other reason. Mine though had extra two I2C cables (SDA, SCL) from magnetometer. It was for PixHawk so I had to change connectors to JST-SH 1.0 4pin.
GPS is Neo 8M so it is capable of searching for both GLONAS and GPS at the same time. Magnetometer on it is probably H5883L (was on mine), and that works with Revolution.
However, released LibrePilot supports only external (AuxMag) on OP GPS units. If you want external mag on other GPS units, then you need to use development branch "next" and compile it yourself.

I am happy with the one f5soh linked
http://www.goodluckbuy.com/ublox-neo-m8n-flight-controller-gps-with-protective-shell-for-pix-px4-pixhawk.html
but of course had to change connectors.

darkdave

  • ***
  • 152
Re: UBLOX NEO M8N GPS and Compass
« Reply #4 on: May 04, 2016, 10:14:23 pm »
Can you tell from these pictures where I'm supposed to solder those extra wires?

hwh

  • *
  • 1018
Re: UBLOX NEO M8N GPS and Compass
« Reply #5 on: May 04, 2016, 10:17:49 pm »
The gold circles labeled SCL and SDA near the connector, NOT the ones at the top of the picture.

darkdave

  • ***
  • 152
Re: UBLOX NEO M8N GPS and Compass
« Reply #6 on: May 04, 2016, 10:35:30 pm »
So a total of 2 wires will lead from those 2 points to the Flexiport... So the Flexiport will only take 2 wires? Which connectors on the Flexiport should the two wires be? There are 4 connectors for the Flexi.

<I just had a look at the links above so Ill wire accordingly>

Also could you send me a good youtube link to teach me how to solder to circuit boards?

Im good at soldering wires together but not to circuit boards according to what you said I should do. I have all the gear:

1. Butane soldering iron
2. flux
3. solder

Do I need anything else? If not I just need a good video to teach me how to solder wires to circuits boards.
« Last Edit: May 04, 2016, 10:39:48 pm by darkdave »

f5soh

  • *****
  • 4572
    • LibrePilot
Re: UBLOX NEO M8N GPS and Compass
« Reply #7 on: May 04, 2016, 10:51:14 pm »
Soldering wires to the two big pads should not be a issue.

If you have some similar connector like the one used on GPS you can also add wires to the connector.

Here is the wiring on flexiport:
https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+setup#GPSsetup-GPSwiring

darkdave

  • ***
  • 152
Re: UBLOX NEO M8N GPS and Compass
« Reply #8 on: May 05, 2016, 09:58:47 am »
I'm being told by the supplier in China that "Openpilot Revolution" has a compass and that is why he didn't bother with the wiring... is this true?

kennyevo

  • ***
  • 102
Re: UBLOX NEO M8N GPS and Compass
« Reply #9 on: May 05, 2016, 10:05:25 am »
I'm being told by the supplier in China that "Openpilot Revolution" has a compass and that is why he didn't bother with the wiring... is this true?

Yes, the Revolution contains an internal magnetometer

darkdave

  • ***
  • 152
Re: UBLOX NEO M8N GPS and Compass
« Reply #10 on: May 05, 2016, 10:20:17 am »
So does it make sense to still use the external compass in the GPS?
Or is the compass in the GPS more superior than the one in the Flight Controller so I should still use it(external) instead?

I was under the impression that the compass in the Flight controller is NOT a magnetic compass. That it's just a bunch of accelerometers that need to be calibrated between flights to know which way is true north. But the external compass will sense magnetic north without the need for calibration between flights. Right?
« Last Edit: May 05, 2016, 10:23:47 am by darkdave »

Mateusz

  • *
  • 808
Re: UBLOX NEO M8N GPS and Compass
« Reply #11 on: May 05, 2016, 10:30:22 am »
So does it make sense to still use the external compass in the GPS?
Or is the compass in the GPS more superior than the one in the Flight Controller so I should still use it(external) instead?

I was under the impression that the compass in the Flight controller is NOT a magnetic compass. That it's just a bunch of accelerometers that need to be calibrated between flights to know which way is true north. But the external compass will sense magnetic north without the need for calibration between flights. Right?

No, Revo has magnetometer HMC5883L, and that one is supported by firmware. External (AuxMag) on GPS unit is exactly the same magnetometer.
If you mount your flight-controller far from wires, magnetic interference, then internal magnetometer might be used.
However in most cases, especially on < 300mm quads, flight controller is too close to power wires, and other components that create magnetic field that changes with the current drawn.
When you calibrate Mag, you account for metalic objects around, but it's very hard to model and account for current depended magnetic field from motors, power wires etc...
That's why in most of cases you need the same magnetometer placed in the mast far above the quad-copter.

It is not required for GPS to be on the mast, it's usually though on the mast because many GPS units contain integrated magnetometer.

darkdave

  • ***
  • 152
Re: UBLOX NEO M8N GPS and Compass
« Reply #12 on: May 05, 2016, 10:47:20 am »
So you say hey both (GPS and FC) use the same compass. Is this a magnetic compass that senses where magnetic north is so I dont need to teach it each time I fly where North is?

If not can you recommend me a compass that does this(sense magnetic north) that will work with Librepilot?

Mateusz

  • *
  • 808
Re: UBLOX NEO M8N GPS and Compass
« Reply #13 on: May 05, 2016, 11:15:11 am »
So you say hey both (GPS and FC) use the same compass. Is this a magnetic compass that senses where magnetic north is so I dont need to teach it each time I fly where North is?
If not can you recommend me a compass that does this(sense magnetic north) that will work with Librepilot?

To my knowledge all compass modules sense North. Calibrating magnetometer does not mean it is used, it is the sensor fusion algorithm that you need to set, some use Mag, some dont.

My impression is that many beginners get into thinking that using GPS will magically make aircraft hovering in place of centimeter accuracy.

I guess this thinking comes from the fact that many people have smart-phones and there position from GPS together with sensors, cellular services and wifi gives reasonably good estimates.

This assumption is very wrong and different from model air-crafts (unless expensive ~$1000 RTK system is used). Raw unprocessed GPS alone gives you 3-4 meters of error or worst with cheap antennas. What is very important is that so called GPS flight modes, just do NOT use GPS alone. When you want to use GPS for stabilization with INS31 (EKF) then it will have to use ALL sensors: accel, gyro, magn, baro, gps to work together.

It is the EKF that blends together ALL sensors to give reasonably good position. Despite EKF is designed to deal with noise, it has some tolerance for that. If one sensors gives completly wrong contradicting data, EKF won't be able to give good results.

Adding GPS won't do any magic if there are other problems, for instance noisy magnetometer as just one example.
You should start with Complementary and tune your stabilization PIDs, then try altitude hold/altitude vario and tune your altitude hold PIDs. At that point you should have air-craft that without GPS and no wind, hovers in place without huge drift (it will drift) but allowing you to let your sticks for a couple of seconds. I am able to put Taranis on the ground for 1-2 seconds before it starts driffting and accelerating in one direction.

At that point, when you have resonably stable air-craft you can think of testing Complementary+Mag and set your earth altitude in GCS, to see how air-craft behaves. Magnetometer should be calibrated with full build, outdoors (important that is not indoors), far from metalic obejects, preferably by holding aircraft in the air and using OPLink. Then you do 5 times save and last time you use to rotate your aircraft in all directions. This should be using external magnetometer. You also need to make sure your external magnetometer is in the same orientation as the one on flight controller, since default orientation is 0,0,0 and different manufacturers place external mag on GPS units differently. Mag/GPS+Mag should be high above aircraft on mast that is not rotating (I use ~14cm). Twisting power wires is also recommended to redirect stronger magnetic field horizontally (direction in which wires are going) and make it weaker vertically.
Since any rotation of the mast invalidates calibration, also changes to aircraft like adding camera makes your Mag calibration not accurate.

Once you have Mag error < 5% and always green (never jumps to orange) even when motors are running, then you can try enabling INS31 which will combine all sensors together.

zukenj

  • ***
  • 202
Re: UBLOX NEO M8N GPS and Compass
« Reply #14 on: May 05, 2016, 03:31:40 pm »
Mateusz,

great explanation.

Darkdave,

These are really important tips. Please keep them in mind.

Magnetometer should be calibrated with full build, outdoors (important that is not indoors), far from metalic obejects, preferably by holding aircraft in the air and using OPLink. Then you do 5 times save and last time you use to rotate your aircraft in all directions.

You also need to make sure your external magnetometer is in the same orientation as the one on flight controller, since default orientation is 0,0,0 and different manufacturers place external mag on GPS units differently.

Once you have Mag error < 5% and always green (never jumps to orange) even when motors are running, then you can try enabling INS31 which will combine all sensors together.
FS-TH9X RC
F450 Clone
Revolution FC
EMAX 2213 935 KV
HK 30A ESC UBEC running BLHeli 14.4
10x4.5 Propellers
DJI Naza clone Ublox M8N GPS