TinyGPS++ library Sample Show Invalid location, date and time.

Arduino, Seeeduino Serials and mutants. Share your problems and experence on arduino compatible board such as seeeduino/stalker, etc.

Moderators: lily.li, violet, salmanfarisvp

Post Reply
keantattong
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Thu Oct 11, 2018 2:46 pm

TinyGPS++ library Sample Show Invalid location, date and time.

Post by keantattong » Tue Feb 12, 2019 4:51 pm

Hi, I'm using RHF76-052AM, seeeduino lorawan w/gps board as end node. I'm following the guidelines (http://wiki.seeedstudio.com/Seeeduino_LoRAWAN/) and I encountered issues while trying the sample using TinyGPS++ library. The output I get is like following:

+RESET: OK
Location: INVALID Date/Time: 1/6/2080 00:00:35.79
Location: INVALID Date/Time: 1/6/2080 00:00:35.79
Location: INVALID Date/Time: 1/6/2080 00:00:35.79
Location: INVALID Date/Time: 1/6/2080 00:00:35.79
...
16:46:51.586 -> Location: INVALID Date/Time: 1/6/2080 00:00:40.79
Location: INVALID Date/Time: 1/6/2080 00:00:40.79
Location: INVALID Date/Time: 1/6/2080 00:00:40.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:41.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:42.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:43.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:44.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:45.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:46.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Location: INVALID Date/Time: 1/6/2080 00:00:47.79
Not able to get a fix in alloted time.
...

I dun know what is the reason causing the output. I try the basic example of the TinyGPS++ library below instead, but I didn't get any output in the serial monitor.

#include <TinyGPS++.h>
/*
This sample sketch should be the first you try out when you are testing a TinyGPS++
(TinyGPSPlus) installation. In normal use, you feed TinyGPS++ objects characters from
a serial NMEA GPS device, but this example uses static strings for simplicity.
*/

// A sample NMEA stream.
const char *gpsStream =
"$GPRMC,045103.000,A,3014.1984,N,09749.2872,W,0.67,161.46,030913,,,A*7C\r\n"
"$GPGGA,045104.000,3014.1985,N,09749.2873,W,1,09,1.2,211.6,M,-22.5,M,,0000*62\r\n"
"$GPRMC,045200.000,A,3014.3820,N,09748.9514,W,36.88,65.02,030913,,,A*77\r\n"
"$GPGGA,045201.000,3014.3864,N,09748.9411,W,1,10,1.2,200.8,M,-22.5,M,,0000*6C\r\n"
"$GPRMC,045251.000,A,3014.4275,N,09749.0626,W,0.51,217.94,030913,,,A*7D\r\n"
"$GPGGA,045252.000,3014.4273,N,09749.0628,W,1,09,1.3,206.9,M,-22.5,M,,0000*6F\r\n";

// The TinyGPS++ object
TinyGPSPlus gps;

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

Serial.println(F("BasicExample.ino"));
Serial.println(F("Basic demonstration of TinyGPS++ (no device needed)"));
Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Mikal Hart"));
Serial.println();

while (*gpsStream)
if (gps.encode(*gpsStream++))
displayInfo();

Serial.println();
Serial.println(F("Done."));
}

void loop()
{
}

void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
}
else
{
Serial.print(F("INVALID"));
}

Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}

Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}

Serial.println();
}

Hope can get some insight.

Thank you.

keantattong
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Thu Oct 11, 2018 2:46 pm

Re: TinyGPS++ library Sample Show Invalid location, date and time.

Post by keantattong » Thu Feb 14, 2019 4:40 pm

Hi, I managed to get the correct NMEA data by placed my end node outdoor or near the window for several minutes. After getting the correct NMEA data, the tinyGPS++ sample code shows the correct output and my problem solved.

Hope this will help anyone encounter the same issue.

Post Reply