NEO 6M GPS & Arduino UNO

Hi all, I've been having issues trying to get a NEO 6M GPS to talk to my Arduino UNO.
I'm using Arduino 1.0.5

Here is the gps data sheet
http://www.u-blox.com/images/downloads/Product_Docs/NEO-6_DataSheet_(GPS.G6-HW-09005).pdf

Here is the latest code I've tried

#include <SoftwareSerial.h>
#define RXPIN 8  // From the GPS to the Arduino
#define TXPIN 10 
SoftwareSerial mySerial(RXPIN, TXPIN);

void setup() 
{
  Serial.begin(57600);// old 57600 New 115200
  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600); // old 4800 new 57600
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  //mySerial.listen();
  //Serial.print(mySerial.available() + "\n");
  if (mySerial.available()>0){
    byte c = mySerial.read();
    Serial.print(c + "\n");
  }
  delay(100);
}

and here is the output from the Serial Monitor

Goodnight moon!
% 
ight moon!
% 
t moon!·a\Ma~a^a§a$#odnight moon!
% 
ight moon!
% 
t moon!·a\Ma~a^a§a$?ght moon!moon!!Ð a$µ0P2ng  ×µ0P2n$$$$
?×åNÈï
P1% = '(Ìoon!oodnight moon!´a78?(º
?×åNÈï
P1% = *+A 
lo, world?t moon!a78c

etc. etc. etc.

Any help would be greatly appreciated.

  mySerial.println("Hello, world?");

What, exactly, is the GPS supposed to do with this?

    byte c = mySerial.read();
    Serial.print(c + "\n");

Why are you ADDING a value to c? This is NOT how to print a carriage return after the letter.

Hi PaulS,
Thanks for the reply. I'm quite new to the Arduino so most of the code I've been using is cut and paste.
I have removed the println to the GPS, I guess it was just causing extra noise?

How should I be adding a carriage return?

oops, made a mistake when I paste the code, c was a char.
I've made a few changes, uploaded and copied the response. Still nothing like what I want.

The new code

#include <SoftwareSerial.h>
#define RXPIN 8  // From the GPS to the Arduino
#define TXPIN 10 
SoftwareSerial mySerial(RXPIN, TXPIN);

void setup() 
{
  Serial.begin(57600);// old 57600 New 115200
  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600); // old 4800 new 57600
}

void loop() // run over and over
{
  //mySerial.listen();
  //Serial.print(mySerial.available() + "\n");
  if (mySerial.available()>0){
    char c = mySerial.read();
    Serial.print(c);
  }
  delay(100);
}

the output

Goodnight moon!
4Öï"ÿÿ^ß{ï!

etc. etc. etc.

If c was a byte it outputs numbers if that is any help.

How should I be adding a carriage return?

That's what the println() method does (as opposed to the print() method).

  Serial.begin(57600);// old 57600 New 115200
  mySerial.begin(9600); // old 4800 new 57600

None of the above. Useless comments are worse than no comments.

Are you sure that the GPS communicates at 9600 baud? Is the Serial Monitor set to 115200?

  if (mySerial.available()>0){
    char c = mySerial.read();
    Serial.print(c);
  }
  delay(100);

Read a character, if one is available, and print it. Wait forever, and repeat. No, not a good idea.

The if statement should be a while statement. The delay() is useless in either case. There is data to be read, as fast as possible, or there isn't. Sitting on your thumbs for a while, in either case, is useless.

PaulS:
That's what the println() method does (as opposed to the print() method).

of course, silly me.

PaulS:
None of the above. Useless comments are worse than no comments.

useless comments removed.

PaulS:
Are you sure that the GPS communicates at 9600 baud? Is the Serial Monitor set to 115200?

I have used the u-center software and a FTDI to make sure the GPS actually work and the u-center software is saying 9600 baud.

The serial Monitor is set to 57600 baud

PaulS:
Read a character, if one is available, and print it. Wait forever, and repeat. No, not a good idea.

The if statement should be a while statement. The delay() is useless in either case. There is data to be read, as fast as possible, or there isn't. Sitting on your thumbs for a while, in either case, is useless.

I've updated the code to use a while loop and removed the delay. This is probably the closest I've seen to the output I want. There is still a lot of gibberish but I can see some lines that look right.

here is the updated code

#include <SoftwareSerial.h>
#define RXPIN 8  // From the GPS to the Arduino
#define TXPIN 10 
SoftwareSerial mySerial(RXPIN, TXPIN);

void setup() 
{
  Serial.begin(57600);
  Serial.println("Goodnight moon!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop()
{
  while(mySerial.available()>0){
    char c = mySerial.read();
    Serial.print(c);
  }
}

see attached for the output.

Does the good data match what you see when the device is connected via the FTDI cable to the PC?

Is there a relationship between the "garbage" and something that is missing (if anything is missing) from the output via the FTDI cable using the u-center application?

PaulS:
Does the good data match what you see when the device is connected via the FTDI cable to the PC?

Yeah, it's a good match without the garbage. (see text console attached)

PaulS:
Is there a relationship between the "garbage" and something that is missing (if anything is missing) from the output via the FTDI cable using the u-center application?

When I open the Binary Console in u-center I can see output that is similar to the garbage around the useful info so I assume there is something I need to filter out?

When I open the Binary Console in u-center I can see output that is similar to the garbage around the useful info so I assume there is something I need to filter out?

There may be a way to configure the GPS to simply not send that data.

PaulS:

When I open the Binary Console in u-center I can see output that is similar to the garbage around the useful info so I assume there is something I need to filter out?

There may be a way to configure the GPS to simply not send that data.

Any idea how that would be?

I connected to the GPS through the UNO and it almost displays the correct information, but not enough to be useful. Anything else you think of that might be able to help?

Bump,

Anyone got any ideas on what I could do to get my GPS going properly? or even point me in the right direction? I'm pretty much totally out of ideas...

My U-Blox 6 defaults at 4800 baud and quite well at that, although I did try once to re-program it to a higher baud rate (56.7K) but the programmming went away whhen I dispowered it... What ever you were displaying from the GPS looks like it is read at the wrong baud rate. What you see in the U-Blox binary window has Nothing to do with the NMEA serial data stream being sent by the GPS device... It is also VERY possible that you might need to put the receiver closer to a wondow because that bad data you are seeing could be bad reception, Although I saw one GPRMC message I couldn't see all of it as it ws garbled possibly due to your code, try TinyGPS12 by Mikal hart for better information sketches and libraries.