Go Down

Topic: Big positioning error using U-BLOX NEO-6M GPS module with TinyGPS (Read 3918 times) previous topic - next topic


Jun 13, 2012, 10:51 am Last Edit: Jun 13, 2012, 10:54 am by achenal Reason: 1
Yesterday I have tested U-BLOX NEO-6M GPS module with TinyGPS lastest library v12.

The following is my codes copy from Arduino Cookbook.

Code: [Select]

#include "TinyGPS.h"
#include "SoftwareSerial.h"

#define GPS_RX_PIN 2
#define GPS_TX_PIN 3

TinyGPS gps; // create a TinyGPS object
SoftwareSerial ss(GPS_RX_PIN, GPS_TX_PIN); // create soft serial object

void setup()
Serial.begin(9600); // for debugging
ss.begin(9600); // Use Soft Serial object to talk to GPS
digitalWrite(HEMISPHERE_PIN, LOW); // turn off LED to start

void loop()
while (ss.available())
int c = ss.read();
Serial.write(c); // display NMEA data for debug
// Send each byte to encode()
// Check for new position if encode() returns "True"
if (gps.encode(c))
long lat, lon;
unsigned long fix_age;
gps.get_position(&lat, &lon, &fix_age);
if (fix_age == TinyGPS::GPS_INVALID_AGE)
Serial.println("No fix ever detected!");
else if (fix_age > 2000)
Serial.println("Data is getting STALE!");
Serial.println("Latitude and longitude valid!");
Serial.print("Lat: ");
Serial.print(" Lon: ");
if (lat < 0) // Southern Hemisphere?
digitalWrite(HEMISPHERE_PIN, LOW);

UNO can read NMEA formatted codes successfully. Here is part of printing in Serial monitoring window.

Latitude and longitude valid!
Lat: 3210270 Lon: 11882927

After input the position into GOOGLE Map in my iPhone, I found the error was so big, i.e. up to 200m, while the supplier says the error should be within 2m.
Can anyone tell me what is the reason? Thank you.


The lat/long values you are printing out are in units of 1/100000 of a degree, note.

It might be that Google maps is way out, it might be you have a poor fix.  Take a fix outside away from buildings.  Also if its the first time the GPS module has been used you need to run it for several minutes continuously to update the almanac.
[ I won't respond to messages, use the forum please ]


Jun 13, 2012, 04:44 pm Last Edit: Jun 13, 2012, 06:26 pm by achenal Reason: 1
Thank you MarkT.
I input 32.10270N,118.82927E position and find that the error is within 200m.
Yes I test the NEO-6M GPS module near the window for the first time.
BTW, I found the GPS coordinates of NEO-6M can be verified by another handed GPS device. Why?


It seems that the NMEA messages are not correct. Maybe 9600 baut rate is too high for Arduino?




Exactly same problem here, must wait 1 hour to have a poor fix. I have date and time from time to time.
GPS seems to drop bits…

Could someone help to understand this issue ?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131