GPS Module NEO-7M - (GPS / GLONASS Signal)

  • RM55.00

  • Product Code: GPS Module NEO-7M
  • Availability: In Stock

 

Features

  • Concurrent reception of up to GNSS (GPS/QZSS, GLONASS)
  • Able to use GPS as a really accurate clock, this board provides a PPS (pulse per second) signal. This is a highly accurate clock pulse coming off a pin on the GPS that NTP can use. If you have such a GPS the resource below is a must read.
  • Compact and excellent performance
  • Micro USB port, you can use general mobile phone cable to connect this GPS module to your computer. No need USB-TTL, convenient for use
  • Onboard ceramic passive antenna, able to search for the satellite in open area, and an external antenna is optional
  • SMA port, convenient for connecting with the external active antenna, stronger satellite search ability
  • A reserved TTL port, convenient for connecting to USB-TTL or external single chip microcomputer
  • Back-up rechargeable battery
  • UART TTL socket
  • EEprom to save configuration settings
  • Support hot start

 

 

* PPS should be connected to the clock pulse output (CPOUT) of a MCU. This pin is unconnected if GPS module is connected to a computer.

 

 

Connect to an Arduino

/* Connection to UNO
VCC - Arduino 5v
GND - Arduino GND
TXD - Arduino D0
RXD - No connect
PPS - No connect

If want to use this on Leonardo, have to rename all the "Serial" to "Serial1"
*/

char nmeaSentence[68];
String latitude;		//Latitude
String longitude;		//Longitude
String lndSpeed;		//Speed
String gpsTime;		//UTC time, Kuala Lumpur is 8
String klTime;		//KL Time

#define GPSSerial Serial

void setup()
{
  GPSSerial.begin(9600);
  GPSSerial.println("ILoveMCU.taobao.com");
  GPSSerial.println("Wating...");
}

void loop()
{

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)	//Scan for GPS each second
  {
    while (GPSSerial.available())	//Serial reading
    {
      char c = GPSSerial.read();	//Serial reading

      switch(c)					//
      {
      case '$':					//data divided by $
        GPSSerial.readBytesUntil('*', nmeaSentence, 67);		//Store data in nmeaSentence
        //Serial.println(nmeaSentence);
        latitude = parseGprmcLat(nmeaSentence);	//Get Latitude
        longitude = parseGprmcLon(nmeaSentence); //Get Longitude
        lndSpeed = parseGprmcSpeed(nmeaSentence); //Get Speed
        gpsTime = parseGprmcTime(nmeaSentence); //Get GPS time


        if(latitude > "")		//Print if not null
        {
          GPSSerial.println("------------------------------------");
          GPSSerial.println("latitude: " + latitude);
        }

        if(longitude > "")		//Print if not null
        {
          GPSSerial.println("longitude: " + longitude);
        }  

        if(lndSpeed > "")		//Print if not null
        {
          GPSSerial.println("Speed (knots): " + lndSpeed);
        }

        if(gpsTime > "")		//Print if not null
        {
          GPSSerial.println("gpsTime: " + gpsTime);
          klTime = getklTime(gpsTime);	//KL Time
          GPSSerial.println("klTime: " + klTime);        
        }		
      }
    }
  }
}

String getklTime(String s)
{
  int hour = s.substring(0,2).toInt();
  int minute = s.substring(2,4).toInt();
  int second = s.substring(4,6).toInt();

  hour += 8;

  if(hour > 24)
    hour -= 24;
  s = String(hour) +":"+String(minute) +":"+ String(second);
  return s;
}

//Parse GPRMC NMEA sentence data from String
//String must be GPRMC or no data will be parsed
//Return Latitude
String parseGprmcLat(String s)
{
  int pLoc = 0; //paramater location pointer
  int lEndLoc = 0; //lat parameter end location
  int dEndLoc = 0; //direction parameter end location
  String lat;
  /*make sure that we are parsing the GPRMC string. 
   Found that setting s.substring(0,5) == "GPRMC" caused a FALSE.
   There seemed to be a 0x0D and 0x00 character at the end. */
  if(s.substring(0,4) == "GPRM")
  {
    //Serial.println(s);
    for(int i = 0; i < 5; i++)
    {
      if(i < 3) 
      {
        pLoc = s.indexOf(',', pLoc+1);
        /*Serial.print("i < 3, pLoc: ");
         Serial.print(pLoc);
         Serial.print(", ");
         Serial.println(i);*/
      }
      if(i == 3)
      {
        lEndLoc = s.indexOf(',', pLoc+1);
        lat = s.substring(pLoc+1, lEndLoc);
        /*Serial.print("i = 3, pLoc: ");
         Serial.println(pLoc);
         Serial.print("lEndLoc: ");
         Serial.println(lEndLoc);*/
      }
      else
      {
        dEndLoc = s.indexOf(',', lEndLoc+1);
        lat = lat + " " + s.substring(lEndLoc+1, dEndLoc);
        /*Serial.print("i = 4, lEndLoc: ");
         Serial.println(lEndLoc);
         Serial.print("dEndLoc: ");
         Serial.println(dEndLoc);*/
      }
    }
    return lat; 
  }
  //}
  //}
}

