GPS Module NEO-6M w/ PPS (pulse per second) Signal & Ceramic Antenna
-
RM50.00
- Product Code: GPS Module NEO-6M U-blox PPS
- Availability: In Stock
The Ubox NEO-6M gps engine on this board is a quite good one, with high precision binary output. It has also high sensitivity for indoor applications. The gps module have a battery for power backup and EEprom for storing configuration settings.
The antenna is connected to module through ufl cable which allow for flexibility in mounting the gps such that the antenna will always see the sky for best performance. This make it powerful to use with cars and other mobile applications.
Features
Specifications
* 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.
/* 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