How to Setup GPS in Betaflight

How to Setup GPS in Betaflight

In this tutorial I will show you why and how to setup GPS in Betaflight, and explain what GPS module you should get. With GPS enabled you can display coordinates and home arrow on OSD, or have GPS rescue mode available.

Table of Contents

Why Use GPS on FPV Drone?

You can display useful info on your OSD, including the location of the quad (latitude and longitude), distance to home, speed, altitude and arrow pointing home. The last known GPS coordinates can help you find the quad if you crash.

If you use Telemetry on a receiver such as the X4R or R-XSR, you can even send the GPS coordinates to the Taranis in real-time. This makes searching for the lost quadcopter less challenging.

For flight controller firmware that supports features like “Return to Home” or “Position Hold”, requires GPS module to work.

In the latest Betaflight there is a new feature “Rescue Mode” which is similar to Return to Home. It can bring your quad back near the launch point when signals are lost. So it looks like GPS is becoming a useful part of Betaflight.

I have a tutorial explaining how to setup GPS Rescue Mode in Betaflight.

What’s the Best GPS Module for Betaflight?

There are a lot of options when it comes to GPS modules.

Betaflight doesn’t require a compass, so there is no need to use a GPS receiver with built-in compass, only it’s heavier and more expensive.

A small GPS module would be preferable due to the limited space in a mini quad. I have had good experience with the BN-220: http://bit.ly/2nD6QxP

There is an even smaller GPS module, the BN180: http://bit.ly/2TWrozB

I have tried both 220 and 180, but I can’t really tell the difference apart form the size. Mind you the BN180 doesn’t have flash memory to save configuration, however you don’t really need to change any settings in the GPS receiver, it normally works out of the box, so flash memory isn’t necessary for me.

If all you care is size and weight, you have to check out the NLRC Tiny GPS, it weighs at only 1.6gr. It’s not as sensitive as the other GPS with larger antenna, but it’s small.

I also tested the Flywoo Mini GPS, same size and weight as the BN180, it also works quite well but the baud rate is slower at 9600: https://oscarliang.com/product-1h8x

Another option is the BN-880 which is bigger and has a built-in compass which is not necessary for Betaflight Rescue mode: https://amzn.to/2BctUgg

It’s important to get one with M8N chip, not the older versions such as M7N. M8N can get a GPS fix quicker because it can see two different satellite constellations (systems) at the same time. It effectively doubles the number of satellites the GPS receiver can see.

Most of these GPS units come pre-configured, you can just hook up to a flight controller out of the box. However, if you want to mess with the settings you can configure it using a serial UART adapter and the U-Center software: https://www.u-blox.com/en/product/u-center

If you see some scratches on the metallic patch of the GPS antenna, it is not necessary defect or damage, but could be the result of antenna tuning during final testing in the factory. These types of antenna have a nominal tuned frequency, but are often impacted by construction, components location and soldering. Placing small nicks in the centre of the long edges, or corners, can fine tune its frequency.

Hardware Requirement

If you are using Betaflight, you will need an F4 or F7 flight controller. GPS function was removed for F3 boards since BF3.2 due to memory space limitation.

Connecting GPS to Flight Controller

Wiring the GPS module to a flight controller is straightforward, just connect it directly to a free UART (TX to RX, RX to TX), and power it with 5V.

How to Setup GPS in Betaflight

In the Ports tab in Betaflight, select GPS under “Sensor Input” for the UART that is connected to the GPS receiver. In this example, UART6. I just left Baud Rate at default (57600).

In the Configuration tab:

  • Enable GPS
  • Select Protocol, it’s either UBLOX or NMEA. Usually it’s UBLOX, but try the other if it’s not working
  • Enable Auto Config
  • (optionally you can also try enabling Auto Baud and let Betaflight choose a baud rate for you)
  • Save and Reboot

Once you have wired and set it up correctly, you should see the GPS indicator light up at the top of the configurator. If GPS module is not powered, you probably have to plug in the LiPo battery.

Now you need to wait for the GPS unit to get a “3D fix” (when it sees at least 4 satellites). It might take a few minutes depends on your location.

When it does, the red LED on the BN-220 module should blink (together with the blue LED). You will see information under GPS in the Setup page, where it says “3D Fix” is True, and shows your coordinates.

