Go Down

Topic: TinyGPS (Read 4366 times) previous topic - next topic

thor2015

I am writing some code to develop a digital speedometer whose data is pulled and converted using TinyGPS. I am testing the code in my house and am getting a solid red LED on my Parallax GPS unit but there are times when the module is sitting still that I will get speeds of up to 8 mph output in the serial monitor. Has anyone else experienced anomalies of this nature with the GPS units? Attached is my code:

Code: [Select]
#include <NewSoftSerial.h>
#include <TinyGPS.h>
NewSoftSerial nss (2,3);
TinyGPS gps;

void setup()
{

 Serial.begin(4800);
 nss.begin(4800);
}

void loop()
{
 while (nss.available())
 {
   int c = nss.read();
   if (gps.encode(c))
   {
     int fmph = gps.f_speed_mph(); // speed in miles/hr
     Serial.println(fmph);      
   }
 }
}


Also, please forgive me if I missed it when reading the .h file, but is there any way in TinyGPS to extract the data from the GPRMC that indicates a valid lock (i.e. the 3rd part of the string that is either A or V)? Thanks.

-Jeremy

kg4wsv

I haven't used this particular device, but I've used several other GPS units and they all can give anomalous readings at startup and when signal quality is poor (e.g. indoors).  Even my Garmin MAP60C showed me moving at 100MPH between my driveway (where I powered up) and the main road (~200 yards away), where max speed was 25 or 30 MPH.

According to an old Trimble 6 channel GPS, my truck would drift around in a circle all day while I was at my desk (with the keys in my pocket :) ).

-j

thor2015

Thanks for the input. I've never used GPS until this point so I wasn't sure if that was normal or not.

pocketscience

You'll see localised drift even with current generation devices... no matter where your keys are!
Is life really that serious...??!

Go Up