GPS shows symbols

For TinyGPS to work properly, you have to be outside, with a clear view of the sky, and wait for a valid satellite fix. That can take many minutes for a factory-fresh GPS module.

l-arc-en-ciel:
Ah! I didn't know that.

It's a common mistake. Once you know, it's obvious: the GPS spec is saying "I send data on this pin", so it makes sense that it be attached to a pin that that the Arduino is going to read on. Sadly, the first time you go through this, you have other concerns to distract you.

Thanks a lot for all the comments

Now I get something, but it says

"11:11:32.355 -> Location: INVALID Date/Time: INVALID"

Go back to the jremington code, take the kit outside and wait awhile. What raw data are you getting from the GPS?

The u-center software from u-blox is an easy way to monitor the performance of a GPS. Gives graphical info on satellite signals and parses all the fields for you.

wildbill:
Go back to the jremington code, take the kit outside and wait awhile. What raw data are you getting from the GPS?

11:30:09.497 → 864449444944484842545313103671787176764444444444485751484948464848448644784253701310367178827767444857514849494648484486444444444444444444447842545713103671788684714444444444444444447842506913103671787171654448575148494946484844444444444844484844575746575744444444444442555013103671787183654465444944444444444444444444444444575746575744575746575744575746575742506913103671787183654465494444444444444457575744574657575757426913368071865049445448444451444844445244544451565044445142571336808386505044545044445244494444525567107176834444494842531336787176444444574849464886444269103671788277674448575148495046484844864444444444444444444478425465131036717886847144444444444444444478425069131036717871716544485751484950464848444444444448444848445757465757444444444444425549131036717871836544654449444444444444444444444444445757465757445757465757445757465757425069131036717871836544654944444444444444574657445746575746574269133680838650494

That is bizarre. It looks nothing like the output I would expect. I wonder if you have somehow inadvertently set the GPS into a mode where it doesn't emit NMEA. What model is it?

Not bizarre at all.

The code has this line;

Serial.print(mySerial.read());

Maybe it should be;

Serial.write(mySerial.read());

The code as written is printing the decimal numbers of the characters from the GPS, one of the NMEA sentences in the printout is;

36 71 78 86 84 71 44 44 44 44 44 44 44 44 44 78 42 50 69

Which is;

$GNVTG,,,,,,,,,N*2E

And the checksum is correct.

An empty GNVTG sentence is indicative of a GPS that is indoors or has a no or a faulty antenna.

D'oh! of course. Nice catch, thanks.

l-arc-en-ciel:
I'm working on a project with GPS.
The GPS works on software serial and I use the TinyGPS library.

Useful to have told us which GPS you are using ..................................

TinyGPS++ will not work with some of the Ublox GPS which can put out GN format NMEA sentences as default, rather than GP.

You may be able to setup the GPS to output GP sentences, or modify TinyGPS++ to accept GN or GP, but its easier to use the updated TinyGPSplus library which by default accepts both styles of NMEA sentence.

Serial.write(mySerial.read()); Oops, sorry, this is correct! Earlier reply edited to fix it.

Turns out I had ",HEX" in the original and edited that out for posting, without changing "print" to "write".

srnet:
Useful to have told us which GPS you are using ..................................

TinyGPS++ will not work with some of the Ublox GPS which can put out GN format NMEA sentences as default, rather than GP.

You may be able to setup the GPS to output GP sentences, or modify TinyGPS++ to accept GN or GP, but its easier to use the updated TinyGPSplus library which by default accepts both styles of NMEA sentence.

Ah ok, so there are different types of GPS?

I use TinyGPS++. It's website says its the successor of TinyGPS. I can't find anything specific about 'TinyGPSPlus', it seems to be a another name for maybe an earlier update of TinyGPS?

I am using a GPS that has a label on it that says 'GN-26 (- I think its a 6) 30G (UART) GPS + GLONASS'

Have you managed to get any NMEA sentences that contain actual lat & lon numbers rather than a bunch of nulls?

l-arc-en-ciel:
I use TinyGPS++. It's website says its the successor of TinyGPS. I can't find anything specific about 'TinyGPSPlus', it seems to be a another name for maybe an earlier update of TinyGPS?

