Parallax GPS and Arduino w/Small Wiring Question

Interfacing the Arduino with a GPS unit. Specifically, a Parallax PMB-688 GPS unit. Duelmilanove, ATmega328, 0018.

[Parallax Store] [Simplistic DataSheet (~122KB)]

For any more information you can look at this thread located at Parallax forums. It's only one page, only reason I am here is because they can't help me with "non-parallax" products. .. The Arduino part. [Link]

Could use some help setting this up. I have taken a look at multiple ways but have come up with nothing but the arduino outputting (-1, -1, -1, -1, repeating...)

Including [NMEA::wiring library] which leads me into my second question.

Where can I purchase the cables found in the demistration photos on this page: [NMEA::wiring library - GPS and LCD ] I seen them and literally said "That's what I have been looking for!". They are not quite ribbon cables because they have nice slitted ends but; they are stuck together!

if serial.read returns -1 that means that there is no data in the serial buffer. either its wired wrong or the gps isnt sending any data. can you post your code?

I tried a number of codes, that are examples or “basic” ones.

[Link]

 /*

 Example code for connecting a Parallax GPS module to the Arduino

 Igor Gonz[ch65533]lez Mart[ch65533]n. 05-04-2007
 igor.gonzalez.martin@gmail.com

 English translation by djmatic 19-05-2007

 Listen for the $GPRMC string and extract the GPS location data from this.
 Display the result in the Arduino's serial monitor.

 */ 

 #include <string.h>
 #include <ctype.h>

 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(4800);
   for (int i=0;i<300;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }   
 }

 void loop() {
   digitalWrite(ledPin, HIGH);
   byteGPS=Serial.read();         // Read a byte of 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[i]==comandoGPR[i-1]){
           bien++;
         }
       }
       if(bien==6){               // If yes, continue and process the data
         for (int i=0;i<300;i++){
           if (linea[i]==','){    // check for the position of the  "," separator
             indices[cont]=i;
             cont++;
           }
           if (linea[i]=='*'){    // ... 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[i];j<(indices[i+1]-1);j++){
             Serial.print(linea[j+1]); 
           }
           Serial.println("");
         }
         Serial.println("---------------");
       }
       conta=0;                    // Reset the buffer
       for (int i=0;i<300;i++){    //  
         linea[i]=' ';             
       }                 
     }
   }
 }

This one returned nothing… Which means it doesn’t even start because of the check in the beginning.

I have wired the GPS using the instructions found in this file (which was supplied by parallax on that thread)
It’s to large to post here, please follow PasteBin link.

Which states I only need three wires connected.

ok. did you connect the tx of the gps to the rx of the arduino. and does your gps have a line of sight to the sky? it can take forever for it to pick up a signal from a cold start if you are inside.

It did not have a line of sight, no. I keep hearing about cold and hot starts. What defines the start? If it has already connected to the satellites?

I had three wires connected, the 5Vcc, 0Vdd, and tx to rx.

Should the code above work just fine with the 688? If so I will try and use it outside.

A cold start is when you first power it up, like starting your pc or a GPS module. Warm start is similar to resetting your pc, it already had power but it received a signal to reset.

I got the same GPS-module last week and today connected it to a Mega though, took a serial-sample included from arduino0018 and it runs just fine.

I doubt taking it outside would make a difference, unless you're in a bunker 1000ft underground. I think you got it wired up fine so maybe it's the software. Maybe try NewSoftSerial? I think it supports your board.

E: Btw, although it will spit out data without a valid signal, just without coordinates, the led indicates if it has a valid signal. If it blinks it doesn't and if it stays on everything is peachy. I'm indoor, packed between bricks, electronics and concrete, without the external antenna it doesn't get a valid signal but with the external antenna it does even when just placed aside the module.

Thanks for the post, just so I can filter out what I am doing wrong could you post your code you used?

That would be really helpful :)

The code i used is Mega only, read 1 serial port and send it out to another (pc or whatever), but with the newsoftserial lib it's about just as easy. http://arduiniana.org/libraries/NewSoftSerial/

