GPS issues w/wo SoftwareSerial & TinyGPS

I'm using one of the 406A GPS modules. I originally got it working via Adafruit's GPS Shield. Now I'm trying to "make it work" in different ways. I'm seeing a few odd issues, with and without TinyGPS, and any SoftwareSerial. I'll list things here, and hopfully someone can point me in the right direction on the various parts:

  1. I'm only ever seeing the GGA and RMC sentences. Even though I've (tried) sent the "$PSRF103" strings to include the others (GGL, GSA, GSV, VTG, DDM, WAAS), AFTER sending the $PSRF100 string to initialize. For example:
void setup() {
Serial.begin(4800);
Serial.print("$PSRF100,01,4800,08,01,00*0E\r\n");
Serial.print("$PSRF103,00,00,00,01*25\r\n");  //GGA
Serial.print("$PSRF103,01,00,01,01*26\r\n");  //GGL
Serial.print("$PSRF103,02,00,01,01*27\r\n");  //GSA
Serial.print("$PSRF103,03,00,01,01*26\r\n");  //GSV
Serial.print("$PSRF103,04,00,01,01*21\r\n");  //RMC
Serial.print("$PSRF103,05,00,01,01*20\r\n");  //VTG
Serial.write("$PSRF105,01*3E\r\n");           //DDM (Development Data Messages)
Serial.write("$PSRF151,01*3F\r\n");           //WAAS
}

Is Serial.print not sufficient for this? I've tried Serial.write() as well, with no difference.

  1. When using TinyGPS, I'm cannot get the crack_datetime() function to work quite right:
void loop() {
  long lat, lon, alt;
  unsigned long fix_age, time, date, speed, course, chars;
  unsigned short sentances, failed;
  byte month, day, hour, minute, second, decsec;
  int year;

  char c = Serial.read();
  if (gps.encode(c))
  {
      alt = gps.altitude();
      gps.get_datetime(&date, &time, &fix_age);
      gps.get_position(&lat, &lon, &fix_age);
      gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &decsec, &fix_age);
      speed = gps.speed();
      course= gps.course();

      //dump our data
      //Skipped - it's a bunch of Serial.print() and Serial.println() statements
  }
}

// SAMPLE OUTPUT
******************************
Position (lat/long): 5092598, -11396980
Altitude (cm): 105450
Date/Time:280310 - 8220400
  year: 2010,   month: 
,   day: 
,   hour: 
,   minute: 
,   second: 
.
Speed: 1
Course: 235
******************************
  • The date/time parts are all non-printable characters/garbage - except for the year (all relevant parts should be on one line in the output...). Everything else seems to be right. (haven't looked at the floating point items yet though)
  1. If I use SoftwareSerial, I cannot get a valid GPS sentence. There seems to be a corrupt character someplace in the middle of each sentence, so checksums fail. My project is going to need three serial devices connected (GPS, OpenLog, and LCD). But until I can reliably receive and interpret the GPS signals, the rest is on hold. (I'm trying out NewSoftSerial now to see if I get the same issues). I've modified my code a fair bit since (falling back to hardware serial) so cannot easily post it here...

If it helps, I'm using version 0017 of the development environment. I've just installed 0018, so will be reconfirming things. Oh, and my skill level should be safely classified as "novice". While I'm an experienced developer, it is all with higher level languages. (Some C training 15ish years ago...)

Thanks for any tips

Sorry, should have mentioned that I have the module directly connected to an arduino now, and am NOT using the GPS Shield (for now).

I'm now receiving data via NewSoftSerial. If I directly dump what I read from the serial connection (which is the GPS), I can see the GGA and RMC sentences and they appear to be valid (I'm checking in more detail though just to be sure).

But, if I feed the data into TinyGPS via "gps.encode(c)", where "c" is a char, I get lat/long and altitude, but the rest is missing. Date is zero, which throws off everything else. Time seems to be wrong too with values like "9233400".

I can say though that NewSoftSerial seems to be running better than SofwareSerial... That is at least one step in the right direction... :slight_smile:

doh! My comment regarding the time value... I thought the hour would be zero padded (don't know where I got that from), so was reading it as "92" hour, "33" minute, etc. This is not right - it should be read as "9" hour, "23" minute, etc.

I tried the TinyGPS example code, and things are working much better with regards to interpreting the date/time. So my code must be faulty. I'll use the example code as a base and build from there.

So this means points 2 and 3 above seem to be "resolved". I still am only getting the GGA and RMC sentences though. I don't know how to resolve that one.

Doesn't TinyGPS only read the GGA and RMC sentences anyway?

I think you are right regarding TinyGPS. But I still have the issue if I choose to roll my own code at some point and need the other sentences my module is supposed to provide...

I know this won't solve your problem via programming but you can connect the GPS to your computer and download software like SIRFDemo and have it change which sentences are transmitted...that's what I ended up doing with mine.