Saturday, November 17, 2018

Setting you GPS up with your Flight Controller

Of course, you want GPS



One of the richest features of a flight controller is its ability to take over flying for you.  If you fly out of radio range on your transmitter or you lose video signal you'll want to activate the "Return to Home."  When the flight controller first fires up it will try to lock in on some satellites. It then records the location of where the flight controller is armed.  It is possible flying FPV that you may lose orientation to where you are located and thus this feature comes in handy. You can also use it to measure flight distance, ground speed and give you a direction back both with an arrow and a distance scale should you get disoriented.   The GPS units are generally fairly inexpensive.

If you're into simple.

There are various bundled flight controller packages.  The upper echelon seems to be the PixHawk.   I looked at the HolyBro version of the PixHawk 4.  At $170 it pricy, though it does sport a high end flight controller board.  The only problem is that they didn't solder on the pin headers on the power distribution board.  So, you're going to have to solder anyway.   The good news is that most of it's figured out for you in advance.    Thus, it will get you flying with fewer headaches.  But seriously, $170 and you still have to solder?  This is also a fairly large unit which means it won't fit in your Wing Wing.



The Pixhawk uses connectors and thus many of the GPS unit's you'll find will say that they are made for the Pixhawk. I would love to think that every flight controller board would take every GPS module as a plug-in, but this isn't the case.

It's only four wires if you're flying a plane, six if you're flying a quad.

Parrot Bluegrass Multipurpose Quadcopter for Agriculture


Some GPS units have four wire and some have six.  There are 4 used for the GPS and 2 used for the compass.  If you're flying a plane the assumption is that you're always flying forward. So, you really don't need a compass. Drones can hover and spin so they need a compass.  My suggestion is to cut the two wires for compass if you're flying a plane, but not too short.   You'll never know if a cool feature shows up in iNav or BetaFlight that uses a compass for some reason.  You can also wire it back up and solder it back in.  But, if not, it's one less headache to deal with.

Four wire, 2 +2

Two wires are for 5 Volt.  One's positive and one's negative.  That's simple.  You can wire that to your PDB on 5V.  That leaves us with two wires. One wire says TX and one says RX.  This is the only confusing part. The TX on the GPS goes into the RX on your  FC board and the RX on your GPS goes into the TX on your FC board. Some flight controller boards have a GPS connector on the side.  If you do, there is either a 4 or 6 pin connector that you probably don't own.  Ive been facing some difficulty finding GPS connectors for flight contoller.

And, this is when things get a bit more difficult

So far I haven't played with any flight controllers that use a "connector only" solution.  If you do have this, then you'll need to find the connectors to get your GPS to work.    When you go this route follow the diagram, not the color code of the wires.   This is a super important point.

Don't trust anybody's color coding system.

Some people make a list of color coding online to make it easier for their readers and viewers. The problem is that the GPS modules do change over time and thus the wiring guide may be inaccurate, and worse may burn out your GPS.  Pay attention to their logic, but TRUST NOBODY'S wiring diagram based on color.


Example of two GPS units I acquired.


This one is simple




The GPS module can be found HERE.   It's the newer style of GPS, really built for the microsized quadcopters but we're using them on planes as well. It's very small and very light.  One piece of advice.  You should have the GPS unit away from the electronics of your plane.  Thus, if you're wiring this up, perhaps give yourself some extra wire to help place this unit on the wing.  If you can see the label it's upside down.   The label goes onto the top of the wing, and the side you don't see points up to the sky.  These things are so small that you can route an exact sized hole in your wing and mount it flush.

Anyway, what we can tell about this unit is that it's 4 wires and thus doesn't have a compass.  From left to right  Pin 1 goes to 5V -.   Pin 4 goes to 5V +. You can wire it to your power distribution board or extra pins on your flight controller.  Pin 2 goes into your RX on your flight controller and pin 3 goes into your TX on your flight controller.  Assign the right UART channels on your flight controller, turn on GPS and you're done!



I would use additional wire to wire to your flight controller. The small stranded wires tend to not solder well to your board and could come loose.   Also, there is a crystal in the GPS unit that can break in a crash.  When this happens, throw the entire thing away and install a new one.




I bought a few hockey puck GPS modules

You won't have a problem finding these online. The module itself is much smaller than the big plastic casing.   I have a feeling that the original modules were the size casing.  Anyway, it provides plenty of protection and the wires seem secure.  I am not going to route the module out on my wing for these modules. Why?  Because I have a feeling that this design will be gone in a few years.   Just use the provided double stick tape.  When that fails, glue it down with something like UHU POR so that it can be removed should you ever want to get rid of it.

The original Hockey Puck modules were grey.  These black ones are newer.  Here's a photo of the chipset used.




You can look up the number and find out all sorts of interesting details about the GPS.  It seems to find satellites faster and works a bit better.  Anyway, I got three from the same vendor, but I won't assume all three are identical.   I will open each one up and look inside.

The vendor was gracious enough to not give any wiring instructions on their sell page.  And to make things even more complicated,  the wiring position changes from one side of the cable (as intalled in the connector) to the other side's connector.



Starting from the bottom, the red and black are actually correctly color coded. Red to 5V+ and Black to 5V-.  The yellow RX wire goes into the TX on the flgiht controller.  The forth wire is green, it says "TXO (Transmit). It goes to the RX on the flight controller.  The last two wires are for the compass.


When you assign your GPS to a UART, be certain it's one you haven't used before.  Thus, setting up your GPS may be one of the last things you'll want to do, after you have your transmitter and video working.


Take it outside

When you fire up the unit with GPS you'll need to have it outside to find enough satellites.  GPS works off of triangulation, thus you'll need at least two satellites to discover your location.  I believe the INAV doesn't turn on until it's seen something like 5 or 6 satellites.

Now your motor won't spin?

You take out your plane or quad and arm it, and the motor won't spin?   The flight controller is looking for satellites.   When it's found enough it will arm your flight controller.   It will also log in the exact location where you armed your plane or quad so, keep that in mind.


Return to home/ failsafe

It's a blast to flip the switch of the first time and watch the return to home bring back your plane or quad.   If you're flying a plane, this is where things get not so fun.  Flight controllers are designed for quad pilots in mind.   If you're flying planes,. here's some advice.

INAV over Betaflight- I've seen guys flying wings with Betaflight.  I bet they started off as quad pilots and really know and love the Betafight.  But, looking on Betaflight's wiki they suggest that fixed wing folks head over to INAV.  If you want to stick with Betaflight, the servo tabs are hidden until you go to advanced mode.

There is a lot of good info and good settings in INAV's wiki.   The one thing I will tell you right off the bat is that  the default return to home is something like 30 feet.  This means that your plane will fly around 30 feet in the air when it finds it's way back home, which means you'll probably run into trees.  They have fixes for that in INAV and options to have failsafe to return you to where you first armed your wing.

Patience my padawan

Image result for yoda's jedi training

Your first plane took weeks to assemble?  Now you can build the same thing in less than an evening?  Flight controllers are the same thing. Actually, worse.   You have to get the micro-soldering down.  Then you get to figure out the wiring, often with little to no information.   And when that's all complete you have to work with software and millions of options.   To top it off, now and then you'll have to copy and paste some lines of code.

And yet, it's one of the most rewarding experiences you can have as an RC pilot.  Thirty years ago, if you even suggested at the RC park that a plane could fly itself places via a computer and fly back to where you are with a flip of a switch they would suggest psychiatric help for you.





No comments:

Post a Comment

The fun of buying used planes

  If you like to buy and sell used planes.  Occasionally you can find really good deals. I mean, mind blowing deals.  Most of the time you d...