Environments
- osx
- esp32
- vscode
- platformio
I am working on an ESP32 module with this GPS module (very similar except the one I have has "ublox" logo on it - bought about 2 years ago).
#include <Arduino.h>
#include <HardwareSerial.h>
#include <TinyGPS++.h>
TinyGPSPlus gps;
HardwareSerial SerialGPS(2);
void setup() {
Serial.begin(115200); // RX TX
SerialGPS.begin(9600, SERIAL_8N1, 16, 17);
}
void loop() {
Serial.println("------------");
Serial.print("available(): ");
Serial.println(SerialGPS.available());
Serial.println("------------");
while (SerialGPS.available() > 0) {
char c = SerialGPS.read();
Serial.print(c);
gps.encode(c);
}
Serial.println();
if (gps.location.isValid()) {
Serial.print("LAT=");
Serial.println(gps.location.lat(), 6);
Serial.print("LONG=");
Serial.println(gps.location.lng(), 6);
Serial.print("ALT=");
Serial.println(gps.altitude.meters());
} else {
Serial.println("not valid");
}
delay(1000);
}
I took it outside and ran it for over 15 mins, and I see the data are still invalid.
------------
available(): 195
------------
$GPRMC,023424.00,V,,,,,,,051120,,,N*79
$GPVTG,,,,,,,,,N*30
$GPGGA,023424.00,,,,,0,00,99.99,,,,,,*65
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,023424.00,V,N*49
not valid
------------
available(): 195
------------
$GPRMC,023425.00,V,,,,,,,051120,,,N*78
$GPVTG,,,,,,,,,N*30
$GPGGA,023425.00,,,,,0,00,99.99,,,,,,*64
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,00*79
$GPGLL,,,,,023425.00,V,N*48
not valid
Since I see letters coming in, I don't think TX and RX are mixed up. I am giving it 5V (although not exactly sure if it should be 3.3v or 5v).
How can I get valid GPS data coming in from this module?
