Go Down

Topic: Big positioning error using U-BLOX NEO-6M GPS module with TinyGPS (Read 4905 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 will NOT respond to personal messages, I WILL delete them, 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 ?



You have to set the Dilution of Precision (DOP) through UBX-CFG-NAV message. By default it is set 25.0. A DOP > 20 is considered a poor precision level. At this level, measurements are inaccurate by as much as 300 meters. You need to catch satellites as much separated as possible to get a good geometry to fit into the DOP you set. Between buildings or mountains you only catch satellites that are near one from the others not getting a valid position.
UBLOX6 protocol document says:
Important: To qualify a position as valid the gpsFixOK flag in the UBX-NAV-STATUS message must be checked. gpsFix=3D/3D in the UBX-NAV-STATUS message does not qualify a fix as valid and within the limits. To qualify a position as valid and within the pDop and pAcc limits set in the UBX-CFG-NAV5 message the gpsFixOK flag in the UBX-NAV-STATUS message has to be checked. [/i]


???  When you were posting, did you see the warning about how old this thread is?

Although the "poor fix" mentioned in the last post may be due to a bad DOP, the sample output from the OP and everyone else shows they are dropping characters, probably because they are not reading frequently enough.  This is a very common problem with the TinyGPS example programs.


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