Go Down

Topic: Arduino GPS Shield (Read 34906 times) previous topic - next topic

Johnny D

Dexter Industries Arduino GPS Shield


We have had a few customers buy this on Amazon and through other vendors and we wanted to make sure the code was out there.  The GPS shield uses Digital Pins 3 and 4 for serial communications with the GPS unit, freeing up the serial lines on Pins 0, 1 for communications with the computer.  This makes debugging a lot easier.

This requires some slightly different code than the typical GPS tutorial offers.  So we've modified it here below.

You can download the code from our website, but we thought we'd paste it here to make it easier to find:



 Listen for the $GPRMC string and extract the GPS location data from this.
 Display the result in the Arduino's serial monitor.
 For use with the Dexter Industries GPS Shield.  
 This code was a modification of code found on the Arduino website.
 SoftwareSerial Library:  http://www.arduino.cc/en/Reference/SoftwareSerial
 GPS Tutorial:  http://www.arduino.cc/playground/Tutorials/GPS

#include <string.h>
#include <ctype.h>
#include <SoftwareSerial.h>
// Software serial TX & RX Pins for the GPS module
#define SoftrxPin 3
#define SofttxPin 4
// Initiate the software serial connection
SoftwareSerial gpsSerial = SoftwareSerial(SoftrxPin, SofttxPin);

int ledPin = 13;                  // LED test pin
int rxPin = 0;                    // RX PIN
int txPin = 1;                    // TX TX
int byteGPS=-1;
char linea[300] = "";
char comandoGPR[7] = "$GPRMC";
int cont=0;
int bien=0;
int conta=0;
int indices[13];

