GPS neo-6m

A library for Arduino

GPS neo-6m Arduino Library

Mail: steib.cris@gmail.com

Copyright (c) 2017 Cristian Steib

About library

The library arises from the need to simplify the use of the module, using the NMEA standart.
It does not generate excess memory consumption, it is implemented with own functions to handle the pointers of the buffers.

CONSTRUCTORS Notes
Gpsneo () Rx , Tx and baudrate by default
Gpsneo (rx, tx) Rx and Tx set by user. Baudrate by default
Gpsneo (rx, tx, baudrate) Rx, Tx, baudrate set by user.
Methods Notes
Google (char *link) Gives a link for google maps.
getDataGPRMC () To see the parameters look at the examples
convertLongitude (char *longitude,char *destination) Converts the longitude given by the read NMEA, to grades.
convertLatitude (char *longitude,char *destination) Converts the latitude given by the read NMEA, to grades.

- How to get data with getDataGPRMC()

$GPRMC - Recommended minimum specific GPS/Transit data
an example of a normal sentence:

  • $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62
  • $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68
  • 225446 Time of fix 22:54:46 UTC
  • A Navigation receiver warning (A = OK, V = warning)
  • 4916.45,N Latitude 49 deg. 16.45 min North = 49°16'45''
  • 12311.12,W Longitude 123 deg. 11.12 min West = 123°11'12''
  • 000.5 Speed over ground, Knots
  • 054.7 Course Made Good, True
  • 191194 Date of fix 19 November 1994
  • 020.3,E Magnetic variation 20.3 deg East
  • *68 mandatory checksum

Info:

The knot (kn) is a unit of speed equal to one nautical mile (1.852 km) per hour, approximately 1.151 mph.
The checksum field consists of a '*' and two hex digits representing an 8 bit exclusive OR of all characters between, but not including, the '$' and '*'.



#include <SoftwareSerial.h>
#include <Gpsneo.h>

Gpsneo gps; // Call the contructor for the Class.
char time[10];
char status[2];
char latitud[15];
char latitudHemisphere[2];
char longitud[15];
char longitudMeridiano[15];
char speedKnots[10];
char trackAngle[8];
char date[10];
char magneticVariation[10];
char magneticVariationOrientation[2];


void  setup()
{
    Serial.begin(9600);
}
void loop()
{
    //Just simple do getDataGPRMC, and the method solve everything.
    gps.getDataGPRMC(
                     time,status, latitud, latitudHemisphere, longitud,
                     longitudMeridiano, speedKnots,trackAngle, date,
                     magneticVariation, magneticVariationOrientation
                     );

   Serial.println(time);
   Serial.println(status);
   Serial.println(latitud);
   Serial.println(latitudHemisphere);
   Serial.println(longitud);
   Serial.println(longitudMeridiano);
   Serial.println(speedKnots);
   Serial.println(trackAngle);
   Serial.println(date);
   Serial.println(magneticVariation);
   Serial.println(magneticVariationOrientation);
}

    

-And if you don't want so much information



#include <SoftwareSerial.h>
#include <Gpsneo.h>

Gpsneo gps;


char latitud[15];
char latitudHemisphere[2];
char longitud[15];
char longitudMeridiano[15];

void  setup()
{
    Serial.begin(9600);
}

void loop()
{
    gps.getDataGPRMC(latitud,latitudHemisphere,longitud,longitudMeridiano);

    Serial.println(latitud);
    Serial.println(latitudHemisphere);
    Serial.println(longitud);
    Serial.println(longitudMeridiano);
}

    

-The Google link Method

This method provides a link to see the place on Google Maps.
Is very easy to use, only need to call the function with the parameter.

Code:


#include <SoftwareSerial.h>
#include <Gpsneo.h>

Gpsneo gps;
/*warning is too important that the
size of array don't be minor than they need!
 */
char link[60];

void  setup()
{
    Serial.begin(9600);
}

void loop()
{
    gps.Google(link);

}

Output:


Serial Port Output:

http://www.google.com/maps/place/-34.9140170,-57.9377400
http://www.google.com/maps/place/-34.9140240,-57.9376560
http://www.google.com/maps/place/-34.9140240,-57.9376560
http://www.google.com/maps/place/-34.9140240,-57.9375800
http://www.google.com/maps/place/-34.9139980,-57.9376300
http://www.google.com/maps/place/-34.9139980,-57.9376300
...
...
...







 

The function is responsible for performing all the actions necessary to obtain the link. It must be taken into account that the realization of the reading weft, the obtained data corresponds to the protocol NMEA, so the latitud comes in the format ddmm.mmmmm, what is dd°mm'mmmm'', and for longitude in dddmm.mmm, ddd°mm'mmm'' therefore it is converted to dd.ddddd for Google Maps to understand this. The convertion of these units is obtained from another method of the library.