Question

I have a GP-635T GPS module attached to my Arduino UNO (GPS TX->UNO RX[Pin 0]) using Serial.

Then I just read the incoming data byte for byte adding them to a string as they are read and when I reach a newline character(13) I just print the complete String of data and reset the data String for the next run.

Code:

void setup()
{
  Serial.begin(9600);
  Serial.println("Initialized Serial port..");
}

String data = "";

void loop()
{
  while(Serial.available())
  {
    char gpsByte = Serial.read();// Read a byte from the GPS
    data += gpsByte;
    if(gpsByte == 13){
      Serial.print(data);
      data = "";
    }
  }
  delay(100);
}

This code works as it is. But the problem here is the data I get from it.

The module prints out multiple datalines at 1Hz using the NMEA-0183 standard. I do not have any idea how it decides what to print when because the data is not consistent for more than 5 "prints" of the (almost)complete dataset.

Ex:

$GPGGA,213948.00,,,,,0,00,99.99,,,,,,*63
$GPGSA,A30                                <--- A30?
$GPGSV,1,1,01,29,,,30*70
$GPGLL,,,,,213948.00,V,N*4F
$GPRMC,213949.00,V,,,,,,,290314,,,N*74
$GPVTG,,,,,,,,,N*30
$GPGGA,213949.00,,,,,0,00,99.99,,,,,,*62
$GPGSA,A,1,,,,PGSV,1,1,01,29,,,30*70      <--- PGSV?
$GPGLL,,,,,213949.00,V,N*4E
$GPRMC,213950.00,V,,,,,,,290314,,,N*7C
$GPVTG,,,,,,,,,N*30
$GPGGA,213950.00,,,,,0,00,99.99,,,,,,*6A

...

$GPGGA,214045SA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,01,29,,,30*70$GPRMC,214046.00,V,,,,,,,290314,,,N*75 <--- Missing linebreak?
$GPVTG,,,,,,,,,N*30
$G00,99.99,,,,,,*63                                        <--- $G00??
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,02,20,,,27,29,,,30*74
$GPGLL,$GPRMC,214047.00,V,,,,,,,290314,,,N*74  <--- Missing data?
$GPVTG,,,,,,,,,N*30
$GPGGA,214047.00,,,,,0,00,99.99,,,,,,*62
$,99.99*30                                   <--- Alot of missing data

I think you get the point, I have nothing but the GPS connected to the Arduino. I have tried with sending the data wirelessly with some wireless modules with no change. I have tried with using AltSoftSerial and SoftwareSerial but I got messier data with the latter. I have tried different baud rates with no luck.

Does anyone have any idea as to why this is happening? The module is brand new and I have no idea why it would behave like this.

NOTE: I do not have a very good GPS signal to my module from within my house, I did try going outside with it and see if I could get a signal which I did from about 3 satellites, but that didn't change the output.

Was it helpful?

Solution

Well this was a very strange problem, The problem did go away when I shortened the delay from 100ms to 10ms. It might have to do something with the buffer and maybe it just gets overflowed before I start reading bytes from it.

However if someone else have got this same problem, shorten the loop delay and you should be fine!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top