How GPS works?

How GPS works? The short story of a time difference!

We take GPS and other GNSS systems (Galileo, Glonass, Beidou) for granted. They are there, they tell us where we are, and everything works "out of the box". However, all the GNSS/GPS system are fascinating examples of how amazing science and technology is! Do you know a GPS receiver can find its location only thanks to the delay of radiowaves and all GPS satellites emit actual date and time?

How to connect GPS to ESP32

Thanks to a very versatile Input/Output matrix, it is quite simple to connect NMEA GPS modules to ESP32 MCUs. Not only ESP32 boards have 3 serial ports you can choose from, they can be assigned to almost any pin you want.

ESP32 with GPS and OLED display

In this example we will connect a popular Ublox NEO-M8N like Beitian BN-880 or BN-220 to a ESP32 development board and output current position on a USB serial port using Arduino IDE and TinyGPS++ library. Let’s begin

Continue reading “How to connect GPS to ESP32” »

ESP32 and GPS with a help of TinyGPS++ library

One of the first projects I did with ESP32 development boards is a simple GPS tracker. OK, it's not really a tracker since it does not store the position anywhere, more like distance meter with a UBLOX Neo-8M Beitian BN-880 GPS unit and small SSD1306 OLED display.

This ESP32 GPS Thingy as I call it uses one button to store current position and then report straight line distance, speed and altitude compared to "Home Point". GPS communication is handled by TinyGPS++ library.

Oh, one the best things about ESP32 is that you can map ports to almost any pin you want. It's not like on ATmega328 where UART and I2C are always the same pins. Here you can choose them. How nice is that?

Code is available on GitHub.

Matek SAM-M8Q and SAM-M8Q Compass GPS modules hands on

You might say that UBLOX NEO-M8N (Beitian BN-880 for example) is the workhorse on INAV and other drones with GPS functions. It is reliable, well know and proven. But it is also big and heavy. So why not try something new?

Matek did tried something new and just provided me with two brand new GPS modules of their: Matek SAM-M8Q and SAM-M8Q Compass with a QMC5883 magnetometer. One is only a small GPS module suitable for airplanes (flat surface) while the other one has also a QMC5883 compass that makes it a perfect choice for multirotor drones. Let’s take a look at those two and figure out if they might be worth it.

The best GPS module for INAV

This is my personal best GPS module for INAV: Beitian BN-880 based on Ublox Neo-M8N. Currently I have 3 pieces of BN-880, all works just great, and if I will have a need to have another one, I would also choose it.

Why? It really works well. On the outside it gets a solid 3D fix in less than a minute. It even can get a fix with 9-10 sats in a center of a city when only a small piece of sky is visible simply by lying on a windowsill. It take time, but works.

Beitian BN-880 - best GPS module for INAV?

Continue reading “The best GPS module for INAV” »

Hands-on: Beitian BN-880 GPS module

Looking for a decent replacement for my u-blox NEO-6M GPS modules I came by super cheap, Chinese, Beitian BN-880 modules from Banggood. According to information found in the internet, it’s build based on u-blox Neo-M8N and is capable of receiving signals from GPS, GLONASS, Galileo, BeiDou, QZSS and SBAS. Plus integrated magnetometer module. Yesterday package finally arrived and here are my first impressions:

  • It’s not single board, but 2 boards glued together
  • There is not casing, and cases for popular Neo-6M wont fit. BN-800 is much taller
  • It accepts both 5V and 3.3V voltage and 5V UART level is safe, nothing burned
  • It connected to Cleanflight and iNav without any problems at 38400bps
  • Quick windowsill test showed that indeed it works not only with GPS, but also other positioning systems. When GPS Neo-6M was barely able to acquire 4 satellites, Beitian BN-880 found 9 and a solid 3D fix
  • I did not tested magnetometer yet

Beitian BN-880

Beitian BN-880 Antenna

Beitian BN-880 Side view

Hopefully I will be able to perform more tests next few weekends and provide more info on this module. For now it looks very promising.

iNav: Cleanflight learned how to do missions

In my recent post I mentioned that iNav flight controller software (fork of Cleanflight) introduced missions. Missions are preprogrammed waypoints that drone will fly to in specified order and/or do specified action at each of them. For example, if pilot wants to make a video on specified route, he does not have to pilot his drone all the time. He enters waypoints and lets machine do everything else. In this entry I will show how to configure iNav to do missions.


  • iNav compatible drone flight controller flashed with iNav software. Currently supported boards are: Naze32, Flip32, CC3D, SPracingF3, Sparky, RDMO
  • GPS module connected to flight controller board. This example shows how to do it for Flip32, but it will work for all other boards, only UART pins might be different
  • Magnetometer connected and properly calibrated
  • Barometer connected
  • EZ-GUI Ground Station Android application that will act as Mission Planner. Official Cleanflight Configurator does not support this function yet
  • Bluetooth telemetry. Some time ago I have written how to do it for Flip32, but it will work almost the same for all other flight controllers, only UART pins might be different

Continue reading “iNav: Cleanflight learned how to do missions” »

Better GPS for Cleanflight: iNav

Cleanflight is an awesome piece of software for STM32 based flight controllers. But Cleanflight has one very serious flaw that makes its usage on bigger drones at least problematic. Cleanflight sucks in GPS and barometer support. Sucks a lot. It can handle Position Hold (somehow), Return To Home (barely) and Altitude Hold (oh man, up and down, up and down) but if you at least one tried that, you should know that is not only not reliable, but also not precise and hard to tune. Personally I gave up after few tires. It was not worth it. Comparing to Pixhawk (not talking even about Naza) it might as well not exists at all. But it has changed recently…. Continue reading “Better GPS for Cleanflight: iNav” »