Reading serial data from ultimate gps

Hi,
I am pretty new to arduino and am trying to read GPS data from an adafruit ultimate gps board. I am using Tinygps code "test_with_gps_device" with an arduino uno.

As the code suggests, I have the TX from the gps going to pin 3 and Rx to pin 4. The code says include "software serial". I tried to load this code, but it replaces the tinygps code. I apologize for my ignorance, but do I need to have both codes present for this to work, and if so, how do I load both at the same time?

At present, when I run the tinygps code listed below, I get gibberish from the arduino serial monitor:

A,Ú*KJÙÛÛ???l?K $$À? lCô??¤Â:3?¤Ì$r !Ò,$?l?KÙÙÛÛ??$?,? ?,l þÐ? B ?? I ú? ?(Kô?(?$?l ú? lCô??? d ô?,?hK!Â??$?,?,$ ??? $ ô?,?,?,?, (?,le Ò(ae$?? ü?l ðXe$?@ ð¸ e?$e ÿØa IüÐ?J üe?I þ??$?,?,$ (?,lô8$?l üÐae
?,d À?(?$?l ú?,?l àØa ?hÀ? lCô?,?,?l% (ae?? üee? c ?Ð?,?(L? ??,?l àÐa ?Lü?lCô?,?, ê8 e
?dA è?e,Cô?,K à? e?Kü?,?,?,?, 8$?@ üÐa

I have tried different baud rates and have also tried switching RX and TX to make sure I had them correct
I would be very grateful for any suggestions on how to get the gps data into the arduino so I can read it. The code I am using in the uno is listed below. I

Here is the code:
#include <SoftwareSerial.h>

#include <TinyGPS.h>

/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

TinyGPS gps;
SoftwareSerial ss(4, 3);

static void smartdelay(unsigned long ms);
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

void setup()
{
Serial.begin(115200);

Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
Serial.println("Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum");
Serial.println(" (deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail");
Serial.println("-------------------------------------------------------------------------------------------------------------------------------------");

ss.begin(4800);
}

void loop()
{
float flat, flon;
unsigned long age, date, time, chars = 0;
unsigned short sentences = 0, failed = 0;
static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
gps.f_get_position(&flat, &flon, &age);
print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 10, 6);
print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 11, 6);
print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
print_date(gps);
print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 7, 2);
print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2);
print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);
print_int(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0xFFFFFFFF : (unsigned long)TinyGPS::distance_between(flat, flon, LONDON_LAT, LONDON_LON) / 1000, 0xFFFFFFFF, 9);
print_float(flat == TinyGPS::GPS_INVALID_F_ANGLE ? TinyGPS::GPS_INVALID_F_ANGLE : TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
print_str(flat == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON)), 6);

gps.stats(&chars, &sentences, &failed);
print_int(chars, 0xFFFFFFFF, 6);
print_int(sentences, 0xFFFFFFFF, 10);
print_int(failed, 0xFFFFFFFF, 9);
Serial.println();

smartdelay(1000);
}

static void smartdelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (ss.available())
gps.encode(ss.read());
} while (millis() - start < ms);
}

static void print_float(float val, float invalid, int len, int prec)
{
if (val == invalid)
{
while (len-- > 1)
Serial.print('*');
Serial.print(' ');
}
else
{
Serial.print(val, prec);
int vi = abs((int)val);
int flen = prec + (val < 0.0 ? 2 : 1); // . and -
flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
for (int i=flen; i<len; ++i)
Serial.print(' ');
}
smartdelay(0);
}

static void print_int(unsigned long val, unsigned long invalid, int len)
{
char sz[32];
if (val == invalid)
strcpy(sz, "*******");
else
sprintf(sz, "%ld", val);
sz[len] = 0;
for (int i=strlen(sz); i<len; ++i)
sz = ' ';

  • if (len > 0)*
  • sz[len-1] = ' ';*
  • Serial.print(sz);*
  • smartdelay(0);*
    }
    static void print_date(TinyGPS &gps)
    {
  • int year;*
  • byte month, day, hour, minute, second, hundredths;*
  • unsigned long age;*
  • gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);*
  • if (age == TinyGPS::GPS_INVALID_AGE)*
    _ Serial.print("********** ******** ");_
  • else*
  • {*
  • char sz[32];*
  • sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d ",*
  • month, day, year, hour, minute, second);*
  • Serial.print(sz);*
  • }*
  • print_int(age, TinyGPS::GPS_INVALID_AGE, 5);*
  • smartdelay(0);*
    }
    static void print_str(const char *str, int len)
    {
  • int slen = strlen(str);*
  • for (int i=0; i<len; ++i)*
    _ Serial.print(i<slen ? str : ' ');_
    * smartdelay(0);*
    }

