NEO6M doesnt retrieve coordinates correctly

Hi!

I am trying to get a gps location with a GPS module (Link to Bangood) using a arduino nano. I have tried a couple of libraries like TinyGPS, TinyGPS++ and Gpsneo (with google) but nothing works... When I try this code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(4, -1); // RX, TX

void setup()
{
   // Open serial communications
   Serial.begin(9600);
   Serial.println("Neo6M GPS module test code");
   // set the data rate for the SoftwareSerial port
   mySerial.begin(9600);
}

void loop()
{
   if (mySerial.available())
   {
      Serial.print(char(mySerial.read()));
   }
}

I get this output:

Neo6M GPS module test code
99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,,V,N*64
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30

Thanks beforehand!

Best regards Max

The "V" in the GPRMC line indicates no satellite lock. You need to be outside, with a clear view of the sky.

I went upstairs and now I am getting this output:

$GPGGA,203921.00,5956.09977,N,01658.07357,E,1,04,1.82,69.4,M,25.5,M,,*62
$GPGSA,A,3,31,01,32,17,,,,,,,,,3.02,1.82,2.42*08
$GPGSV,2,1,08,01,75,182,35,12,03,018,,14,03,266,,17,39,299,28*75
$GPGSV,2,2,08,19,22,320,18,22,,,32,31,13,110,30,32,34,055,20*47
$GPGLL,5956.09977,N,01658.07357,E,203921.00,A,A*61
$GPRMC,203922.00,A,5956.09979,N,01658.07363,E,0.601,,210421,,,A*71
$GPVTG,,T,,M,0.601,N,1.112,K,A*27
$GPGGA,203922.00,5956.09979,N,01658.07363,E,1,04,1.82,69.5,M,25.5,M,,*69
$GPGSA,A,3,31,01,32,17,,,,,,,,,3.03,1.82,2.42*09
$GPGSV,2,1,08,01,75,182,37,12,03,018,,14,03,266,,17,39,299,29*76

Witch seems much more promising. But how do I decode it into actuall cordinates?

You are at 59 degrees, 56.09979' N, 16 degrees 58.07363' E.

Google "NMEA sentences" for more information.

Thanks a lot for the help! Now it works! I am using this code if anyone else needs it:

#include <SoftwareSerial.h>
#include <TinyGPS++.h>

TinyGPSPlus gps;

SoftwareSerial ss(4, -1);

void setup() {
  Serial.begin(9600);
  ss.begin(9600);

}

void loop() {
  while(ss.available() > 0) {
      if(gps.encode(ss.read())) {
          if(gps.location.isUpdated()) {
              Serial.println(String(gps.location.lat(), 6) + "," + String(gps.location.lng(), 6));
            }
        }
      
    }

}

Not a good idea to use Strings with small Arduinos -- they cause program crashes.

Replace this

Serial.println(String(gps.location.lat(), 6) + "," + String(gps.location.lng(), 6))

With

Serial.print(gps.location.lat(),6);
Serial.print(", ");
Serial.println(gps.location.lng(),6);
1 Like

Hi!

I have been searching a lot to try and get my gps module to work but I cannot figure it out. I have a Arduino Nano and a GPS module that has a NEO 6m (Bought it from banggod). Right now I am trying to get it working with the TinyGps++ library but it is only showing symbols. I dont know what to do :frowning:, thanks beforehand!

Best regards Max

I changed baud and now I get the error "No GPS detected: check wiring".

I have wired TXD to D3 and RXD to D4.

Could be your code, or how you have the GPS connected to whichever Arduino you are using.

Then it's probably your code. or a faulty module. But who knows?

I dont know if Ive done this right, I have a arduino nano, currently I have not welded the pins to it, do I have to do that for it to function or is it enough to just put them in the holes without welding?

Hi,
You definitely should solder the pin headers on first, to make sure you get a stable connection to your gps. Also, try switching your RX and TX pins. Your GPS module might have a different baud rate than the standard 4800, so try switching that also.

Definitely solder the header to the GPS module.

The default baud rate for a Neo6M is 9600.

Here is test code for a Ublox Neo6M GPS module. Connect the GPS TX pin to Uno pin 4. The GPS RX pin remains unconnected as it is not needed.

//gps test

#include <SoftwareSerial.h>

SoftwareSerial mySerial(4, -1); // RX, TX

void setup()
{
   // Open serial communications
   Serial.begin(9600);
   Serial.println("Neo6M GPS module test code");
   // set the data rate for the SoftwareSerial port
   mySerial.begin(9600);
}

void loop()
{
   if (mySerial.available())
   {
      Serial.print(char(mySerial.read()));
   }
}

You should see something like the below when the GPS does not have a lock.

$GPRMC,155200.00,V,,,,,,,210421,,,N7A
$GPVTG,,,,,,,,,N
30
$GPGGA,155200.00,,,,,0,00,99.99,,,,,,65
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,01,28,,,2171
$GPGLL,,,,,155200.00,V,N
49
$GPRMC,155201.00,V,,,,,,,210421,,,N7B
$GPVTG,,,,,,,,,N
30
$GPGGA,155201.00,,,,,0,00,99.99,,,,,,64
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,01,28,,,2171
$GPGLL,,,,,155201.00,V,N
48

1 Like

I tried this but it only prints out "NEO6M GPS module test code"

This is my wiring, hopefully you can see what I've done, the nano is powered by the computer and my module has a mobile charger because it didn't power up by VCC to 5v.

Is the GPS TX pin connected to Uno pin 4?

Can you post a clear photo of your wiring?

The Nano 5V (Vcc) should have no problem powering the GPS.

Did you connect the ground of the charger to the Nano ground?

Do not connect the GPS RX to the Nano. There is no reason to connect the GPS RX pin.

I checked my weldings and now it works!!!! Thanks a lot for the help! Really appriciate it!

How do I decode it to a longitude and latitude?

My Serial.print looks like this:
$GPVTG,,,,,,,,,N30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,00
79
$GPGLL,,,,,,V,N64
$GPRMC,,V,,,,,,,,,,N
53
$GPVTG,,,,,,,,,N30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,00
79
$GPGLL,,,,,,V,N64
$GPRMC,,V,,,,,,,,,,N
53
$GPVTG,,,,,,,,,N30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,00
79
$GPGLL,,,,,,V,N64
$GPRMC,,V,,,,,,,,,,N
53
$GPVTG,,,,,,,,,N30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGSV,1,1,00
79

Your GPS does not have a lock yet. You are receiving data from the GPS, but it does not know where it is yet. Does the module have a clear unobstructed view of the sky? No roofs or trees?

To decode the GPS sentences you can use a library like TinyGPS.

1 Like