Pages: [1]   Go Down
Author Topic: Big positioning error using U-BLOX NEO-6M GPS module with TinyGPS  (Read 3090 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include "TinyGPS.h"
#include "SoftwareSerial.h"

#define HEMISPHERE_PIN 13
#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
pinMode(HEMISPHERE_PIN, OUTPUT);
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!");
else
Serial.println("Latitude and longitude valid!");
Serial.print("Lat: ");
Serial.print(lat);
Serial.print(" Lon: ");
Serial.println(lon);
if (lat < 0) // Southern Hemisphere?
digitalWrite(HEMISPHERE_PIN, HIGH);
else
digitalWrite(HEMISPHERE_PIN, LOW);
}
}
}

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

$GPVTG,,T,,M,0.005,N,0.010,K,A*27
$GPG.0306129,189762,,809,6.,.80
$GGV311,23627330,238490,528271,922,87
GGV,,,01,2,1,2135,0,1,6,0,201,4,7*B
GPS,,,1,32,013,8,0192*7
$PL,20.62,,189762E,5670,AA6
$GPRMC,153658.00,A,3206.16229,N,11849.75641,E,0.016,,120612,,,A*70
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.
« Last Edit: June 13, 2012, 03:54:58 am by achenal » Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: June 13, 2012, 11:26:34 am by achenal » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Quote
$GPVTG,,T,,M,0.005,N,0.010,K,A*27
$GPG.0306129,189762,,809,6.,.80
$GGV311,23627330,238490,528271,922,87
GGV,,,01,2,1,2135,0,1,6,0,201,4,7*B
GPS,,,1,32,013,8,0192*7
$PL,20.62,,189762E,5670,AA6
$GPRMC,153658.00,A,3206.16229,N,11849.75641,E,0.016,,120612,,,A*70
Logged

Pages: [1]   Go Up
Jump to: