General considerations

The Waspmote GPS library works with NMEA sentences for getting coordinates. By default, NMEA mode will be used to obtain the GPS information.

Waspmote libraries

Waspmote GPS files

WaspGPS.h ; WaspGPS.cpp

It is mandatory to include the GPS library when using this module. The following line must be introduced at the beginning of the code:

#include <WaspGPS.h>

Constructor

To start using the Waspmote GPS library, an object from class WaspGPS must be created. This object, called GPS, is created inside the Waspmote GPS library and it is public to all libraries. It is used through the guide to show how the Waspmote GPS library works.

When creating this constructor, some variables are defined with a value by default, that can be modified later. These variables are:

  • flag: init the flag with nothing (ACK value by default)

  • commMode: shows the communication mode, NMEA by default

  • pwrMode: powers on GPS module by default

The UART and Baudrate used by default are UART_1 and 4800 bps.

Error messages

When executing some functions, a value is returned explaining the error occurred using the GPS module. The possible values depend on each specific function.

  • “error: the GPS timed out” : the GPS timed out while waiting for a string.

GPS communication modes

There are two communication modes: binary (OSP) and NMEA. A variable called commMode has been created for indicating the communication mode is being used. The possible values are:

  • 0 : OSP_MODE: Binary mode is being used

  • 1 : NMEA_Mode: NMEA mode is being used

By default, the GPS module is in NMEA mode, where the default output is as follows:

$GPRMC,112443.000,A,4140.8596,N,00053.1827,W,0.00,161.29,220813,,,A*7C
$GPGGA,112444.000,4140.8596,N,00053.1827,W,1,06,2.0,207.8,M,51.6,M,,0000*4A
$GPGSA,A,3,25,12,14,24,02,31,,,,,,,2.6,2.0,1.7*35
$GPRMC,112444.000,A,4140.8596,N,00053.1827,W,0.00,161.29,220813,,,A*7B
$GPGGA,112445.000,4140.8596,N,00053.1827,W,1,06,1.9,207.8,M,51.6,M,,0000*41
$GPGSA,A,3,25,12,14,24,02,31,,,,,,,2.6,1.9,1.7*3F
$GPRMC,112445.000,A,4140.8596,N,00053.1827,W,0.00,161.29,220813,,,A*7A
$GPGGA,112446.000,4140.8596,N,00053.1827,W,1,06,1.9,207.8,M,51.6,M,,0000*42
$GPGSA,A,3,25,12,14,24,02,31,,,,,,,2.6,1.9,1.7*3F
$GPRMC,112446.000,A,4140.8596,N,00053.1827,W,0.00,161.29,220813,,,A*79
$GPGGA,112447.000,4140.8596,N,00053.1827,W,1,06,1.9,207.8,M,51.6,M,,0000*43
$GPGSA,A,3,25,12,14,24,02,31,,,,,,,2.6,1.9,1.7*3F
$GPRMC,112447.000,A,4140.8596,N,00053.1827,W,0.00,161.29,220813,,,A*78
$GPGGA,112448.000,4140.8596,N,00053.1827,W,1,06,1.9,207.8,M,51.6,M,,0000*4C
$GPGSA,A,3,25,12,14,24,02,31,,,,,,,2.6,1.9,1.7*3F
$GPGSV,3,1,12,25,67,302,51,12,54,047,48,14,47,284,49,24,40,120,41*77
$GPGSV,3,2,12,02,21,087,45,31,13,306,38,29,63,160,,27,59,118,*72
$GPGSV,3,3,12,30,57,284,,15,48,261,,09,47,119,,21,03,157,*78

The previous output is repeated every five seconds, where the GPRMC, GPGGA and GPGSA sentences are received four times, while the GPGSV information is received only once.

GPS start

The GPS module needs to recognize satellites before start working. Connecting to satellites is a process that may take some time, typically less than 35 seconds with good signal quality. This time can be reduced if ephemeris are used. See "Ephemeris handling" section for more information.

To know if the position is fixed or not, the field know as "status" in the GPRMC sentence is used. If this field is \'A\', the data is valid while if it is \'V\' the data is still not valid. This process is carried out by the parseRMC function, used in waiForSignal() function, which is described below.

Last updated