void setup() {
  pinMode(ledPin, OUTPUT);       // Initialize LED pin
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  gpsSerial.begin(9600); //start serial for communication with GPS
  for (int i=0;i<300;i++){       // Initialize a buffer for received data
    linea=' ';

void loop() {
  digitalWrite(ledPin, HIGH);
  byteGPS=gpsSerial.read(); //read a byte from the serial port
  if (byteGPS == -1) {           // See if the port is empty yet
  else {
    linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
    Serial.print(byteGPS, BYTE);
    if (byteGPS==13){            // If the received byte is = to 13, end of transmission
      digitalWrite(ledPin, LOW);
      for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
        if (linea==comandoGPR[i-1]){
      if(bien==6){               // If yes, continue and process the data
        for (int i=0;i<300;i++){
          if (linea==','){    // check for the position of the  "," separator
          if (linea=='*'){    // ... and the "*"
        Serial.println("");      // ... and write to the serial port
        for (int i=0;i<12;i++){
          case 0 :
            Serial.print("Time in UTC (HhMmSs): ");
          case 1 :
            Serial.print("Status (A=OK,V=KO): ");
          case 2 :
            Serial.print("Latitude: ");
          case 3 :
            Serial.print("Direction (N/S): ");
          case 4 :
            Serial.print("Longitude: ");
          case 5 :
            Serial.print("Direction (E/W): ");
          case 6 :
            Serial.print("Velocity in knots: ");
          case 7 :
            Serial.print("Heading in degrees: ");
          case 8 :
            Serial.print("Date UTC (DdMmAa): ");
          case 9 :
            Serial.print("Magnetic degrees: ");
          case 10 :
            Serial.print("(E/W): ");
          case 11 :
            Serial.print("Mode: ");
          case 12 :
            Serial.print("Checksum: ");
          for (int j=indices;j<(indices[i+1]-1);j++){
      conta=0;                    // Reset the buffer
      for (int i=0;i<300;i++){    // 
        linea=' ';             



I'm new on Arduino and I want to start working with on a GPS project.

I would like to have the Arduino GPS and SMS (GPS) capable, also I would like it to record a log of coordinates as well as some other info as time in i.e. then it needs to be able to download the log to my PC using Bluetooth so I will build a route map on my PC track system (working in the development too).

What Arduino board and shields do you recommend me to buy for my prototype?

Thank in advance for your help.



hello..im new in arduino..im using arduino mega 1280..im trying to display the longitude and the mag. at 20x4 lcd..btw,im using gps shield v1.0...need others connection between arduino board and gps shield?because i just stack them together...is lcd.print=serial print command?plssss help me,can someone provide me the coding...


Mega 1280, LCD, GPS, and newbie are not 4 terms that belong in the same post.

is lcd.print=serial print command?

Depending on what class lcd is an instance of the print() method may actually come from the Print class. The Serial.print() method does come from the Print class. In that sense, they are the same. Where the data that gets printed goes to is quite different, so in that sense they are not the same.

plssss help me

Ok. That's spelled please.

can someone provide me the coding...

Coding for what? Which GPS do you have? On which pins/serial port? Which LCD do you have? On which pins? This is not a start from scratch project. This is a built it up as you add hardware project. Writing GPS data to the LCD is exactly the same as writing "Hello, world" to the LCD. If you can't get "Hello world" on the LCD. put the GPS back in the box, and put it away, until you can.
The art of getting good answers lies in asking good questions.


hello..sorry for my silly question and my broken English..ive no problem displaying hello world, i've trying to modified the coding from arduino tutorial...im using Charactor LCD Module (20 x 4 lines, LED Backlight) and GPS shield v1.0(MYD1094 model) with active antenna...i need the examples coding to display the gps data on the lcd..and how to communicate the GPS shield to my arduino..


i've trying to modified the coding from arduino tutorial

I'm pretty sure that there is more than one Arduino tutorial on the internet. Can you be just a teensy bit more specific?

im using Charactor LCD Module (20 x 4 lines, LED Backlight)

Which you can write to, so you know that it is connected correctly and is functioning.

and GPS shield v1.0(MYD1094 model) with active antenna

I've clicked all over your post. Nothing happens. The internet must be down. I'll try again later.

i need the examples coding to display the gps data on the lcd

Code: [Select]

and how to communicate the GPS shield to my arduino

As soon as the internet comes back up, or you post a link...
The art of getting good answers lies in asking good questions.


Cool story bro, When i get my arduino im getting this!

Johnny D

I've been working on a few updates to our Arduino GPS Shield.

First: we have a new set of GPS Libraries.  They're located here:  http://dexterindustries.com/Arduino-GPS_Shield.html

Next: I did a quick post about how to convert GPS coordinates from GPS format into decimal-degrees.  There is example code that's (mildly) documented: http://dexterindustries.com/howto/arduinogpsprojects-gps-coordinates/

Finally: We have a great new color and design:


Hi everyone!

Here is another Arduino GPS Shield from ITEAD Studio: http://imall.iteadstudio.com/im120417017.html




Adafruit: The Ultimate GPS

Johnny D

We have updated the GPS shield to include Mega, Duo, and Leonardo.

And a picture of our latest build!


and what is the improvement of this version?

Johnny D

Nov 02, 2012, 05:53 pm Last Edit: Nov 02, 2012, 11:27 pm by Johnny D Reason: 1
One really big one:  we've added solder jumpers on the bottom that let you use it with the Mega version of the Arduino.  You can use these to use a different set of communication lines if you need the original lines for your project.  

If this sounds confusing, we have added the schematic and board drawings:  http://dexterindustries.com/files/GPS_Shield_2.0.zip

Another one: the software and examples were updated for the latest Arduino 1.0.1.  We added a few examples and additional calculations that let you calculate distances to destinations and times easier: http://dexterindustries.com/files/dGPS.zip


both links point to the same zip file with .sch and .brd
the link to the examples is missing.

BUT it's still incompatible with the 3.3V specification of the GPS receiver!


How do you figure ursm?

?Input Voltage: 3.0V ~ 5.5V DC
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up