Cannot get GPS (GP-20U7) to work properly

I have been trying to get my GPS to work. But I am not getting the right output. I have got right output with the same code once in like 100 times. But I am not sure what I am doing wrong. Is it my network ? It is not getting the signal ?

This is my code :

#include <string>

using namespace std;
int sleep = 10 * 1000;    // Every 10 seconds publish 
string sentence;

void setup(){
    Serial1.begin(9600); // serial1 represents the tx/rx pins
    Serial.begin(9600);
}

void loop(){   
    for (unsigned long start = millis(); millis() - start < 1000;){
        // Check GPS data is available
        while (Serial1.available()){
            char c = Serial1.read();
            if(c == '\n') { // end of sentence
                Serial.println(String(sentence.c_str()));
                if(sentence.find("$GPGGA") == 0){
                   Serial.println("---- There is  GPGGA in the sentence ------");
                   Particle.publish("gpsloc", sentence.c_str());
                   Serial.println("--------------------");
                   Serial.println(String(sentence.c_str()));
                } 
                 sentence = "";

            } else {
                    sentence += c;
                }
        }
    }
    delay(sleep);
}

OUTPUT:

$GPGGA,,,,,,0,00,99.99,,,,,,*48
---- There is  GPGGA in the sentence ------
--------------------
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
---- There is  GPGGA in the sentence ------
--------------------
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
PGLL,,,,,,V,N*64*30
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
---- There is  GPGGA in the sentence ------
--------------------
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30

I am trying to get the Latitudes and Longitudes. But it is not happening.

1 Like

I have the same problem – not surprising, since Sandip is my TA, although we have been trying it in different locations, and are getting, usually, the results shown above (although on my dining room table it works fine).

The GP-20U7 is an inexpensive GPS from SparkFun, and I suspect it’s a combination of what has to be a minuscule antenna and insufficient satellite coverage. Does anyone have any experience with this?