GPS Module

Hi All,

I need help and would be very appreciative while I learn!
Trying to get a GPS module working, but it only seems to run the ‘setup’ and nothing happens from the ‘loop’.

I’ve read that sometimes it needs to be left on for 15 mins the first time, to locate satellites etc. but its been on for 2 hours and nothing. the gps unit is this:http://www.ebay.co.uk/itm/152372095754?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I’m using this tutorial, my code is identical, including the pin setup etc:

my code is:
#include “TinyGPS++.h”
#include “SoftwareSerial.h”

SoftwareSerial serial_connection(10, 11); //RX=pin 10, TX=pin 11
TinyGPSPlus gps;//This is the GPS object that will pretty much do all the grunt work with the NMEA data
void setup()
{
Serial.begin(9600);//This opens up communications to the Serial monitor in the Arduino IDE
serial_connection.begin(9600);//This opens up communications to the GPS
Serial.println(“GPS Start”);//Just show to the monitor that the sketch has started
}

void loop()
{
while(serial_connection.available())//While there are characters to come from the GPS
{
gps.encode(serial_connection.read());//This feeds the serial NMEA data into the library one char at a time
}
if(gps.location.isUpdated())//This will pretty much be fired all the time anyway but will at least reduce it to only after a package of NMEA data comes in
{
//Get the latest info from the gps object which it derived from the data sent by the GPS unit
Serial.println(“Satellite Count:”);
Serial.println(gps.satellites.value());
Serial.println(“Latitude:”);
Serial.println(gps.location.lat(), 6);
Serial.println(“Longitude:”);
Serial.println(gps.location.lng(), 6);
Serial.println(“Speed MPH:”);
Serial.println(gps.speed.mph());
Serial.println(“Altitude Feet:”);
Serial.println(gps.altitude.feet());
Serial.println("");
}
}

/*

  • $GPRMC,183729,A,3907.356,N,12102.482,W,000.0,360.0,080301,015.5,E6F
    $GPRMB,A,V
    71
    $GPGGA,183730,3907.356,N,12102.482,W,1,05,1.6,646.4,M,-24.1,M,75
    $GPGSA,A,3,02,07,09,24,26,1.6,1.6,1.0
    3D
    $GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,3571
    $GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43
    77
    $PGRME,22.0,M,52.9,M,51.0,M14
    $GPGLL,3907.360,N,12102.481,W,183730,A
    33
    $PGRMZ,2062,f,32D
    $PGRMM,WGS 84
    06
    $GPBOD,T,M,47
    $GPRTE,1,1,c,0
    07
    $GPRMC,183731,A,3907.482,N,12102.436,W,000.0,360.0,080301,015.5,E67
    $GPRMB,A,V
    71
    */

Thanks
Tom

I'd suggest that you start with a much simpler sketch - just read from the GPS and then echo what you get to serial. It'll tell you whether your wiring and baud rate are correct.

As to fifteen minutes, yes, it may take a while from cold boot to get a fix, but it will still emit NMEA sentences without it.

Remember too, that the gps must have a good view of the sky or you'll get nothing however long you wait. That means near a window or outside.

When you are getting good data, using the simpler sketch, pass the data to encode(). Pay attention to that fact that encode() returns a value. Pay attention to what that value is.

Thanks Wildbill, I'll start with a simpler sketch, see if i have any luck that way.

PaulS, What will passing the data to encode do? Apologies, i may need a lot of this in laymans terms, im reading as much material as i can on this, but cant find anything which explains the encode () that you mention

I also wondered if i had a piece of the antenna missing - from the ebay description it sounds like the white block is a ceramic antenna, but most of the gps units i see when reading have a smal u.fl antenna attached... i thought this could be why im not recieving any data, but then again the led indicator is behaving as it should - solid, then flashing.

What will passing the data to encode do?

From the TinyGPS++ reference

Feeding the Hungry Object

To get TinyGPS++ to work, you have to repeatedly funnel the characters to it from the GPS module using the encode() method. For example, if your GPS module is attached to pins 4(RX) and 3(TX), you might write code like this:

SoftwareSerial ss(4, 3);
void loop()
{
while (ss.available() > 0)
gps.encode(ss.read);
...

What will passing the data to encode do?

Suppose that you can only read GPS data one letter at a time (because that is all that you can read). How can you make use of that data?

Somehow, you need to collect the data in an array, and then parse the data when the array contains a complete sentence.

encode() adds the letter to the array, and returns whether or not the sentence is now complete.