Introduction: Connecting GPS-module to Arduino

This is a simple Instructable for the people who'd like to know how to connect and use their GPS module with an Arduino.

I am using an Arduino Duemilanove and an EM-406A GPS module.
NOTE: The breadboard is not necessary but makes the job a lot easier.

Step 1: Customizing the GPS

Firstly, we need to make the GPS useable in our custom environment.

Cut the connecting plug of the furthest side of the GPS' connection wires.
Now it is your choice to extend them with longer wires, make sure to connect them thoroughly.

Remove the plastic off the ends of the wires.

See the images below.

Step 2: Connecting the GPS to the Arduino

Now that your GPS-module is ready, we can go ahead.

Connect your GPS wires to the Arduino like on this schematic below. Where "pin 5" gets used as "TX" and "pin 3" as "RX".

Any available pins on your Arduino may be used. Just be sure to connect the right wire to the right pin.

The gray wire is left aside unconnected.

Step 3: The Coding

Doing the coding for your Arduino is simple, you can copy the sample code and/or edit it for your own use.

This code sends all strings received from the GPS through serial to your computer (Serial Monitor)
Note: See comments in coding for filtering of certain strings
#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;
}

Step 4: Testing

Now that you are setup and ready to run your project, make sure the code has been uploaded to the Arduino and that all wires and connections are rightly fitted.

Switch on the Arduino and switch on your Serial-Monitor. Wait for the message "Started" to appear on your monitor screen. If all your connections are perfect, the red light will be shining stable and you will start seeing messages appear underneath each other.

Remember to scroll down manually if it reaches the end of the screen!

The GPS will only give through the coordinates when the red-onboard light is flashing. (Meaning it has a fix.)

Use your GPS manual to decode these messages. It delivers great data such as coordinates, UTC time, height above sea-level etc.

Have fun and let me know if I made any mistakes!