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.
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?
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 because it’s small, and worked out of the box for me: 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.
With similar size to the BN180, I recently tested the Flywoo Mini GPS, which also works really well: 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.
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 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
- (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
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.
If that’s all working, you might also want to setup Rescue Mode.
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.
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.