No TinyGPSPlus is not an 'earlier update' of TinyGPS, its an update of TinyGPS++ as I said.

I can't find anything specific about 'TinyGPSPlus'

There must be something wrong with your PC or Web-browser then, when I type TinyGPSPlus into Google the correct library is the first item in the list of search results.

srnet:
No TinyGPSPlus is not an 'earlier update' of TinyGPS, its an update of TinyGPS++ as I said.

There must be something wrong with your PC or Web-browser then, when I type TinyGPSPlus into Google the correct library is the first item in the list of search results.

Ok I see now, I had another website where only TinyGPS and TinyGPS++ were mentioned.

I will use the Github of TinyGPSPlus and try this.

Turned out that I was already using the latest version.
In the software Plus and ++ is used interchangeably.

The attachments show screenshots I’ve just grabbed of the IDE monitor when connected directly to a board that contains a u-blox neo-6m GPS receiver. No sketch was involved.

monitor_1: NMEA sentences are being generated by the GPS but no satellite signals found, so no data. Hence all the empty fields.

monitor_2: some satellite signals have been found; their identifying numbers are seen in the GSV sentence; still no positional fix, so no data

monitor_3: still no fix but date and time are being received from the satellites – seen in the RMC sentence

monitor_4: fix has been achieved; full positional data shown

This is an easy way to prove a GPS board.

John.

monitor_1.JPG

monitor_2.JPG

monitor_3.JPG

jpom:
The attachments show screenshots I've just grabbed of the IDE monitor when connected directly to a board that contains a u-blox neo-6m GPS receiver. No sketch was involved.

monitor_1: NMEA sentences are being generated by the GPS but no satellite signals found, so no data. Hence all the empty fields.

monitor_2: some satellite signals have been found; their identifying numbers are seen in the GSV sentence; still no positional fix, so no data

monitor_3: still no fix but date and time are being received from the satellites -- seen in the RMC sentence

monitor_4: fix has been achieved; full positional data shown

This is an easy way to prove a GPS board.

John.

Thanks! Hoe do I output something without a sketch? What is the IDE monitor? The serial output monitor?

jpom:
The attachments show screenshots I've just grabbed of the IDE monitor when connected directly to a board that contains a u-blox neo-6m GPS receiver. No sketch was involved.

monitor_1: NMEA sentences are being generated by the GPS but no satellite signals found, so no data. Hence all the empty fields.

monitor_2: some satellite signals have been found; their identifying numbers are seen in the GSV sentence; still no positional fix, so no data

monitor_3: still no fix but date and time are being received from the satellites -- seen in the RMC sentence

monitor_4: fix has been achieved; full positional data shown

This is an easy way to prove a GPS board.

John.

Thanks! This helped me in the edit of the earlier sketch

jremington:
Serial.write(mySerial.read()); Oops, sorry, this is correct! Earlier reply edited to fix it.

Turns out I had ",HEX" in the original and edited that out for posting, without changing "print" to "write".

I edited "print" to "write" and now I get results like in the screenshots.

That TinyGPS shows "invalid" does that mean my GPS module is not compatible with TinyGPS?

The code of jremington (with the edit of ‘print’ ‘write’) outputs this:

19:27:14.647 -> GPS start
19:27:14.694 -> uMY⸮2,2,05,22,54,087,23*43
19:27:14.694 -> $GLGSV,1,1,04,65,64,041,27,66,46,249,26,81,60,295,26,87,10,169,18*65
19:27:14.788 -> $GNGLL,,,,,172713.00,V,N*55
19:27:15.400 -> $GNRMC,172714.00,V,,,,,,,280719,,,N*60
19:27:15.440 -> $GNVTG,,,,,,,,,N*2E
19:27:15.440 -> $GNGGA,172714.00,,,,,0,08,2.48,,,,,,*48
19:27:15.473 -> $GNGSA,A,1,22,17,01,09,,,,,,,,,5.17,2.48,4.54*18
19:27:15.539 -> $GNGSA,A,1,65,81,66,87,,,,,,,,,5.17,2.48,4.54*13
19:27:15.588 -> $GPGSV,2,1,05,01,37,142,30,03,,,32,09,24,210,30,17,41,262,21*45
19:27:15.671 -> $GPGSV,2,2,05,22,54,087,24*44
19:27:15.717 -> $GLGSV,1,1,04,65,64,041,27,66,46,249,27,81,60,295,27,87,10,169,18*65
19:27:15.755 -> $GNGLL,,,,,172714.00,V,N*52

