Beginner's guidance: GPS Module NEO 6M

Hey everyone, I'm starting my first Arduino project where I wanna get a location through the GPS module (NEO 6M GY-NEO6MV2) and the Arduino Pro Mini and after checking a couple tutorials online I followed this schematic (using the Arduino Pro Mini instead):

And this youtube tutorial for the coding https://www.youtube.com/watch?v=pVcjXIG4KW8 timestamp: 6:30 - 7:30. TL;DR: He didn't add any code to the arduino, just named the file "gps_arduino" and got it working.

It didn't work for me, plus noticed the GPS led isn't blinking for me like it is in the video. Tried another tutorial with another code but it also didn't work and the led still isn't blinking like in the tutorials (All the tutorials were for the same GPS Module I have), so I'm thinking no code is working because maybe the GPS module ain't working right.

So I'm wondering if there's a way to know if my GPS module is working correctly? Thanks in advance everyone.

Did you allow the GPS receiver to initialize its satellite data almanac by operating it with a clear view of the sky for as long as 15 minutes? Until the receiver knows the approximate time and location, it can't lock instantly.

Yes, there is a way to test it. Connect a serial port directly to the receiver serial connections, open the port with a serial terminal emulator like Putty (or use the crippled serial monitor), and read the NMEA messages.

Here is my GPS module test code. If the GPS module has no lock it should still spit out NMEA sentences although the sentences will be empty of real data. The empty sentences will look like:

$GPRMC,,V,,,,,,,,,,N53
$GPVTG,,,,,,,,,N
30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$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
$GPGLL,,,,,,V,N
64
$GPRMC,,V,,,,,,,,,,N53
$GPVTG,,,,,,,,,N
30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGLL,,,,,,V,N*64

Test code. Note that only the GPS TX is connected to Arduino RX (pin 4).

//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\n");
  
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

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

If you get the empty sentences, take the Module outside with a clear view of the sky. No buildings, trees or heavy clouds. You should see the time data in the $GPRMC sentence first.

$GPRMC,015915.00,

That means 01 hours, 59 minutes and 15.00 seconds GMT UTC.

Then, in a while, you should start to get lat, lon and other data once it finds satellites.

1 Like

Hi sadeste.

You might be getting confused from the different videos. In the first video, he is using pins 0 & 1, and you are using 3 & 4.

His sketch is doing nothing at all. The purpose of this is to make sure it does not use the serial port (pins 0 & 1).

If you connect the GPS TX to the Uno TX pin all data sent from the GPS will automatically appear in the IDE monitor.

Instead of an empty sketch you can ground the RESET pin -- this suppresses whatever sketch is loaded.

Groundfungus has shown how to use software serial to get the data to/from pins 3 &4.

My sketch uses pin 4, only. There is no need for the GPS RX pin to
be connected.

The next step, once the GPS is receiving data, is to choose a library an try the library examples. TinyGPS is a popular library.

I have an Android app that displays the NMEA sentences (not scrolling) and extracts the relevant parameters such as LAT, LON, Number of Sats....

Works very well. Much better than a terminal app. You feed the GPS output to the phone or tablet via an OTG cable.

Link to the app file (type .apk, ready to install):

http://ai2.appinventor.mit.edu/b/680p

The link is only accessible for the next 2 hours.

Hey, thanks for your reply and sorry I didn't reply before, I tried your code instead and uploaded it successfully into my Arduino but I still am getting empty sentences and I couldn't try it out outside because it was late night here when I posted this and it was raining, I decided to try it out this morning (there isn't a clear view of the sky but at least it isn't raining anymore) but I still get empty sentences, I'll try again when there's a clear view of the sky but I'm starting to think my GPS module isn't working right, is there another way to know this so I can try it out while I wait for the sky to clear out? Once again, thanks in advance.

Hey thanks for your reply!

And in all the tutorials I've seen (including Groundfungus' advice) it didn't matter what pins they were using because I noticed that and I used Pins 8 and 9 (also changed the tutorials code to these pins). But I'm not using the Arduino UNO, I'm using the Arduino Pro Mini...for what I've seen, everything should work fine like there is but it doesn't. Thanks in advance if you have any other tips!

Empty sentences, of the type in post #3, are indicitive of a GPS that is faulty or has no or a faulty antenna, or has only been powerd for a few seconds, assuming the GPS is outside with a clear view of the sky.

A working GPS, that has a good antenna will when it is outside with a clear view of the sky pick up the time in maybe 10-15 seconds and report a fix in 40 - 60 seconds. This is the normal behaviour even for a factory fresh GPS.

1 Like

That's what I've been thinking too, I'm gonna try it out again when the sky clears out completely (it's been cloudy these days) and if not I'll get a new one, thank you so much!

'Cloudy' conditions do not have a measuarble affect that I have noticed in several years of testing.

Very heavy rainfall, does slow the first fix time a bit, but not enough to be concerned about.

1 Like

Don't junk it until you have tried it outside. Clear view of the sky means out in the open, away from trees or buildings if you want to be sure.

1 Like

A module that has been sitting on the shelf for ages, may have lost its almanac due to its backup battery draining. That is different than "factory fresh". Then it has no idea of the time or location, and has to seek the pilot signal that all the satellites transmit. That may take more than a few seconds - could be up to 15 minutes because sometimes all the signal quality factors add up to a worst case scenario.

1 Like

I tried it out again this afternoon, the sky was clearer than before and after 20 minutes or so the only thing I received was this:

I don't know if this is good or bad sign though, I've searched a bit but didn't find anything useful, just that "This is the result when no valid GPS messages are received. There are many possible reasons for this, including GPS not functioning, not seeing satellites, incorrectly wired, incorrect communications parameters, etc. ". Didn't find anything else.

That looks like you have a baud rate mismatch somewhere.

1 Like

Hmm I'm new on this, you mean in the code or the COM3 prompt? I got the Arduino Pro Mini 5v 16Mhz and from the little I know it should work with 9600 but some people set the baud rate to 19200, I did switch to 19200 in the COM3 prompt but didn't change code value, I can give it a shot when the sky clears out again.

So you have the GPS TX pin wired to pin 8 on the Uno?

You should get at least the empty NMEA sentences that I showed in reply #3 even inside.

$GPRMC,,V,,,,,,,,,,N53
$GPVTG,,,,,,,,,N
30
$GPGGA,,,,,,0,00,99.99,,,,,,48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99
30
$GPGLL,,,,,,V,N64

If you are seeing nothing readable like the above then there is a problem.

Try changing mySerial.begin(9600); to mySerial.begin(4800); The usual default for the Neo6M GPS is 9600, but maybe the one that you have is different (I don't think so but it's worth a shot).

Serial should be at 9600 (Serial.begin(9600);) and serial monitor should be at 9600.
serial mon

1 Like

A much more straightforward echo goes like:

if ( mySerial.available() ) {
  Serial.write( mySerial.read() );
}

I have tried a great many GPSs that have been sitting on the shelf for ages, years even.

If they are working properly they get a fix in under a minute, which is the specification as per the datasheets.

Yes, GPS TX is wired to pin 8 but it isn't the UNO, it's the Arduino Pro Mini 5v 16Mhz and no, I don't get anything anywhere, COM3 is empty. I'll try again adding what you said here, thanks again for your reply and your time!