Go Down

Topic: Position coordinates not updated, Gps module and Arduino Uno issue (Read 2486 times) previous topic - next topic


I bought a PMB-688 GPS receiver and an Arduino Uno. I need to get gps location coordinates to serial monitor. I connected yellow gps cable to digital pin 6, red cable to 5v, black to ground.

I used tinyGPS and SoftwareSerial library. Following is the code I used:

Code: [Select]

#include <SoftwareSerial.h>
#include "TinyGPS.h"                 // Special version for 1.0

TinyGPS gps;
SoftwareSerial nss(6, 255);            // Yellow wire to pin 6

void setup() {
  Serial.println("Reading GPS");

void loop() {
  bool newdata = false;
  unsigned long start = millis();
  while (millis() - start < 5000) {  // Update every 5 seconds
    if (feedgps())
      newdata = true;
  if (newdata) {

// Get and process GPS data
void gpsdump(TinyGPS &gps) {
  float flat, flon;
  unsigned long age;
  gps.f_get_position(&flat, &flon, &age);
  Serial.print(flat, 6); Serial.print(", ");
  Serial.println(flon, 6);

// Feed data as it becomes available
bool feedgps() {
  while (nss.available()) {
    if (gps.encode(nss.read()))
      return true;
  return false;

When powered on, on serial monitor I saw correct latitute and longitude coordinates, but when I move the gps module, coordinates stay the same. Coordinates will be correctly updated only by power off and subsequently power on Arduino.

Does anybody knows why this could happens? Suggestions are appreciated!

Indeed, I checked the raw strings received without using tinyGPS library, and it turned  out that GPRMC messages frequently overlaps with GPGGA messages, such as:


Thanks for your help!


Your GPS sends coordinate updates every second and you're only reading them every five seconds. What's happening is that you're overflowing the 64 byte serial buffer and causing messages to overlap.

See also http://arduino.cc/en/Reference/SoftwareSerialOverflow


wow!! Thank you Dubuque for your suggestion, it helped me to fix the later issue. Now the serial monitor receives correct strings like


However, as you can see, when moving far from initial position (at least 10 m/33 ft), the latitude and longitude values remain the same...

Some hints?

Do you think the gps module is broken?


Code: [Select]

#include <SoftwareSerial.h>
SoftwareSerial GPS = SoftwareSerial(6,255);
char byteGPS;

void setup()

void loop()
  if (GPS.overflow()){
  byteGPS = GPS.read();

  if (byteGPS == -1) {           // See if the port is empty yet
  else {


No it is probably Ok Even though 'Selective Availability is disabled and theoretically the accuracy should be 3 meters, 10 meters or 33" is about the minimum typical measurable distance. Try twice that far.

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard



Go Up