GPS NEO-N8M-0-10 faster sampling

Hello!

I installed the following code to ESP32S3, it communicates well on serial port, but I can't get it's data faster than 1Hz.

Could you help me, what is wrong with my code please?

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

int RXPin = 18;
int TXPin = 17;

int GPSBaud = 9600;

TinyGPSPlus gps;

SoftwareSerial gpsSerial(RXPin, TXPin);

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

  gpsSerial.begin(GPSBaud);
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (gpsSerial.available() > 0)
    if (gps.encode(gpsSerial.read()))
      displayInfo();

  // If 5000 milliseconds pass and there are no characters coming in
  // over the software serial port, show a "No GPS detected" error
  /*if (millis() > 1000 && gps.charsProcessed() < 10)
  {
    Serial.println("No GPS detected");
    while(true);
  }*/
}

void displayInfo()
{
  if (gps.location.isValid())
  {
    Serial.print("Latitude: ");
    Serial.println(gps.location.lat(), 6);
    Serial.print("Longitude: ");
    Serial.println(gps.location.lng(), 6);
    Serial.print("Altitude: ");
    Serial.println(gps.altitude.meters());
  }
  else
  {
    Serial.println("Location: Not Available");
  }
  
  Serial.print("Date: ");
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print("/");
    Serial.print(gps.date.day());
    Serial.print("/");
    Serial.println(gps.date.year());
  }
  else
  {
    Serial.println("Not Available");
  }

  Serial.print("Time: ");
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(":");
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(":");
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(".");
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.println(gps.time.centisecond());
  }
  else
  {
    Serial.println("Not Available");
  }

  Serial.println();
  Serial.println();
}

Use UBlox U-Center software to change GPS parameters.

Naturally, you will also increase the baud rate on Serial to much higher than 9600, which was popular in the 1970's.

1 Like

By default most GPS put out the location data at 1hz.

As suggested by @jremington, the Ublox Ucenter application can be used to either configure the GPS or provide you with the commands you need to send to it to configure it via the Arduino.

Thank you for your advice. It works well.

I tied it, and works well. Thanks for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.