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.
#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); Serial.begin(9600);
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() {
//delay(1000);*
digitalWrite(ledPin, HIGH);*
byteGPS=gpsSerial.read(); //read a byte from the serial port*
if (byteGPS == -1) { // See if the port is empty yet*
delay(100);*
} *
else {*
linea[conta]=byteGPS; // If there is serial port data, it is put in the buffer*
conta++; *
_ Serial.print(byteGPS, BYTE);_
if (byteGPS==13){ // If the received byte is = to 13, end of transmission*
digitalWrite(ledPin, LOW);*
cont=0;*
bien=0;*
for (int i=1;i<7;i++){ // Verifies if the received command starts with $GPR*
_ if (linea*==comandoGPR[i-1]){_
_ bien++;_
_ }_
_ }_
_ 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*
* indices[cont]=i; cont++; } if (linea==''){ // ... and the "" indices[12]=i; cont++; } } Serial.println(""); // ... and write to the serial port_ _ Serial.println(""); Serial.println("---------------"); for (int i=0;i<12;i++){ switch(i){ case 0 : Serial.print("Time in UTC (HhMmSs): "); break; case 1 : Serial.print("Status (A=OK,V=KO): "); break; case 2 : Serial.print("Latitude: "); break; case 3 : Serial.print("Direction (N/S): "); break; case 4 : Serial.print("Longitude: "); break; case 5 : Serial.print("Direction (E/W): "); break; case 6 : Serial.print("Velocity in knots: "); break; case 7 : Serial.print("Heading in degrees: "); break; case 8 : Serial.print("Date UTC (DdMmAa): "); break; case 9 : Serial.print("Magnetic degrees: "); break; case 10 : Serial.print("(E/W): "); break; case 11 : Serial.print("Mode: "); break; case 12 : Serial.print("Checksum: "); break; } for (int j=indices;j<(indices[i+1]-1);j++){ Serial.print(linea[j+1]); } Serial.println(""); } Serial.println("---------------"); delay(10000); } conta=0; // Reset the buffer* * for (int i=0;i<300;i++){ // linea=' '; } } } } [/quote]_ GPS_from_Dexter_Industries_Example_Code.pde (3.89 KB)*
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?
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.
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..
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.
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
We've been running it in this configuration for 2 years with no problems. The levels may be 3.3V but they're certainly compatible with the Arduino digital pins.
Hello world
Last week I buy dexter industries GPS shield. I tyied to run it with arduino mega adk. I can't read GPS data over serial communication. I read that on arduino mega I must change jumper from 3 to some high pin (10,11,12) but with no success. I also tryed all examples over internet but also with no result.
please help.
Hi,
i make a quadcopter. I want to control the QC over the internet. On board I have arduino mega adk + GPS shield and android phone.
I write android program that control the motors over usb, send back gps data to the server and receive command from web.
I can see QC position on my laptop and can send commands like "goto <latitude, longtitude> etc. (sorry for my bad english)