Introduction
- Arduino Mega 2560
- GPS
- BreadBoard
- Hook-Up Wires
GPS

Figure1: GPS
- The Global Positioning System (GPS) is a satellite-based navigation system made up of a network of 24 placed satellites.
- GPS works in any weather conditions, anywhere in the world, 24 hours a day.
- There are no subscription fees or setup charges to use GPS.
Connection:
- Connect the Gnd and 2nd pin to the Gnd of the Arduino Mega 2560.
- Connect the Vcc to the 5V of the Arduino Mega 2560.
- Connect the 3rd pin to the Digital pin of 3 on the board.
- Connect the 4th pin to the digital pin of 5 on the board.
Programming
- #include
- // GPS Setup
- # define rxGPS 3# define txGPS 5
- SoftwareSerial serialGPS = SoftwareSerial(rxGPS, txGPS);
- String stringGPS = "";
- void setup() {
- pinMode(rxGPS, INPUT);
- pinMode(txGPS, OUTPUT);
- Serial.begin(9600);
- Serial.println("Started");
- // GPS Setup
- serialGPS.begin(4800);
- digitalWrite(txGPS, HIGH);
- // Cut first gibberish
- while (serialGPS.available())
- if (serialGPS.read() == '\r')
- break;
- }
- void loop()
- {
- String s = checkGPS();
- if (s && s.substring(0, 6) == "$GPGGA")
- {
- Serial.println(s);
- }
- }
- // Check GPS and returns string if full line recorded, else false
- String checkGPS()
- {
- if (serialGPS.available())
- {
- char c = serialGPS.read();
- if (c != '\n' && c != '\r')
- {
- stringGPS = c;
- } else
- {
- if (stringGPS != "")
- {
- String tmp = stringGPS;
- stringGPS = "";
- return tmp;
- }
- }
- }
- return false;
- }
Explanation:
In this I have explained the location where GPS is fixed and then you can get information in the serial monitor.
Output

Figure2: Output
Read more articles on Arduino:

Sr KarthigaPosted May 25, 2016, 8:25 AM
thank you prasanna
Sr KarthigaPosted May 25, 2016, 8:25 AM
thank you santhakumar sir
Sr KarthigaPosted May 25, 2016, 8:25 AM
thank you kumaresh
Santhakumar MunuswamyPosted May 21, 2016, 2:37 AM
Thank you for nice work
Prasanna MuraliPosted May 20, 2016, 10:16 AM
Nice one...
Kumaresh RajalingamPosted Apr 9, 2016, 2:31 AM
Good one
Sr KarthigaPosted Apr 7, 2016, 10:10 PM
Thank you mohammed sir
Sr KarthigaPosted Apr 7, 2016, 10:09 PM
Thank you gowtham sir
Sr KarthigaPosted Apr 7, 2016, 10:08 PM
Thank you debasis saha sir
Sr KarthigaPosted Apr 7, 2016, 10:08 PM
Thank you vignesh sir
Mohammed IbrahimPosted Apr 4, 2016, 1:23 PM
nice
Gowtham KPosted Apr 4, 2016, 12:36 PM
Nice share:)
Debasis SahaPosted Apr 4, 2016, 4:06 AM
Good One..
Vignesh ManiPosted Apr 4, 2016, 4:02 AM
Good one