The full example of TinyGPS Plus

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("FullExample.ino"));
  Serial.println(F("An extensive example of many interesting TinyGPS++ features"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
  Serial.println(F("Sats HDOP  Latitude   Longitude   Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum"));
  Serial.println(F("           (deg)      (deg)       Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail"));
  Serial.println(F("----------------------------------------------------------------------------------------------------------------------------------------"));
}

void loop()
{
  static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

  printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
  printFloat(gps.hdop.hdop(), gps.hdop.isValid(), 6, 1);
  printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
  printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
  printInt(gps.location.age(), gps.location.isValid(), 5);
  printDateTime(gps.date, gps.time);
  printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);
  printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);
  printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
  printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.deg()) : "*** ", 6);

  unsigned long distanceKmToLondon =
    (unsigned long)TinyGPSPlus::distanceBetween(
      gps.location.lat(),
      gps.location.lng(),
      LONDON_LAT, 
      LONDON_LON) / 1000;
  printInt(distanceKmToLondon, gps.location.isValid(), 9);

  double courseToLondon =
    TinyGPSPlus::courseTo(
      gps.location.lat(),
      gps.location.lng(),
      LONDON_LAT, 
      LONDON_LON);

  printFloat(courseToLondon, gps.location.isValid(), 7, 2);

  const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);

  printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);

  printInt(gps.charsProcessed(), true, 6);
  printInt(gps.sentencesWithFix(), true, 10);
  printInt(gps.failedChecksum(), true, 9);
  Serial.println();
  
  smartDelay(1000);

  if (millis() > 5000 && gps.charsProcessed() < 10)
    Serial.println(F("No GPS data received: check wiring"));
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
  unsigned long start = millis();
  do 
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

static void printFloat(float val, bool valid, int len, int prec)
{
  if (!valid)
  {
    while (len-- > 1)
      Serial.print('*');
    Serial.print(' ');
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1); // . and -
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(' ');
  }
  smartDelay(0);
}

static void printInt(unsigned long val, bool valid, int len)
{
  char sz[32] = "*****************";
  if (valid)
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0) 
    sz[len-1] = ' ';
  Serial.print(sz);
  smartDelay(0);
}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
{
  if (!d.isValid())
  {
    Serial.print(F("********** "));
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
    Serial.print(sz);
  }
  
  if (!t.isValid())
  {
    Serial.print(F("******** "));
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
    Serial.print(sz);
  }

  printInt(d.age(), d.isValid(), 5);
  smartDelay(0);
}

static void printStr(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    Serial.print(i<slen ? str[i] : ' ');
  smartDelay(0);
}

outputs:

FullExample.ino
19:30:18.130 -> An extensive example of many interesting TinyGPS++ features
19:30:18.130 -> Testing TinyGPS++ library v. 1.0.2
19:30:18.130 -> by Mikal Hart
19:30:18.130 -> 
19:30:18.130 -> Sats HDOP  Latitude   Longitude   Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum
19:30:18.130 ->            (deg)      (deg)       Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail
19:30:18.130 -> ----------------------------------------------------------------------------------------------------------------------------------------
19:30:18.178 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   0     0         0        
19:30:19.477 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   399   0         60       
19:30:21.067 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   964   0         151      
19:30:22.371 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   1294  0         204      
19:30:23.931 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   1914  0         305      
19:30:25.341 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   2275  0         361      
19:30:26.786 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   2807  0         444      
19:30:28.262 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   3252  0         510      
19:30:29.704 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   3757  0         579      
19:30:31.172 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   4227  0         651      
19:30:32.526 -> **** ***** ********** *********** **** ********** ******** **** ****** ****** ***** ***   ******** ****** ***   4641  0         709