Picture of 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.
Remove these adsRemove these ads by Signing Up

Step 1: Customizing the GPS

Picture of 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

Picture of 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

// GPS Setup
#define rxGPS 3
#define txGPS 5
SoftwareSerial serialGPS = SoftwareSerial(rxGPS, txGPS);
String stringGPS = "";

void setup() {
  pinMode(rxGPS, INPUT);
  pinMode(txGPS, OUTPUT);


  // GPS Setup

  // Cut first gibberish
    if ( == '\r')

void loop()
  String s = checkGPS();
  if(s && s.substring(0, 6) == "$GPGGA")

// Check GPS and returns string if full line recorded, else false
String checkGPS()
  if (serialGPS.available())
    char c =;
    if (c != '\n' && c != '\r')
      stringGPS  = c;
      if (stringGPS != "")
        String tmp = stringGPS;
        stringGPS = "";
        return tmp;
  return false;
dinuclt2 months ago

need more detailed informations

isaacp16 months ago

help! i try to upload the code but i just get a massage: 'software serial' does not name a type. What does this mean? and more importantly, how can I fix it?

Alti3 years ago
Hi - Thanks for replying. Yeah everything is connected OK. Something very odd going on, anyway I now get the 'Started' message in the serial monitor, but that's it. It never budges beyond that!

Similar to the issue here http://www(dot)sparkfun(dot)com/tutorials/173#
whereby it just sits 'waiting for lock' even though I know it has a lock and works fine. Very strange.

Also the driver that I used can also be used with the above GPS module to get it working in Autoroute or whatever s/f needs a usb GPS unit, just add a cable to it.
Machman2823 Alti6 months ago

Same here, it just says "Started".

I am using an Arduino Mega 2560 board with a ircirocomm gps module (it has "595k" written on it if that helps)

Hi, I tried to upload this code to my arduino mega and it gave the error message ('SoftwareSerial' does not name a type)

Any Ideas on how to fix this?

add #include <SoftwareSerial.h>

Thanks for your instructable! I am currently trying to connect an old Garmin GPS 12CX to my Arduino. I have copied your code as is and when I try to upload it from the Arduino software I get the following error message: "invalid conversion from 'char' to 'const char*'" when compiling the code. Any ideas why?

I got the sketch to compile by changing that line to the following:

String stringGPS = String(c);


Thanks, I'll have a look what it does when I change it!

Also, I've since got my GPS to work using the following sketch:

And you'll need to add the TinyGPS library as well (



plz help me by uplaading the same code i am gotting the compliling error,

i dont know where the error coming from

Sansanito11 months ago

For me the code works, but with some modifications.
On this segment

[if (c != '\n' && c != '\r')
stringGPS = c; }]

change [stringGPS = c;] to [stringGPS += c;]

In the last code line, change [return false] to [return "" ]

(all without the "[ ]")

Sorry for my bad english.

hi, actually i am having problem with my "Robokit GPS02",dont know why it is not working...Can any one help me...please it urgent......Hoping to see reply soon.
aa103082 years ago
I use your code but all I see just that "ÿø†xxx†à†à†à†à†"

Is it normal?? Or I just forgot something to write??
aa10308 aa103082 years ago
And where could I find "string.h" and "ctype.h"??
cattwood3 years ago
Thanks this was really helpful (to know that it is possible to hook the EM406A directly to the Arduino) but the pin references are confusing, if you hook it up as described above your Arduino will shut down. This happend to me, luckily nothing blew but it just goes to show how important it is to check the specifications PDF before hooking +5 V --- so the +5v goes on pin 2 of the Gps VCC in the spec,( The grey wire is pin 1 of the GPS which as described does not need to be connected. so if looking at the EM406a GPS as described about the pins are (from top to bottom ), Grey wire = Pin 1 - GND, Pin 2, VCC (ie +5 from the Arduino), Pin 3 RX, Pin 4 TX,
Alti3 years ago
Hi - I merely get strings of 'ðððððððððøðððððð' using your code.

I have the same setup as you.

My Module is OK as when I use the driver for this GPS module (Google BU-353 and USGlobalSat ) and connect via a USB cable to a windows box, all is well, I can read NMEA sentences in hyper-terminal. Bur for the life of me I cannot get this GPS module to work with an Arduino,

I took my GPS unit out of a USGlobalSat USB device, which is just an Em-406a in plastic attached to a USB cable and comes with a driver, so it works fine with Microsoft Autoroute for instance...but following your instructions, I cannot get anything but the above garbage..! Any one else get this working..? Thanks.

louwhopley (author)  Alti3 years ago
Hi. Are you sure you are connecting the correct wires to correct pins and it's directly from the device? Not through some other chips first. I.e. the wires coming from the Em-406a connected directly to Arduino.

I use this instructable for myself every time I start a new GPS project (since I forget how to do this stuff) So these instructions works if you follow them correctly.