LibrePilot Forum

Users => Applications - Autonomous Flight => Topic started by: Mikael74 on June 02, 2017, 10:30:31 pm

Title: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 02, 2017, 10:30:31 pm
Hello all

I bought the Mini Ublox NEO-M8N GPS and compass to use with my Revo quad. I imidiately got the GPS up and running with the flexi-port set to GPS. But the compass wasn't getting through. Chatted with hobbyking support who told me that the Mini Ublox NEO-M8N GPS used I2C bus communication. But no matter what I try with the flexi-port set to I2C there is no connection with either GPS or Compass. I also get a "red cross" on I2C in the system health. Any ideas?

But when I think about it... If it was I2C comm then I probably wouldn't see the GPS work with the flexi-port set to GPS?

btw. using newest firmware...
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mateusz on June 03, 2017, 07:42:50 am
Hi Mikael,

You need two cables from GPS

Once you connect that, you need to set in GCS in Mangetometer settings to use "I2C".
If you have cheap GPS, I2C might be tricky and pull-up resistors might be missing or too weak and if your wire is too long Mag might not work. If that's the case search forum for "I2C pullup resistors values".

Once you have GPS and I2C green. You can take care of Magnetometer orientation (since software assumes 0,0,0 but manufactures can mount Mag in any orientation). Basically you enable "Use both" magnetometers, do calibration outdoors (skip first 5 steps and  rotate in all directions on 6th, then save). Then you try different values of magnetometer rotation (pitch,roll,yaw), these values are usually multiple of 45,90 deg. If you have to enter values like 30,20,15... then likely you doing something wrong. You can verify if both internal Revo's Mag and external are aligned by editing values displayed on one of scopes and showing both internal and external Mag. When you rotate copter scopes should show the same behavior, corresponding X,Y,Z axis from two devices should behave the same.

Good luck! :)
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 03, 2017, 08:21:57 pm
To add a little.  :)

For the style of GPS/compass you refer to, it must have two connectors coming out to have the compass available.  (Info: DJI/Naza GPS/compass puts both signals on one cable)  If it does not have two cables, it may be that it has a compass inside and it just needs a second cable added.  That is fairly simple if you can solder, with the hardest part being which wire of the new connector goes to the SCL pad inside the GPS and which new wire goes to SDA.  Wiki will show you.

I have seen some of these GPSs where the GPS says "GPS / Compass" on the case, but the compass is not connected because there is no second cable.

Often though, if it doesn't have a second cable, then the compass/mag chip is missing inside to save cost.  So...  I would start by opening the GPS case and looking for a small, square chip that is probably labeled "L883" or something similar.

Good luck.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 04, 2017, 03:43:35 pm
Thanks for the good advice. I'm not at home these days and have no possibility for soldering before I come home. Do You maybe have a link for somewhere I could buy the connector for the "board end" of new wires needed for the compass?

Have done a lot of testing with the new GPS and onboard compass. The onboard compass gives good data (green all the time) when quad not flying and becomes yellow some of the time in air. Is that ok? Quad fly ok (still a little bit unstable) on "Basic" but VERY unstable flying on "INS13" (close to not flying at all). In all these tests I had the calibrations done like video in Wiki except temperature. Also flying with Altitude hold works fine (foam covered barometer). Will adding the second Aux Compass improve stability?

Today I have just done the temperature calibration (-25 dgrC to +45 dgrC), but are not able to test due to very windy conditions.

Br Mikael

Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mateusz on June 04, 2017, 04:11:31 pm
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 04, 2017, 06:11:17 pm
Thanks again.

I just opened the GPS. Unfortunately it doesn't quite look like the others pictured in the forum. I'm not sure I can locate the compass chip on there and there are no marked pads for soldering wires onto. Instead there is a 6 pin connector where only 4 wires (for the GPS) are connected. Between the battery and the connector there is a small square (4x4mm) empty place. Hope its not where the compass was supposed to go  :(

Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: f5soh on June 04, 2017, 06:16:26 pm
No mag chip soldered.
You can erase the mention "with compass" :)

