I bought this shield several months ago.
I start to use to build a car tracker.
But currently I have a strange behavior, in fact, sometimes the time, the latitude and the longitude are wrong as you can see below.
The red one are wrong and I do not know from where the problem comes.Time: 13:16:29.0 - Location (in degrees): 47.963687896, 2.210210084
Time: 0:0:13.0 - Location (in degrees): 47.009521484, 2.002043247
Time: 13:16:44.0 - Location (in degrees): 47.963687896, 2.210210084
Time: 0:0:13.0 - Location (in degrees): 47.009685516, 2.210210084
Time: 13:18:3.0 - Location (in degrees): 47.963687896, 2.210210084
Time: 13:18:46.0 - Location (in degrees): 47.963687896, 2.210208296
Time: 0:13:23.0 - Location (in degrees): 47.009521484, 2.210208296
Time: 13:23:47.0 - Location (in degrees): 47.963687896, 2.210208296
Time: 13:25:25.0 - Location (in degrees): 47.963687896, 2.210206627
Is this a GPS error or a software bug ?
Has anyone experienced this problem ?
Many thank for your help.
Thoma
Code: Select all
if (GPS.newNMEAreceived())
{
if (GPS.parse(GPS.lastNMEA()))
{
if (GPS.fix != 0)
{
if ((previous_latitude != GPS.latitudeDegrees) ||
(previous_longitudeDegrees != GPS.longitudeDegrees))
{
double lonA = M_PI * previous_longitudeDegrees / 180.0;
double lonB = M_PI * GPS.longitudeDegrees / 180.0;
double latA = M_PI * previous_latitude / 180.0;
double latB = M_PI * GPS.latitudeDegrees / 180.0;
double a = sin((lonA - lonB) / 2.0);
double b = cos(lonA) * cos(lonB);
double c = sin((latB - latA) / 2.0);
double d = sqrt(a * a + b * c * c);
double e = asin(d);
double f = 12734890.0 * e;
Serial.print("Time: ");
Serial.print(GPS.hour, DEC); Serial.print(':');
Serial.print(GPS.minute, DEC); Serial.print(':');
Serial.print(GPS.seconds, DEC); Serial.print('.');
Serial.print(GPS.milliseconds);
Serial.print(" - Location (in degrees): ");
Serial.print(GPS.latitudeDegrees, 9);
Serial.print(", ");
Serial.print(GPS.longitudeDegrees, 9);
Serial.print(" (");
Serial.print(f, 0);
Serial.println(")");
previous_latitude = GPS.latitudeDegrees;
previous_longitudeDegrees = GPS.longitudeDegrees;
}
}
}
}