In this tutorial I will show you why and how to setup GPS in Betaflight for a quadcopter. I will also explain which is the best GPS module to get.
Why Install GPS in a Quadcopter?
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.
Which GPS Module to Get?
You need a small GPS module due to the limited space in a mini quad. I recommend the BN-220 because it just worked out of the box for me.
Buy BN220: http://bit.ly/2nD6QxP
Another option is the BN-880 which is bigger, but has built-in compass. It’s popular on larger models:
Buy BN880: 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 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 limitations.
Connecting GPS and 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
- 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.
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
Power on the quad, go to the Taranis telemetry page, select “Discover new sensors”. New sensors including GPS coordinates should now appear.
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.
Tips Mounting your GPS module
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. 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. 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.
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)
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.