LibrePilot Forum

General Category => General Discussion => Topic started by: darkdave on May 03, 2016, 10:58:54 pm

Title: UBLOX NEO M8N GPS and Compass
Post by: darkdave 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


Title: Re: UBLOX NEO M8N GPS and Compass
Post by: hwh 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: f5soh 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: Mateusz 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 04, 2016, 10:14:23 pm
Can you tell from these pictures where I'm supposed to solder those extra wires?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: hwh 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: f5soh 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
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave 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?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: kennyevo 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
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave 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?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: Mateusz 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave 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?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: Mateusz 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: zukenj 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.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 05, 2016, 03:35:23 pm
Why does the drone think the way its facing when it powered on is always North then?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: f5soh on May 05, 2016, 03:46:19 pm
If you don't set a fusion algorithm that use Mag, the default heading is North at power up and next based only on Gyros.

For calibration, no need to set correctly the auxMag orientation.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 13, 2016, 12:17:49 am
I just found a Ublox 6M that has the wires already soldered for the GPS Mag (2 cables). If I swap out the M8N for the 6M I will have 2 mag compass and 1 GPS working together with accelerometers. How do I set this up in Fusion? Complimentary + Mag + GPS? But will it know there are now 2 mags? (The internal and external one)

Also how do I make changes to the Revolution settings permanent? There is no save button on that tab. And when I come back later I keep having to have to set it up again because it has reverted to Basic (complimentary only).
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: hwh on May 13, 2016, 01:27:52 am
Yes, if two mags are setup it will know it.  If you're running next (required for external mag) then the next sub-tab over from attitude->settings is attitude->magnetometer which will let you force it to use one or the other if you want.

There is no revolution settings tab, the attitude->settings tab, like every tab in the configuration section has a save button in the lower right corner.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 13, 2016, 02:13:37 am
Check the attached screenshot. As you can see there is no save button in the system tab.

When I changed it to "Complimentary + GPS + MAG" and tab out and tab back in , its always set back to BAIC COMPLIMENTARY. Anyways I did switch it back again to complimentar + GPS + MAG regardless and while my drone was hovering I hit the "return to home" function: the drone shot up a billion miles per second and I had to go hunting for the crashed wreckage using last known GPS position.

When it was on "Basic Complimentary" the drone shot up 10 meters and just hovered where it was, it didnt move toward the home location.

I did check to make sure the compass in the drone was synchronized with true north before this flight.

So my return home function doesnt work on either basic complimentary nor complimentar + mag + GPS.

Now I have to buy a new drone. What went wrong?
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 13, 2016, 02:17:16 am
And yes it is the system tab. That refuses to save between visits to the same tab. All I have to do is tab out and tab back in and it's back to "basic complimentary". As you can see in the above screenshot, NO SAVE BUTTON on the lower right corner like you said there should be.

UPDATE: I just double check, the changes made does stay during the flight, but after a disconnection and reconnection from the drone the settings snap back to "BASIC COMPLiMENTARY"

UPDATE 2: Ok I just found the save button but its not on the bottom right, its at the top. So now all I want to know is why my drone shot up 100m instead of just 10m after i changed the setting to complimentar + mag + gps-outdoor

Ill start a new thread.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: hwh on May 13, 2016, 03:26:35 am
You're running 15.09, a version that doesn't support external mags except for the GPS Platinum.  Every tutorial and wiki page on external mags warn that they don't work unless you're running next or wait until the next release.

The page you're on, the System tab UAVObject browser doesn't have a save button per se.   If you hover your mouse over the red and green arrows at the top of the page they'll pop up info on what they do.  It's not really intended for anyone but advanced users.  If you were running next as I said in the previous post you'd have been changing that setting in the config tab.

As a first try at getting gps/mag modes working you skipped over the simple, safe modes like gps assist and went directly to trying one of the most advanced modes where you give control of the vehicle to the FC.  You should be going step by step from the simple, easy modes gradually to the more complex ones.

You might want to read Cliff's post on his recommendations of how to work up to autonomous flight, they're at https://forum.librepilot.org/index.php?topic=15.msg36#msg36
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: Roypw on May 13, 2016, 02:46:45 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

