GPS module for a RC plane

Today I would like to present you a small GPS module with super capacitor backup. Having GPS coordinates known during flight time is very beneficial. There are multiple ways in which longitude and latitude can be used to enhance the RC flight experience. Once again we have, and for the most obvious reason, the ability to track a plane or a drone. We can also calculate the current distance to a flying object in line of sight. Finally, using GPS coordinates, it is possible to implement an autopilot and a feature called return to home in case of broken radio link.

Electric schematic

Below you can see the electric diagram for the GPS module. The GPS module was equipped with a super capacitor to act as a backup power source. This allows the GTPA010 module to retain the information collected in the event of disconnection from the main power source. After applying the main voltage, the GTPA010 takes less time to fix the GPS position. There are also two resistors R1 and R2 that limit the charging current. In the configuration presented in the diagram, the charging current is 40 mA (R1 = R2 = 250 ohm). Additionally, there is a signal diode, a common 1N4148; in this configuration it prevents current flow from super capacitor to 5V.

Schematic for GPS module with super capacitor

Below you can see a mounted module ready to be put on a RC plane 🙂

Assembled and tested module

NMEA protocol

The National Marine Electronics Association (NMEA) protocol is a standardized communication format used by marine electronics devices to exchange navigation-related data between units. It was introduced in the 1980s, and the NMEA protocol has become the standard for marine electronics. In the end, it unified how devices from different vendors present information about global position, speed, altitude, and other navigational data. The protocol defines how a message is formatted.

Two common NMEA messages are GPGGA (Global Positioning System Fix Data) and GPVTG (Track Made Good and Ground Speed).

GPGGA – GPS Fixed Data. Time, Position, and fix related data

The sentence GPGGA is used by GPS devices to transmit their location. The general format of this sentence is:

$GPGGA,TIM,LAT,N/S,LONG,E/W,FIX,SAT,HDOP,ALT,M,GSEP,M,AGE,ID,*CS
  • TIM, HHMMSS.SSS: Time in hours, minutes and seconds (UTC),
  • LAT, Latitude expressed as DDMM.MMMM degrees,
  • N or S, north or south,
  • LONG: Longitude expressed as DDDMM.MMMM degrees,
  • E or W, east or west,
  • FIX, Position fix indicator (0- fix not obtained, 1- GPS fix, 2- Differential GPS fix),
  • SAT, Number of satellites used to compute position,
  • HDOP, Horizontal Dilution of Precision
  • ALT, MSL Altitude, Antenna altitude above/below mean-see-level
  • Unit, M, metres
  • GSEP, Geoidal Separation, metres
  • Unit, M, metres,
  • AGE, age of correction data, seconds,
  • ID, identification number of differential base station, empty when DGPS is not used,
  • *CS, Checksum in hexadecimal representation,
  • <CR><LF>, carrier return and new line.

An example NMEA sentence would be the following:

$GPGGA,064951.000,2307.1256,N,12016.4438,E,1,8,0.95,39.9,M,17.8,M,,*65

GPVTG – Course and speed information relative to the ground

On the other hand, the GPVTG message provides information about the track made good (TMG) and the speed of the ground. This message is typically used in conjunction with the GPRMC message to provide a more complete picture of the vessel’s status. The GPVTG message provides essential information for navigation and autopilot systems, allowing them to adjust their course based on the vessel’s actual position and speed. The GPVTG message includes:

$GPVTG,COURSE,T,COURSE,M,SPEED,N,SPEED,K,MODE*CS<CR><LF>
  • COURSE, Measured heading (degrees from true north),
  • T, True north,
  • COURSE, Measured heading (magnetic),
  • M, magnetic,
  • SPEED, Horizontal speed measured in knots,
  • N, knots,
  • SPEED, horizontal speed measured in km/h,
  • K, km/h,
  • Mode, A Autonomous, D – Differential, E Estimated mode,
  • *CS, Checksum in hexadecimal representation,
  • <CR><LF>, carrier return and new line.

An example of such a frame is available below:

$GPVTG,165.48,T,,M,0.03,N,0.06,K,A*37

How does GPS work?

To successfully estimate a global position, two crucial things are required: time and reference position. These two combined with triangulation allow one to estimate position with a certain degree of precision. However, before we dive into how the GPS works, it is prudent to describe the GPS infrastructure. The Global Positioning System consists of multiple transmitters and a receiver.

Transmitters, satellites, circle the Earth with well-known trajectories. Each satellite is equipped with an atomic clock, which measures time precisely and provides a time reference that does not drift much over very long periods of time.

The receiver is a device that listens to transmitted signals emitted by satellites. An example of such a receiver is available in the content of this post. Most in the space of this module is occupied by the antenna, which is the biggest component of such a module.

Operation Principle

As mentioned above, two conditions have to be fulfilled in order to properly estimate the position. The first condition requires that the time between all satellites be precisely synchronized. Having it as a reference time for all satellites allows us to measure the TOF (Time of Flight). In space, electromagnetic waves are propagated with a constant speed. Taking this into account, the distance between the transmitter (satellite) and receiver (GPS module) can be measured. This distance allows us to place the receiver on the map in reference to the satellites.

The triangulation process requires n+1 transmitters to estimate the position of the receiver in n-dimensional space. Let us imagine a 2D space where we have a single transmitter, as shown below:

If a single satellite were available, only distance from the satellite could be estimated. Therefore, an infinite number of positions are available on the circle. Now, if a second transmitter is added, it greatly limits the number of possible positions.

In this case, when two satellites are available, two intersection points are possible. Of course, there are other cases where a different number of common points is possible:

  • No points at all; when two circles do not cross each other at all;
  • A single point; when two circles touch each other;
  • Two points, as presented above; when they overlap,
  • An infinite number of points; when two circles exactly overlap each other and have the same radius.

The last situation is physically impossible since the two satellites would need to be in the exact same place. When triangulation is considered, we need to have a finite number of intersections. In the case where there is a single intersection point, there is no need for another transmitter. However, this situation is very rare, and the multitude of satellites surrounding Earth are following precise trajectories that aim at covering as much area as possible.

In the case of two intersection points, you can estimate your position to be either the first or the second one. As can be seen, adding another satellite constrains the search area, giving us only some limited options. Let us introduce a third satellite.

When there is a third satellite, the position in 2D space can be estimated with a certain degree of precision. If a 3D position is required, then four transmitters providing data to a receiver are necessary. What is more, to estimate the position, a good estimation of time is also needed. The receiver usually does not have its own time source, which would be required to estimate the position. In turn, another satellite is needed to introduce time correction to get a better position estimation. In the end, to estimate a 3D position, a set of five satellites is required. To increase the accuracy of the estimation, more data is required; thus, more visible satellites are necessary.

One other aspect is that, despite the fact that there are many available satellites transmitting the signal, you do not use all of them. Some might not be visible for a particular GPS receiver. What is more, some areas on our planet are scarcely covered with GPS satellites rendering these places GPS signal free, these are the North and South Poles.

Is this enough to estimate the position?

There is one more crucial aspect. Despite the fact that many satellites are available, it is not enough. Each satellite sends its own position relative to Earth. Now, by combining this information with the triangulation process, it is possible to pinpoint the GPS receiver’s position on the planet.

Code and KiCAD project

The electronic design was done in KiCAD and is free to use. It can be downloaded from this website. Initially it was designed using KiCAD 6 but the current archive contains a project compatible with KiCAD 8 with all necessary footprints and symbols.

If you are interested in parsing the NMEA frames you can have a look at my github repository under GPS directory where you will find the library that allows us to parse NMEA frames, GPGGA and GPVTG in particular.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.