https://forum.librepilot.org/index.php?topic=1110.msg8434#msg8434
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mateusz on June 04, 2017, 06:46:54 pm
Between the battery and the connector there is a small square (4x4mm) empty place. Hope its not where the compass was supposed to go  :(

Well spotted, its where 5883L chip (compass) goes :) You can still get yourself $1-2 board like this http://www.ebay.com/itm/GY-273-HMC5883L-Triple-Axis-Compass-Magnetometer-Sensor-Module-For-Arduino-3V-5V-/400362466832 and mount it under GPS (not to block patch antenna). But you would need to mount it flat and set rotations in GCS. Alternatively buy GPS with compass.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 04, 2017, 06:54:52 pm
From some stuff I have bought recently.  :)

If you haven't bought a GPS pole mount yet, these are fairly cheap at about USD $2 shipped.
http://xt-xinte.com/?goods=detail&id=18429

You need to plan where you will mount the GPS/mag and how long the wires need to be.  With any of these connector and wire options, you will need to extend the wire length for the mag cable (none of the connectors come with long wires) and may need to extend the GPS wires too.

Note that most setups have 4 wires in the GPS connector, but only 2 wires in the mag connector.  They don't bother with power and ground wires in the mag connector.  If you have a separate mag board, you will need all 4 wires going to it and be careful to check the voltage before you buy because the mag chip needs 3.3V and the wires from the FC are usually 5V.  You need a mag board with a voltage regulator.  It looks like that one has a regulator.

These are the JST-SH style (1.0mm pin spacing) connector with wires that you need.  The wires are 10cm=4inch and are reasonably priced at USD $2.30 shipped for quantity 10.
http://www.ebay.com/itm/10-sets-Micro-JST-SH-1-0mm-4-Pin-Female-Connector-with-Wire-and-Male-Connector-/142067841999

or just 5 for $1.90
http://www.ebay.com/itm/5-sets-Micro-JST-SH-1-0mm-4-Pin-Female-Connector-with-Wire-and-Male-Connector-CA-/142067842038

This version has longer (about 20cm=8inch) wires than some versions, but even that is not long enough and they are rather expensive at USD $4.50 shipped for quantity 5.  If you have to solder wires together to make them longer, you might cut these up and get 40cm length by using wire + connector from one and cut off wires from another?
http://www.ebay.com/itm/JST-SH-1-0mm-4-Pin-Female-Connector-Housing-with-wire-28AWG-Length-200mm-x-5-pcs-/172543490834
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 04, 2017, 08:05:38 pm
Thanks for all your help. Think I'll go for a new GPS WITH compass from eBay. At what distance would you suggest the GPS/compass mounted over the quad frame (DJI flame wheel frame with battery on top)?
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mateusz on June 04, 2017, 09:20:07 pm
Thanks for all your help. Think I'll go for a new GPS WITH compass from eBay. At what distance would you suggest the GPS/compass mounted over the quad frame (DJI flame wheel frame with battery on top)?

On my 280mm build, I used 14cm mast, but maybe ~12cm would be enough, you need to test, probably depends on your wiring and overall built. All these masts are 14cm anyway, for example
https://www.banggood.com/Folding-GPS-Mount-Support-Holder-For-DJI-ZERO-QAV250-RC-Multicopters-p-983662.html
I think it's good that it's plastic and that has 2 screws so wont rotate and mess up your calibration. Also it might bend on crash which is good.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: mr_w on June 04, 2017, 11:04:10 pm
Well I don't know if I would recommend this specific type or not - the pole itself is not made of plastic but carbon fiber (my guess - it is very hard and doesn't flex at all), which is a good thing.

On the other hand, the problem with it is that you need to use very good glue at both ends of the pole, as otherwise it does rotate in plastic parts (bottom and top), indeed messing up with your calibration.

Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 05, 2017, 05:34:15 am
I've got a couple GPSs mounted with carbon masts.  I filed tiny flats in the carbon mast for the set/grub screw and flooded the flats and the mast ends with thin CA to harden and keep it from breaking when I tighten the screws.  Of course, let it dry thoroughly before assembling.  Also I don't over tighten the set/grub screws.  You do want to over tighten the pivot bolt though.  Tighten it enough to compress the fork and remove slop.

Build/mount the mast without the GPS and last step stick the GPS on the mast with double sided tape.  This way the alignment of the flats in the mast is not critical.

Remember that the wires come out of the back of the GPS for most GPSs except for DJI/Naza.  Always look for the arrow on the GPS to tell you which way is forward.  But don't worry if you do it backwards or it isn't perfectly straight, you can fix it with Attitude -> Magnetometer -> AuxMagRotation.