THIS LOOKS EXACTLY LIKE THE ONE I BOUGHT - NO MAG CHIP IN MINE. BEWARE. The Amazon listing and on the GPS cover it says compass. Not so
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 14, 2016, 01:38:01 am
You're running 15.09, a version that doesn't support external mags except for the GPS Platinum. 

Aren't you? Just wondering, why you used the word "you". If its just me can I update to your presumably higher version?

Quote
Every tutorial and wiki page on external mags warn that they don't work unless you're running next or wait until the next release.

I wasn't running external mags at the time but the settings I chose said complimentary (im guessing this means accelerometers and gyros only) + MAGS + GPS outdoors. It didn't say "EXTERNAL MAG". I just assumed that Mags means internal mag.



Quote
The page you're on, the System tab UAVObject browser doesn't have a save button per se.   If you hover your mouse over the red and green arrows at the top of the page they'll pop up info on what they do.

I did, it saves "SAVE"

Quote
As a first try at getting gps/mag modes working you skipped over the simple, safe modes like gps assist and went directly to trying one of the most advanced modes where you give control of the vehicle to the FC.  You should be going step by step from the simple, easy modes gradually to the more complex ones.

I did successfully get the drone working in Absolute Position (GPS ASSIST) and Velocity ROAM and Position Hold. So youre wrong about that. I didn't skip those tests.

I couldn't however get return to base working. It just climbs and then hovers in hold position mode. It doesn't come back to the "house" on the map.

Or do you mean I should have set my Fusion Algorithm to INS13 only? Please elaborate

Quote
You might want to read Cliff's post on his recommendations of how to work up to autonomous flight, they're at https://forum.librepilot.org/index.php?topic=15.msg36#msg36

I did check it out but it lacks specifics such as fusion alogorithm settings

Btw, I like your movies "Matthew Broderick". :)
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 14, 2016, 01:45:37 am
Check attached photo to see crashed wreckage.

My questions are now is these:

1. When flying without an external mag: That is just the accelerometers, barometers, gyros, internal mag and external GPS. What must I set my Fusion Algorithm to? Which setting?

2. I have a 6M NEO UBLOX GPS Im using now because my 8m was also destroyed in the crash. Are you saying that I should not connect the compass in it to my Flight Controller because there is no support for it? If I can connect to it what setting should I set my Fusion Algorithm to? Which setting?

3. INS13(something about GPS? I notice it as a fusion mode setting) what is this?
4. "NEXT" what is this?
5. I2c (something about external mag?) what is this? I set it for my flexiport where my external mag is now connected in.


Thanks again, Mat! :)
David
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 14, 2016, 02:02:43 am
:D :P
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: Mateusz on May 14, 2016, 06:58:50 am

My questions are now is these:

1. When flying without an external mag: That is just the accelerometers, barometers, gyros, internal mag and external GPS. What must I set my Fusion Algorithm to? Which setting?

2. I have a 6M NEO UBLOX GPS Im using now because my 8m was also destroyed in the crash. Are you saying that I should not connect the compass in it to my Flight Controller because there is no support for it? If I can connect to it what setting should I set my Fusion Algorithm to? Which setting?

3. INS13(something about GPS? I notice it as a fusion mode setting) what is this?
4. "NEXT" what is this?
5. I2c (something about external mag?) what is this? I set it for my flexiport where my external mag is now connected in.

1. I believe answer to your question was on Wiki. I found it by google

https://librepilot.atlassian.net/wiki/display/LPDOC/Revo+Attitude+Configuration

Quote

Attitude Estimation Algorithm

You can choose between Basic(Complementary) or GPS Navigation (INS13).

GPS Navigation (INS13) is needed for extended features like GPS Assist, Position Hold or Return to Base.


I underlined important.

2. Yes, this has been answered as well, but that's is correct. Version tagged 15.09 supports only external mag in case of genuine OP GPSv9 if you are lucky to own one.
3. Above answered (for more details what sensor fusion algorithm is http://lmgtfy.com/?q=sensor+fusion+algorithm)
4. Above answered but it is possible to search forum that term occurs VERY often
5. Very first link to forum answers that http://lmgtfy.com/?q=I2C+Mag
Indeed AugMag with I2C can be used.
Title: Re: UBLOX NEO M8N GPS and Compass
Post by: darkdave on May 19, 2016, 08:43:45 pm
What was she like?

That is, what was she like when she was all wet? :D

Was she even slightly a turn on?