How to use GPS with Arduino - Parse and Log NMEA Sentences

I have done that then I was getting like this

You need to set the GPS/software serial baudrate back to 9600

115200 is between your computer and the arduino.
9600 is between the Arduino and your GPS.

Copy the code from the tutorial again :slight_smile:

I tried it again but it is giving me same type of error only
image

I noticed you’ve set your Software Serial set to Pins 18 and 19 - Have you got everything wired correctly (Rx to Tx and Tx to Rx)?

Got a photo so we can have a look and double check?

What GPS module are you using?

1 Like

I am using GPS sim28ml GPS module and I think I’m connecting tx to tx and Rx to Rx. I will change and see again and get back to you again Oliver

2 Likes

Mr. Oliver my Arduino is Nano, And the GPS module is GY-GPS6MV2, I upload your code and it gives me zero as shown if figure, I did all the steps but it doesn’t work, why??

That code assumes that valid GPS sentences are being received. You have to start from something much simpler than that. Replace the loop in that code with with a simple display of the raw data:

void loop() // run over and over again
{
  // read data from the GPS in the 'main loop'
  char c = GPS.read();
  // if you want to debug, this is a good time to do it!
    if (c) Serial.print(c);
}
3 Likes

Really helpful tutorial, one minor adjustment for those who have newer boards like the nano BLE33, SoftwareSerial is bundled into the package of the board, newer board won’t bundle this because the serial ports are not connected to the USB, or the computer. So just comment out //SoftwareSerial and use Serial1 instead. It will all work :wink:

eg:

#include <Adafruit_GPS.h>

#include <Adafruit_GPS.h>

//We can now create our Software Serial object after including the library

//SoftwareSerial mySerial(3, 2);

//And finally attach our Serial object pins to our GPS module

Adafruit_GPS GPS(&Serial1);

2 Likes