One more bit of advice is that I use standard double sided tape (the white stuff, not the strong black or gray stuff) to attach the GPS mount base to the quad frame.  It stays on very well, but comes loose without breaking in a "crash".  ;)
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 05, 2017, 10:05:28 am
A lot of fast and good advice. The best forum! Thank You guys (I imagine you are guys anyway :) )
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mateusz on June 05, 2017, 10:32:12 am
Well I don't know if I would recommend this specific type or not - the pole itself is not made of plastic but carbon fiber (my guess - it is very hard and doesn't flex at all), which is a good thing.

On the other hand, the problem with it is that you need to use very good glue at both ends of the pole, as otherwise it does rotate in plastic parts (bottom and top), indeed messing up with your calibration.

Haha, sorry for not being specific :)
The other parts are of course plastic, like the mounting circle, you don't want big metallic circle not only because that would be heavy, but also it might saturate Mag or mess-up readings.
Pole is carbon fiber, I used super-glue :) It's a foldable pole, normally it stands fine, but if you push it really hard it folds down, has small locking system and folding it requires applying some force. I think it's a good thing :) They're dirty cheap, order two different kinds and test them what works for you best :) Maybe the one with 4 bottoms screws is better for bigger 450mm DJI frame. On 280mm build, I found that two screws fits well in the holes I had already in top plate.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 06, 2017, 05:22:36 pm
I found this on ebay. Would it do the job (except the connectors)? I would like to use main port on the Revo for s.bus communication - is there a problem with that? Think I have red somewhere that I could use flexi and flexi-io for GPS and compass.

http://www.ebay.com/itm/Ublox-NEO-M8N-GPS-Modul-w-Compass-fur-APM2-8-APM2-6-Pixhawk-Flight-RC234-/132022957472?hash=item1ebd2e75a0:g:AQEAAOSwux5YQwyC
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 06, 2017, 06:18:36 pm
On Revo you must use MainPort for SBus because SBus requires a hardware inverter circuit and that is only built into MainPort.
On Revo you must use FlexiPort for I2C mag because it is the only port that can do I2C.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 06, 2017, 09:02:11 pm
Ok. And then the flexi-io (which is freed up when I use s.bus) can be used for the GPS. Do you think the GPS I linked to will do the job with a little soldering and new connectors?
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 06, 2017, 09:24:52 pm
It should work fine.  I think I have one that looks just like it and really every Ublox GPS with standard APM/Pixhawk mag that I have tried or heard of works.  Some need a little help with I2C pullups.

Just FYI: If you haven't bought it yet, ;) there are GPS/mags that are a bit smaller if you need smaller.
http://www.ebay.com/itm/Ublox-NEO-M8N-Flight-GPS-controller-with-Compass-Engine-PIX-Pixhawk-PX4-/282313226905

But then there is the DJI/Naza GPS/compass which does GPS and compass on a single connector.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 06, 2017, 10:06:14 pm
Smaller and cheaper - whats not to like  :)
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: andyp on June 07, 2017, 12:15:03 am
I have also the Ublox Neo M8N and connected the compass to I2C and the GPS to serial like it is described in the librepilot user forum.

Works well and no problems so far, but I have ordered the one connector NAZA GPS with compass in order to use the I2C port for telemetrie for OSD. This is better.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 11, 2017, 09:00:24 am
Any reason You are not using the built in OPlink in the Revo?
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 11, 2017, 11:54:06 am
Built in mag maybe?  :)
The problem is that the high current flight power wires are too close to Revo.  An aux mag sensor can be moved farther away from these wires so they don't distort the compass.
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: Mikael74 on June 11, 2017, 12:24:34 pm
Yes I know. But I understood that andyp would use the flexi-port (I2C) for telemetry? Maybe its me not understanding the issue.

In my setup I'm using built in OPlink for telemetry. And plan on using the flexi-port for I2C comm. with ext. compass and the flexiIO for GPS. Then use the main-port for s.bus comm with receiver.

I was the curious (since I'm still learning quite a bit here) why the setup mentioned by andyp with NAZA GPS/compass on the flexi-port was better?
Title: Re: I2C/Mini Ublox NEO-M8N GPS problems with Revo
Post by: TheOtherCliff on June 11, 2017, 04:22:40 pm
andyp?  I don't see OpLink/telemetry described.

FYI: S.Bus is an RC receiver protocol on mainport and the receiver port is also called FlexiIO which is different than FlexiPort.