GPS prints out gibberish

Hello everyone,

I have recently bought a m100 5883 GPS for a project me and my friends are doing. However, when I connect it to the arduino (Uno r3) and try to print out the NMEA sentences so that I can get the latitude, longitude etc., the GPS prints out gibberish (see attached image) when it should print out the NMEA sentences like this.

$GPGGA,123456.00,3751.65,S,14507.36,E,1,08,0.95,545.4,M,46.9,M,,*47

I have tried many things, such as

  • changing Baud of the serial monitor and GPS. This has decreased the amount of weird characters, but has yet been able to print correct NMEA sentences.
  • Changed and rechecked wiring, but no improvement (see image for wiring)
  • Put the GPS outside with a clear sky, no noticable change

One important fact to note is that I have managed to get normal NMEA sentences with the following setup: Wire TX and RX wires to the TX and RX pins on the arduino (pin 0 and 1), however, when I then proceed to run the program, it prints out NMEA sentences but stops after a second and starts printing out "Reading GPS data...". When pressing the reset button on the arduino, it again prints out NMEA sentences, but stops after a second.

I have genuinely no idea what causes the GPS to print out gibberish. I haven't tried it out on a windows computer, as i myself work on a mac. Could that possibly be the issue? Or is there another problem here that I have missed?

The code:

#include <SoftwareSerial.h>

#define RXPin 10 // GPS TX → Arduino RX
#define TXPin 11 // GPS RX → Arduino TX
#define GPSBaud 115200 // Set to 9600 for most modules

SoftwareSerial gpsSerial(RXPin, TXPin);

void setup() {
  Serial.begin(115200); // Monitor baud rate
  gpsSerial.begin(GPSBaud); // GPS module baud rate
  Serial.println("Reading GPS data...");
}

void loop() {
  while (gpsSerial.available()) {
    char c = gpsSerial.read();
    Serial.write(c); // Directly print raw GPS data to Serial Monitor
  }
}


Unfortunately software serial won't work at 115200 baud. I wouldn't try above 19200 baud, possibly 38400.

Can you configure the GPS module for a lower baud rate?

1 Like

Do you have access to a Mega or Leonardo or Micro/Pro Micro? Any Arduino model with additional hardware serial (UART) ports?

Test on such an Arduino using an available hardware serial port for the GPS.

You use pins 0 and 1 but the code uses pins 10 and 11.
So how do you want it to work?

Im sorry if I was vague, but I am using pin 10 and 11 because pin 0 and 1 give the problem I described with the serial monitor printing "Reading GPS Data..." (basically looping the void setup part of the code).

Maybe, but I have no idea how to do that. I am new to this kind of stuff, so if you have any helpful sources i could check out related to this, I would appreciate it :slight_smile:

Yes, I'll try to use another board, maybe that will work. Thank you for the suggestion!

You can't use pins 0 and 1 on Uno. They are the pins for the Uno's only hardware serial port which is dedicated to uploading code to the Uno from the PC and using serial monitor.

On Uno, the only way to use the hardware serial port is to upload your code with no other components connected to those pins, then disconnect the PC and connect the other components. Obviously this makes it impossible to use serial monitor to check what is going on.

Do you have the user manual for the GPS? Does it give any indication that alternative baud rates can be selected?

Apparently the module uses the U-blox protocol that's why UNO receives strange characters.

The GPS appears to be an M10, which is a Ublox.

In which case these commands, sent at the GPSs current baud rate should change the baud rate accordingly;

//PUBX messages to change baud rate
//These baud rate commands set the allowed in protocol to UBX,NMEA,RTCM2 and out protocol to UBX,NMEA
GPSserial.print("$PUBX,41,1,0007,0003,4800,0*13\r\n");     //4800 baud
GPSserial.print("$PUBX,41,1,0007,0003,9600,0*10\r\n");     //9600 baud 
GPSserial.print("$PUBX,41,1,0007,0003,19200,0*25\r\n");    //19200 baad
GPSserial.print("$PUBX,41,1,0007,0003,38400,0*20\r\n");    //38400 baud
GPSserial.print("$PUBX,41,1,0007,0003,57600,0*2B\r\n");    //57600 baud
GPSserial.print("$PUBX,41,1,0007,0003,115200,0*18\r\n");   //115200 baud

From what I’ve seen from the user manual, the only baud rate this gps works on is 115200.

Did you try the commands provided by @srnet in post #11?

I have never come across a Serial GPS that only has one baud rate.

Might be an idea to provide the forum with a link to the datasheet ?

1 Like

Hello timarh

You might use a terminal program to check the com parameters.

Have you tried 9600 baud?
Just a thought...

1 Like

I have tried the commands, but they still all prints gibberish. When using the command to set the baud rate to 115200, it works best, showing the least amount of weird characters, but it still doesnt print out normal NMEA sentences. Should i try higher baud values?

This is a QR code to the manual. They use another program to calibrate it or something. Is this necesarry for arduino?

I tested the GPS by connecting it directly to pin 0 and 1 (the RX/TX pins) without any code and it prints out NMEA sentences without gibberish. The moment i start adding code, it prints out gibberish again. In a few days Ill be able to test this GPS on another Arduino, maybe that it wont print gibberish that time.

I find that hard to believe. If you can change the baud rate to a lower value - such as 9600 - then it should work much better.

As I mentioned previously, attempting to use software serial above 19200 or maybe 38400 is not a good idea.

You receive gibberish because trying to use a software serial port on an UNO at 115200 baud is unreliable, as you have discovered.