SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By Dr. Nefario
#159517
Well, I figured I'd like to take a look at trying to get some GPS data from my recent purchase of the GPS-11466. I also purchased: GPS-09123 and BOB-10402.

I'm at a loss on where to start to try to develop some simple code for this though. This being my first thing I've ever coded for my mega (minus the "blink" program modification). I took a loot at this library: http://arduiniana.org/libraries/tinygps/ and thought it looked pretty simple to use. So I grabbed my Mega 2560, bread board, and hardware and hooked it up to 3.3V, gnd, rx -> pin3 and tx -> pin4. I mean the library looks very I simple to use. I opened the simple_test sketch and uploaded it to the controller. I opened up the serial port monitor and I'm getting the following:

CHARS=0 SENTENCES=0 CSUM ERR=0 repeatedly. I put in some Serial.println (write) statements along the way, and it looks like the SoftwareSerial is not available. The code segment that I added
Code: Select all
Serial.write("Software Serial is available");
is not being output when I run the program, which clues me off as to the start of the problems perhaps.

I guess I'm at a loss and as much as I hesitate to ask for a guaranteed working source code, does anyone have a link to some source code that I can upload to my Mega 2560 and verify that the GPS module is in fact working? Or if not, can someone point me in the right direction?

Thanks in advance. Below is the sketch I'm using.

- Josh

In the code:
Code: Select all
#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 3(rx) and 4(tx).
*/

TinyGPS gps;
SoftwareSerial ss(3, 4);

void setup()
{
  Serial.begin(115200);
  ss.begin(4800);
  
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      Serial.write("Software Serial is available");
      char c = ss.read();
      Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
  
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
}
By jremington
#159518
The best way to test the GPS module is to connect it to a PC using a TTL-RS232 serial USB interface (the FTDI from Spark Fun will work https://www.sparkfun.com/products/718) and check the output using a terminal program like Putty or Teraterm. Note that the default baud rate from the GPS-11466 module is 9600, not 4800 as comments in your posted program state.
By Dr. Nefario
#159578
Is there a direct way to interface with the arduino without the FTDI cable? Can I use puTTy to connect to the arduino or the GS407 directly without the FTDI cable?

I tried to make mine from an old USB cable not realizing that there was a level converter in the one I saw online, so I ordered the FTDI BOB that you suggested. It should be here by Friday (gotta love Sparkfun's ridiculously fast shipping).

That all being said, I'm going to change and reupload the sketch. Something is telling me it's a software serial issue. I'll post back here in a bit with results.
Last edited by Dr. Nefario on Wed May 15, 2013 6:55 pm, edited 1 time in total.
By jremington
#159582
Your question is unclear. The GPS unit uses 3.3 V "TTL" levels for serial communication with anything. It can be connected directly to a microprocessor with 3.3 V I/O ports, but then you have to run software on the micro to talk to the GPS and/or a PC (also connected to the micro by some sort of an adapter). If you don't understand that software then it is unlikely to work correctly the first time around. In your case, the most obvious potential problem with the software (aside from possible wiring issues) is the baud rate mismatch evident from the code you posted.

With the FTDI 3.3 V serial - usb adapter, and a terminal program on a PC, all you have to do is connect the grounds and TX (GPS) to RX (FTDI) to see the messages output by the GPS. The baud rate must be correct, but even if it isn't, you will see nonsense characters on the terminal window.
By Dr. Nefario
#159752
interesting enough, I hooked everything up as it should be as shown in the image: https://dl.dropboxusercontent.com/u/181 ... .35.33.jpg

I opened puTTy and selected the correct com port (4), but all I get is a blank screen, even when connected to 3.3v, GND, and TX(gps) to RX(FTDI). I get nothing. I do notice that when I select the terminal window and I try typing characters into the terminal, the tx led comes on and flashes for every keystroke, so I am assuming that puTTY IS working and correctly connected to the COM4, or that would not happen, I'm just getting absolutely nothing from the GPS. I guess the million dollar question is could my GPS module be bad?
By Dr. Nefario
#159754
When I open a terminal window, should I get a response back to the terminal or is it going to be blank?

EDIT: So I hooked up my OpenLog and opened a terminal window to it, keyed in a bunch of keys, popped the uSD card out, and viola, there's the data I was typing into it. So I know the FTDI board is correctly installed and windows sees it just fine. Also when I put the uSD card into the OpenLog, '12<' appears in the terminal window. Nothing else, just that. I'm going to assume that's the norm.

So I decided to try to hook up the GPS to the openLog (who knows maybe something is ary, but I'll see if I am getting data). I have the 3.3v, gnd, and tx(FTDI) -> RX of my OpenLog, and also I have 3.3v, gnd, and tx(GPS) -> rx(FTDI). At this point if the GPS was working, I SHOULD see something across the card at a minimum, if not across the terminal window. I am getting NOTHING from the GPS. Should I try to bump up the voltage to 5v?
By jremington
#159755
I wonder if you need to connect a battery, or perhaps the 3.3V power to the "BATT" terminal as well.

All GPS modules that I know of transmit a message at least every second, although some won't transmit until they have a satellite lock (make sure you are outside with a clear view of the sky). If you have access to an oscilloscope, check to see if there are transitions on the TX pin. If not, the module may not be functioning correctly.

It isn't clear from the data sheet whether there is an LED on the module that indicates status. If not, connect one to the pin provided (see the data sheet for a circuit). The LED signal is completely independent of any serial connections and will also tell you if a satellite lock is in effect.

If nothing else, contact Spark Fun technical support.
By Dr. Nefario
#159781
jremington wrote:I wonder if you need to connect a battery, or perhaps the 3.3V power to the "BATT" terminal as well.
IDK, I really am not sure at this point. I have a DSO203 pocket oscope here, I am going to try to get something off of the TX pin, but it's not very promising right now, as I am not getting anything at this point.
jremington wrote:All GPS modules that I know of transmit a message at least every second, although some won't transmit until they have a satellite lock (make sure you are outside with a clear view of the sky). If you have access to an oscilloscope, check to see if there are transitions on the TX pin. If not, the module may not be functioning correctly.

It isn't clear from the data sheet whether there is an LED on the module that indicates status. If not, connect one to the pin provided (see the data sheet for a circuit). The LED signal is completely independent of any serial connections and will also tell you if a satellite lock is in effect.

If nothing else, contact Spark Fun technical support.
JRemington, Thanks for all your help, it turns out the GPS module is bad. I tested it with my DS203 and got nothing on the tx pin. I even split my 6 pin GPS-09123 cable and soldered pins to each wire to put onto my bread board. Nothing on the TX pin at all. Time to RMA. It sort of makes me mad seeing this since now I have to wait even longer to play with the GPS module, but it happens right?

Thanks again m8

- Josh
By Dr. Nefario
#160245
Jremington (or anyone for that matter), should the LED be solid or have a 1pps flash? The led that I hooked up to the new GPS module is flashing.

EDIT: If I would have just RTFM closer. Flashing @ 1PPS means it fixed on the satellite. However, I am not getting anything via puTTy, but it appears that it is working since I am getting the LED pulsing.