Skip to content

GPS

Adafruit ultimate GPS module Figure 1: Adafruit ultimate GPS module

The Adafruit ultimate GPS module allows you to receive data from GPS satellites in order to calculate the location of your project. To work properly, the module needs a clear line of sight to the satellites and it may not work indoors.

The module uses a simple serial connection consisting of a transmit (TX) pin and a receive (RX) pin. The Particle Argon has only one UART and you need to connect the TX pin of the module to the RX pin of the Argon and vice versa as shown in Figure 2.

Adafruit ultimate GPS connection Figure 2: Breadboard layout

For the software, you need to choose the Adafruit_GPS library. You can use the example sketch GPS_HardwareSerial_Parsing.ino to test your hardware setup.

When the sketch is running, you can use the Particle CLI to monitor the serial communications. In a terminal window on your computer, type the following command.

1
particle serial monitor

NB: Make sure that the serial monitor is not running when you try to flash the code to the device. The serial signals from the GPS module may interefere with the process.

If everything is working, you should see a series of data blocks like the one shown below. GPS modules return data as National Marine Electronics Association (NMEA) sentences and the link at the bottom of the page provides some further information. The Adafruit library provides a more readable interpretation of the data.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$GNGGA,140317.000,5556.0221,N,00312.7886,W,2,13,0.87,126.7,M,49.6,M,,*64

$GNRMC,140317.000,A,5556.0221,N,00312.7886,W,0.60,47.64,300323,,,D*52

Time: 14:3:16.0
Date: 30/3/2023
Fix: 1 quality: 2
Location: 5556.0220N, 312.7887W
Speed (knots): 0.84
Angle: 51.41
Altitude: 126.70
Satellites: 14

You may see a few lines with no data when the module first starts up. It may take a few seconds to get a fix on enough satellites to work out a reliable position. In the example above you can see that there are 14 satellites in view.

By default, the latitude and longitude are shown in degrees, minutes and seconds in a slightly odd format. The degrees come first followed by the minutes with no space in between. The seconds are expressed as a decimal fraction of a minute, and the final character shows which direction to take from the equator or the Greenwich meridian. Thus

5556.0220N = 55°, 56', 1" North

312.7887W = 3°, 12', 47" West

This part of the output is generated by the following lines near the end of the sketch.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if (GPS.fix) {
  Serial.print("Location: ");
  Serial.print(GPS.latitude, 4); Serial.print(GPS.lat);
  Serial.print(", ");
  Serial.print(GPS.longitude, 4); Serial.println(GPS.lon);
  Serial.print("Speed (knots): "); Serial.println(GPS.speed);
  Serial.print("Angle: "); Serial.println(GPS.angle);
  Serial.print("Altitude: "); Serial.println(GPS.altitude);
  Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
}

For values in digital degrees, you need to change the code to use a different format for location as shown below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
if (GPS.fix) {
  Serial.print("Location: ");
  Serial.print(GPS.latitudeDegrees);
  Serial.print(", ");
  Serial.println(GPS.longitudeDegrees);
  Serial.print("Speed (knots): "); Serial.println(GPS.speed);
  Serial.print("Angle: "); Serial.println(GPS.angle);
  Serial.print("Altitude: "); Serial.println(GPS.altitude);
  Serial.print("Satellites: "); Serial.println((int)GPS.satellites);
}

For a complete set of ducmnetation on the Adafruit GPS library,please refer to the GitHub documentation.

Using a NEO-6M?

We have moved away from using these units because they are not always reliable. (This might be because we bought cheap ones...)

To use a NEO-6M with the Argon, you need to choose the Particle-GPS library and the example sketch all-data.ino.

The data returned by this unit is made up of one National Marine Electronics Association (NMEA) sentence per line as in the example below.

1
2
3
4
5
6
7
Data[0] = $GPGLL,,,,,,V,N*64
Data[1] = $GPGGA,,,,,,0,00,99.99,,,,,,*48
Data[2] = $GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
Data[3] = $GPGSV,4,1,16,01,,,21,02,,,22,03,,,22,04,,,22*7C
Data[4] = $GPRMC,,V,,,,,,,,,,N*53
Data[5] = $GPVTG,,,,,,,,,N*30
Data[6] = 

Notes

  • $GPGLL: Geographic position, latitude / longitude
  • $GPGGA: Global Positioning System Fix Data
  • $GPGSA: GPS dilution of precision (DOP) and active satellites
  • $GPGSV: GPS satellites in view
  • $GPRMC: Recommended minimum specific GPS/Transit data
  • $GPVTG: Track Made Good and Ground Speed

The example above shows how the output looks before the GPS resolves the location. Line 4 shows that there are 16 satellites in view, but there is no location information in line 1. It may take up to a few minutes for the module to resolve the position at which point the displayed information will look more like that shown below.

1
2
3
4
5
6
7
Data[0] = $GPGLL,5558.14854,N,00309.70605,W,171248.00,A,A*7D
Data[1] = $GPGGA,171248.00,5558.14854,N,00309.70605,W,1,04,4.78,9.8,M,49.8,M,,*43
Data[2] = $GPGSA,A,3,23,24,10,12,,,,,,,,,5.35,4.78,2.42*0B
Data[3] = $GPGSV,2,2,05,24,61,260,44*49
Data[4] = $GPRMC,171248.00,A,5558.14854,N,00309.70605,W,0.224,,031121,,,A*60
Data[5] = $GPVTG,,T,,M,0.224,N,0.416,K,A*24
Data[6] = 

In this example, the $GPGLL sentence can be interpreted as follows:

Element Value Meaning
Sentence identifier $GPGLL Geographic Position, Latitude / Longitude and time
Latitude 5558.14854 55 degrees, 58.14854 minutes
North/South N North
Longitude 00309.70605 3 degrees, 9.70605 minutes
East/West W West
Timestamp 171248.00 17:12:48 UTC
Validity A Valid
Checksum A*7D Error check

The behaviour of the module can be disconcerting when it first starts. The on-board LED only starts to flash once a fix has been obtained. Until then, there is no visible sign that the board is working. If you are looking for reassurance that everything is working correctly, it is therefore better to rely on the data output rather than on the hardware itself.

Adafruit ulitmate GSP breakout reference material Adafruit ulitmate GSP breakout reference material

Interpreting NMEA sentences Interpreting NMEA sentences

NMEA Reference Manual NMEA Reference Manual