Ublox Neo6m TinyGPS starts over on it's own and sends wired data

Hello Community

If I launch the code of my GPS, it print's this in the serial monitor, and not the data it should:
" GP?GP?GPGPGPGP?GPGP?GGP?GPS Start
GP?GP?GPGPGPGP?GPGP?GGP?GPS Start
GP?GP?GPGPGPGP?GPGP?GGP?GPS Start
....
....
....
....
"

I am on the corect bound rate of 9600, as well as it is connected in the right way to my board, and I know that the GPS has a lock as the blue led is blinking. It is also not possible that the GPS doesn't work, because one day it works and an other it doesn't. I also tried with three different arduino uno, and three different Neo6m GPS, and It always gives me the same exact return.

My code is written below:

Does anyone know what the problem could be ?

Thanks already

#include "TinyGPS++.h"
#include "SoftwareSerial.h"


SoftwareSerial serial_connection(2, 3); //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("");
  }
}

If properly connected, the serial monitor can only display what you tell your Arduino to print. The first thing that you told your Arduino to print was "GPS Start" and your post never described receiving this, so something must not be connected correctly.

Please show your connections. Also tell us about your Arduino, your PC, etc.

Thanks for your quick respond... :slight_smile:

I connected:

VCC to 5V
RX to Pin 3
TX to pin 2
GND to GND

And I'm using an usual Arduino UNO

But what I did regognize is that the First line it prints is GPS Start, and then it repeats all the wired stuff......

Try this -

#include "TinyGPS++.h"
#include "SoftwareSerial.h"


SoftwareSerial serial_connection(2, 3); //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

/ For stats that happen every 5 seconds
unsigned long last = 0UL;

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() > 0) //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("Latitude:");
    Serial.println(gps.location.lat(), 6);
    Serial.println("Longitude:");
    Serial.println(gps.location.lng(), 6);
  }

  else if (gps.satellites.isUpdated())
  {
    Serial.println("Satellite Count:");
    Serial.println(gps.satellites.value());
  }

  else if (gps.speed.isUpdated())
  {
    Serial.println("Speed MPH:");
    Serial.println(gps.speed.mph());
  }

  else if (gps.altitude.isUpdated())
  {
    Serial.println("Altitude Feet:");
    Serial.println(gps.altitude.feet());
    Serial.println("");
  }
}

NOTE, there are examples for this library, good luck.

It could be several things, like insufficient power, but I would suggest reading this. It takes you through the process of connecting a GPS module:

  • Pick a good connection. Pins 2 & 3 are not the best choice. 0 & 1 would be best, followed by 8 & 9.

  • Connect the GPS safely. Some GPS devices are 3V devices, not 5V like the Arduino. You can damage the GPS device if you connect the Arduino transmit pin to the GPS receive pin. It can also draw too much power.

  • Pick a software serial library if you can’t use 0 & 1. AltSoftSerial is best (pins 8 & 9 only). NeoSWSerial is next best (any two pins). SoftwareSerial is the worst choice.

After you have a system configuration, you can try the simple echo test:

#define gpsPort Serial // just an alias for Serial, if you can use pins 0 & 1

void setup()
{
  Serial.begin( 9600 ); //  This *is* gpsPort
  // gpsPort.begin( 9600 );   // not needed if gpsPort *is* Serial
}

void loop()
{
  if (gpsPort.available())
    Serial.write( gpsPort.read() );
}

You should see NMEA sentences on your Serial Monitor window, like $GPGGA.

If you don’t want to use 0 & 1, just use gpsPort for your variable name, and the rest of the sketch doesn’t have to change:

#include <AltSoftSerial.h>
AltSoftSerial gpsPort; // pins 8 & 9 ONLY

void setup()
{
  Serial.begin( 9600 );
  gpsPort.begin( 9600 );   // not needed if gpsPort *is* Serial
}

void loop()
{
  if (gpsPort.available())
    Serial.write( gpsPort.read() );
}

Or, for NeoSWSerial:

#include <NeoSWSerial.h>
NeoSWSerial gpsPort( 2, 3 ); // you don't have to connect pin 3 to receive GPS data.

void setup()
{
  Serial.begin( 9600 );
  gpsPort.begin( 9600 );   // not needed if gpsPort *is* Serial
}

void loop()
{
  if (gpsPort.available())
    Serial.write( gpsPort.read() );
}

And you could try the diagnostic program in NeoGPS. It displays some raw data and tries different baud rates. The NeoGPS library is also much faster, smaller, more reliable and more accurate than all other libraries. The examples are properly structured – the example you are using is ok.

AltSoftSerial, NeoSWSerial and NeoGPS are all available from the Arduino IDE Library Manager, under the menu Sketch → Include Library → Manage Libraries.

Cheers,
/dev