//Parse GPRMC NMEA sentence data from String
//String must be GPRMC or no data will be parsed
//Return Longitude
String parseGprmcLon(String s)
{
  int pLoc = 0; //paramater location pointer
  int lEndLoc = 0; //lat parameter end location
  int dEndLoc = 0; //direction parameter end location
  String lon;

  /*make sure that we are parsing the GPRMC string. 
   Found that setting s.substring(0,5) == "GPRMC" caused a FALSE.
   There seemed to be a 0x0D and 0x00 character at the end. */
  if(s.substring(0,4) == "GPRM")
  {
    //Serial.println(s);
    for(int i = 0; i < 7; i++)
    {
      if(i < 5) 
      {
        pLoc = s.indexOf(',', pLoc+1);
        /*Serial.print("i < 3, pLoc: ");
         Serial.print(pLoc);
         Serial.print(", ");
         Serial.println(i);*/
      }
      if(i == 5)
      {
        lEndLoc = s.indexOf(',', pLoc+1);
        lon = s.substring(pLoc+1, lEndLoc);
        /*Serial.print("i = 3, pLoc: ");
         Serial.println(pLoc);
         Serial.print("lEndLoc: ");
         Serial.println(lEndLoc);*/
      }
      else
      {
        dEndLoc = s.indexOf(',', lEndLoc+1);
        lon = lon + " " + s.substring(lEndLoc+1, dEndLoc);
        /*Serial.print("i = 4, lEndLoc: ");
         Serial.println(lEndLoc);
         Serial.print("dEndLoc: ");
         Serial.println(dEndLoc);*/
      }
    }
    return lon; 
  }
}

//Parse GPRMC NMEA sentence data from String
//String must be GPRMC or no data will be parsed
//Return Longitude
String parseGprmcSpeed(String s)
{
  int pLoc = 0; //paramater location pointer
  int lEndLoc = 0; //lat parameter end location
  int dEndLoc = 0; //direction parameter end location
  String lndSpeed;

  /*make sure that we are parsing the GPRMC string. 
   Found that setting s.substring(0,5) == "GPRMC" caused a FALSE.
   There seemed to be a 0x0D and 0x00 character at the end. */
  if(s.substring(0,4) == "GPRM")
  {
    //Serial.println(s);
    for(int i = 0; i < 8; i++)
    {
      if(i < 7) 
      {
        pLoc = s.indexOf(',', pLoc+1);
        /*Serial.print("i < 8, pLoc: ");
         Serial.print(pLoc);
         Serial.print(", ");
         Serial.println(i);*/
      }
      else
      {
        lEndLoc = s.indexOf(',', pLoc+1);
        lndSpeed = s.substring(pLoc+1, lEndLoc);
        /*Serial.print("i = 8, pLoc: ");
         Serial.println(pLoc);
         Serial.print("lEndLoc: ");
         Serial.println(lEndLoc);*/
      }
    }
    return lndSpeed; 
  }
}


//Parse GPRMC NMEA sentence data from String
//String must be GPRMC or no data will be parsed
//Return Longitude
String parseGprmcTime(String s)
{
  int pLoc = 0; //paramater location pointer
  int lEndLoc = 0; //lat parameter end location
  int dEndLoc = 0; //direction parameter end location
  String gpsTime;

  /*make sure that we are parsing the GPRMC string. 
   Found that setting s.substring(0,5) == "GPRMC" caused a FALSE.
   There seemed to be a 0x0D and 0x00 character at the end. */
  if(s.substring(0,4) == "GPRM")
  {
    //Serial.println(s);
    for(int i = 0; i < 2; i++)
    {
      if(i < 1) 
      {
        pLoc = s.indexOf(',', pLoc+1);
        /*Serial.print("i < 8, pLoc: ");
         Serial.print(pLoc);
         Serial.print(", ");
         Serial.println(i);*/
      }
      else
      {
        lEndLoc = s.indexOf(',', pLoc+1);
        gpsTime = s.substring(pLoc+1, lEndLoc);
        /*Serial.print("i = 8, pLoc: ");
         Serial.println(pLoc);
         Serial.print("lEndLoc: ");
         Serial.println(lEndLoc);*/
      }
    }
    return gpsTime; 
  }
}

// Turn char[] array into String object
String charToString(char *c)
{

  String val = "";

  for(int i = 0; i <= sizeof(c); i++) 
  {
    val = val + c[i];
  }

  return val;
}


More tutorial  

Write a review

Note: HTML is not translated!
    Bad           Good