There's a sample included, newsoftserialtest, very straight forward i think that may help. From that sample:

NewSoftSerial mySerial(2, 3);

tells which two pins to use for in and output, 1st number is the input-pin number. PMB-688 default baud-rate is 4800.

Hope that helps.

Alright This is what I got:
RXD to dpin3
TXD to dpin2
G to ground
Vc to 5v

And this code on the arduino duemilanove(328)

#include <NewSoftSerial.h>
NewSoftSerial gps(2, 3);
byte data = 0;
int count = 0;
void setup()
{
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
  pinMode(13, OUTPUT);
  gps.begin(4800);
  Serial.begin(4800);
  Serial.println("\nSerial lines are set and ready");
}
void loop()
{
  if (count <= 255)
    digitalWrite(13, HIGH);
  else
  {
    digitalWrite(13, LOW);
    count = 0;
    delay(100);
  }
  if (gps.available() > 0)
  {
    data = gps.read();
    Serial.println(data);
    delay(1);
    count++;
  }
  
}

I think it’s my code :-?

And? Any results?

Don't know if it matters but i think you can skip the pinmodes for pin 2 and 3 in setup(), and maybe make it a print instead of println when receiving data, CR and/or LF are coming from the module...

With the gps.available() I was getting nothing but the first println in setup().

After removing the gps.available conditional I get this result:
I get a euro looking “y” so to figure what it was I setup a cast to int.
It was responding only with “255” aka 11111111… :-?

I find it odd that it wouldn’t enter the conditional when it was spitting out “1” (I was checking for greater than 0.)

When you remove the conditional you're reading while there might be no data available, that will return -1, or 255 unsigned, or 11111111 binary.

Looks like you're not getting any data, i can't verify your code but it looks fine and is very similar to the example i used, can't verify newsoftserial either because newsoftserial has no Mega support yet. Even without a valid signal it should send messages like: $GPGGA,002153.000,3342.6618,N,11751.3858,W,1,10,1.2,27.0,M,-34.2,M,,0000*5E for example.

Is the LED on the module doing something?

Arduino pin 13? Yes.

Gps Module? No.

LED on GPS-module isn't on or blinking? It should :-? I'd say you have a different issue.. :-/

damn it -.-

Nope the led has never lit up. in fact I didn't even know it was there until you asked about it. So I looked for one and found an smd led on the bottom.

It has the "TEST" sticker on it.. but I don't know..

If you hook your gps into 5v and ground but nothing else does the led turn on?

Yup, just tried that. LED (next to the ext-antenna connection) lights up with just ground and 5V.

Just remembered something, when i hooked it up i was surprised about the text on the print near the connector.. It's wrong, probably for the 648 variant or something. The description in the datasheet is correct, link on Parallax site:

http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/PMB-688_Specification_V0.1.pdf

oh good heavens.. redid the wiring.. I'm going to kill the bastard who mismarked the board. Been working on this for probably two weeks.

NOW I am just getting spaces from my previous code.

Sounds like you're on your way, at least check for available data :)

Lets see.

#include <SoftwareSerial.h>
SoftwareSerial gps = SoftwareSerial(2, 3);
byte data = 0;
int pin = 0;
void setup()
{
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
  pinMode(13, OUTPUT);
  gps.begin(4800);
  Serial.begin(4800);
  Serial.println("Serial lines are set and ready");
}
void loop()
{
  digitalWrite(13, pin);
  pin = ! pin;
  data = gps.read();
  delay(10);
  Serial.print((char)data);
  delay(10);
}

Result:
“Serial lines are set and ready”
Then a bunch of asterisks.

EDIT:
Btw, thank you for all your help with this.

NP, always glad to help if it aint on the net yet.

I'd skip the pinmodes for pin 2 and 3, or at least try without them.

You're not checking for available data yet, maybe do something like:

if (gps.available()) { data = gps.read(); Serial.print((char)data); }

Not sure if the compiler handles byte and char the same (it has some bumps and gaps here and there), you could try declaring data as a char too.