Take a photo of your setup. Draw a schematic of the wiring. Post both photos along with the link to the adafruit site for the gps
and if possible the datasheet.

This:

At present, when I run the tinygps code listed below, I get gibberish from the arduino serial monitor:

Is often caused by a failure to match the baud rate in the arduino IDE (or other terminal program) with the one used to setup serial in the sketch. Until you see this:

Testing TinyGPS library v.

You're not going to see anything sensible from the GPS. The software serial baud rate may need adjustment too, but get to the point where you can see that initial message before you bother changing it.

The code you show is straight from the tinygps+ example list.
The baud rate on the G|PS systems I have tried this with.. are either 4800 or 9600 never seen Gps going at 115+ its far to fast when these devices are on a 1 or 10 Hz sample setting..

The GPS modules are generally DTE configured so need a cross in cable/

UNO tx to gps RX
UNO rxto gps Tx
UBO Gnd to gps Gnd

I have gad gos going ob UNO with ss but aMega with the extra hardware Uarts I find nmore reliable.
Happy Coding.. 8) 8)

The GPS modules are generally DTE configured so need a cross in cable/

Not that it matters but the Nomenclature for that cable has always been "NULL MODEM" because in the beginning , the only devices (or most of them) using RS232 were modems (back before the internet) and the modems were already wired that way so you didn't need the crossover, but when someone wanted to connect two computers (there were no PC's back then since they didn't exist until early 1980's with IBM's IBM-PC . All the computers were CPM written by DEC because there was no DOS either .
They were business and scientific computers and for example a PCC-2000 sold for about $12,000. (I got one used for $100 but it
took some work to get it going).

All the computers were CPM written by DEC because there was no DOS either .

CP/M was by Digital Research - not DEC. DEC had a DOS for their PDP/11 minicomputer systems in the early 1970s.

Pete

Yes, your right,, I got those mixed up.

When one buys a product from a company like Adafruit or Sparkfun, you get the benefit of their software and in most cases, Adafruit even has the necessary libraries. If you are having difficulties with non-Adafruit GPS lib, the fall back and test with the Adafruit lib and examples!!!

Thanks everyone for your replies. Very helpful. I have gone to the adafruit site and am able to access the NMEA data stream now using the code they provide for their GPS. However, I am hoping to use Tinygps, since it will help facilitate importing data into Google Earth's GPS Visualizer. I am able to see the tiny tinygps data fields now, but no data seems to be coming from the arduino, at least it is not being read properly. Here is what I am getting:

esting TinyGPS library v. 13
by Mikal Hart

Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum
(deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail

**** **** ********* ********** **** ********** ******** **** ****** ****** ***** *** ******* ****** *** 0 0 0
**** **** ********* ********** **** ********** ******** **** ****** ****** ***** *** ******* ****** *** 0 0 0


Below is picture of set up.

Arduino - GPS
5V VIN
GND GND
3 TX
4 RX

Asterixes are what you get from TinyGPS when it doesn't have a fix, which may occur if your GPS can't see enough satellites. Did you get actual Lat long position data from the adafruit sketch? If not, you'll need to move closer to a window or go outside.

Note also that the GPS may take a while (a few minutes) to get a fix from a cold start.

Thanks Wildbill. It appears I am getting a good lock. Here is a parsed code again from adafruit and it seems to be good data with a 7 satellite lock:

Time: 15:20:18.0
Date: 21/4/2014
Fix: 1 quality: 2
Location: 4017.7551N, 11140.2353W
Speed (knots): 0.06
Angle: 51.12
Altitude: 1471.80
Satellites: 7
$PGTOP,11,26E
$GPGGA,152019.000,4017.7554,N,11140.2356,W,2,7,1.11,1471.8,M,-16.4,M,0000,0000
56
$GPRMC,152019.000,A,4017.7554,N,11140.2356,W,0.13,51.12,210414,,,D46
$PGTOP,11,2
6E
$GPGGA,152020.000,4017.7554,N,11140.2356,W,2,7,1.11,1471.8,M,-16.4,M,0000,00005C
$GPRMC,152020.000,A,4017.7554,N,11140.2356,W,0.18,51.12,210414,,,D
47
:
Yet, when I try the tinygps code, I still get the asterisks? Hum... Any suggestions?