Search code examples
arduinogpsuartandroid-gps

NEO-6M GPS module loses its accuracy on arduino uno


I have a NEO-6M GPS module and I want to use it for date,location and time. Now, when the NEO-6M is set default to 115200 baud rate and when I use ttl converter to get signals from the GPS module it works just fine but when I try to use Arduino Uno and read signals from it, it sends garbage values.

$GNGGA,114213.000,2238.34233,N,07549.90950,E,1,17,0.8,535.6,M,0.0,M,,*78
$GNGLL,2238.343,595,4.0@6$SA00,6,4,,88.E$SA00169,,,,,8.0$SA779,,,88.D$S410,,,2,,,,,3314
G,,,12,0,,9,96,62
GS,419,255373,2557
G44,,0,1,0,*
D,1,,3,050218736,54
BV,89,4,,1,,33235728$S207,.32,8837202
LV25,,9*
NC430,843041000439,*GT.,M.N.K*
NA430,,200
GT11,TAK
$GNGGA,114214.000,2238.34233,N,07449.91952,E,0,17,0.8,535.6,M,0.0,M,,*7D
$GNGLL,2238.343,595,4.0,3"SA0066,4,,88.E$SA,0169,3,,,860GSA779,,,8,.D$S411,,,2,,2,,73,4
G,1,1286409016127$G4,292,,0,234,,0,
GV,,1,6746,8
BV,06312,,,,31,13328$S2,17520566,,7,,226
G,1,,93,2,,2,,06*
LV2,,,9*
N,440,843049200409,*
N,4,,0,0,2$Z120,,24,*GX11,T K
$GNGGA,114315.000,2238.34260,N,07549.91955,E,1,17,0.8,535.9,M,0.0,M,,+72
$GNGLL,2238.3460595110A4
A,34,,1,,.,,6
BA369,,,26,18,*
LA,,9,,,1016
GV,412011,6210,25F$S41005007,,3,,,,*
PV34,,,6,1,,,,8,4A$S4,33379262D$S2,0432931,3,56854
BV,89746,,,233,,2,6
L,1,,03,2,,2,9,6*
LV259,9*
N,450,34,041509.09,*
N,4,08,6,2$D12.,,24,*$P,,,AEO*

I want to lower the baudrate of the GPS module to 9600 but I can't seem to find any way to do It. The connection to the rx and tx pins is very very short so I don't think that it is causing the problems.

THe code

#include <SoftwareSerial.h>



void setup() {
  Serial.begin(115200);  // Begin serial communication with the PC
  Serial1.begin(115200);  // Start software serial for GPS module at 9600
}

void loop() {
  while (Serial1.available()) {
    Serial.write(Serial1.read());  // Forward GPS data to the Serial Monitor
  }
}

Solution

  • I got it working by reading the documentation and this code

    #include <SoftwareSerial.h>
    
    // Create a software serial port on pins 10 (RX) and 11 (TX)
    SoftwareSerial gpsSerial(10, 11);
    
    void setup() {
      // Start the software serial communication with the GPS module at 9600 baud (default for NEO-6M)
      Serial.begin(115200);
      gpsSerial.begin(115200);
      delay(1000);  // Allow some time for the GPS module to initialize
    
      // Send the PUBX command to change the baud rate to 19200
      gpsSerial.println("$PUBX,41,1,0007,0003,19200,0*25");
    
      // Wait a moment for the command to take effect
      delay(1000);
    
      // Update the software serial to communicate at the new baud rate
      gpsSerial.begin(19200);
    }
    
    void loop() {
      // You can now communicate with the GPS module at 19200 baud
      if (gpsSerial.available()) {
        Serial.write(gpsSerial.read());  // Forward GPS data to Serial Monitor
      }
    }