When you power up the GPS module the first time in a new location, it always takes longer to find satillites. This is referred to as “cold start”. Once you’ve done it the first time, later when you restart the GPS module it will get a lock much faster.

You might want to perform this outdoor, or as close to the windows as possible if you are indoor, with the antenna pointing to the sky.

You have two options to display GPS info: via Betaflight OSD or/and Radio Telemetry.

Check out this tutorial about Betaflight OSD if you are not familiar with it. You can display GPS coordinates, distance and direction to home and many more

Another thing you can do is to use your Taranis to log the real-time coordinates via Telemetry (SmartPort or Crossfire). If you crash, you have the last known position of your aircraft.

Power on the quad, go to the Taranis telemetry page, select “Discover new sensors”. New sensors including GPS coordinates should now appear.

Testing Betaflight GPS

You want to test the GPS thoroughly before relying on it for long range flying. First thing I would test is to see if the GPS coordinates you are getting is correct. Enter them in Google Maps, and see if it points to where you are.

Repeat this in a few different places if possible.

If that’s all working, you might also want to setup Rescue Mode.

Is My GPS Working At All?

How do I know if my GPS module is talking to the flight controller at all? Is the UART connection correct?

Well one way to find out is to run the ‘gpspassthrough’ command in the CLI. It will let you see if there is any data communication going on between the FC and GPS module.

If the GPS module is talking to the FC, you should see a load of hieroglyphic binary data characters. If you see nothing, then the GPS is either dead/unpowered, or the UART connection is incorrect, or there’s something wrong with your setup.

Mounting GPS module

Don’t mount your GPS receiver upside down which is a very common mistake.

The GPS receiver antenna should be facing up, it’s a flat square with small metal circular part in the middle. There should be no components at all on this side.

Make sure nothing is blocking or interfering with the GPS unit at anytime. Mount it on top of your quad and away from the VTX antenna as well as RX antennas (many radio receivers are actually transmitters as well due to their two-way communication nature). Also beware some HD cameras might produce radiation that affects your GPS signal if they don’t have the appropriate shielding.

By leaving long enough wires allows for more flexible installation. Here are some ideas:

On top of your GoPro/HD camera.

On top of the LiPo battery (you can also mount it on your strap with 3D printed mount).

Top of your frame if you have an under-slung battery.

Using a mast to keep the GPS unit as far away from the quad as possible. But probably a bad idea to have it so close to the VTX antenna in this example…

The rule of thumb is that the GPS must see the sky at all times (except when you are doing a roll or inverted yaw spin).

Before your flight, It can take a while to get a GPS lock. You might want to power on your quad and GPS beforehand to “warm up” first, e.g. on the way to the flying field.

Additional Sensors for GPS

Additional sensors are not required for GPS in Betaflight. But by combining measurements from other sensors can give you a better picture of what the drone is doing. I will add more info here later.

Barometer

A barometer is a pressure sensor that for measuring the aircraft’s altitude. It’s more accurate than using GPS’s estimation. Some flight controllers come with a Barometer, usually the BMP280. (Kakute F7)

Compass/Magnetometer

The compass is for measuring which direction the quadcopter is facing. It’s usually an external sensor that you need to connect to the FC via i2c port.

Interference

GPS satellites transmit data on two frequencies, L1 1575.42MHz and 1227.60MHz, hence 1.3GHz FPV can cause interference to your GPS. Also because GPS signal is so weak (it’s from space after all), any other powerful signal nearby can cause interference too, therefore you should mount the GPS module as far away from any transmitters as possible.

Getting a GPS Lock Faster

Most GPS modules have a small battery, which is used to store satellite information and time for a faster lock.

After the GPS module gets a satellite lock, it remembers all the satellite locations, so when you change drone battery (the GPS module is powered off briefly), the GPS lock usually can resume almost immediately. But when the GPS doesn’t have satellite information stored in memory, or the satellites it remembers are no longer in view, it will take much longer to get a lock.

This is why some people powered on their quad (or just the GPS module) prior to their flight just to get a lock, so they don’t have to wait around before taking off.

If your GPS always takes a long time to get a lock, it’s worth checking if the battery is dead. Also make sure there is no interference to the GPS, for example if you are using1.3GHz FPV setup, and try to move powerful VTX away from the GPS. Cloudy day can also have an effect on GPS signal quality.

Leave a Reply

Your email address will not be published. Required fields are marked *