ESP32 Heltec + TinyGPS Serial Comm Issue using Arduino IDE

Hi guys,
I recently got a new ESP32 LoRA board to setup as a TTN node.
For now I am just trying to communicate with the TinyGPS using ESP32 over Software serial and output the co-ordinates on Arduino’s Serial Monitor.
I am unable to receive any GPS data on Arduino IDE’s serial monitor.
I was wondering if anyone had tried this before. Or maybe find an issue with my code.
I do see some other data on the monitor. Attached is the image.image
Following is my code.

> #include <SoftwareSerial.h>
> #include <TinyGPS++.h>
> 
> static const int RXPin = 17, TXPin = 16;
> static const uint32_t GPSBaud = 9600;
> 
> // The TinyGPS++ object
> TinyGPSPlus gps;
> 
> // The serial connection to the GPS device
> SoftwareSerial ss(RXPin, TXPin);
> 
> void setup()
> {
>   Serial.begin(115200);
>   ss.begin(GPSBaud);
> 
>   Serial.println(F("DeviceExample.ino"));
>   Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
>   Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
>   Serial.println(F("by Mikal Hart"));
>   Serial.println();
> }
> 
> void loop()
> {
>   // This sketch displays information every time a new sentence is correctly encoded.
>   while (ss.available() > 0)
>     if (gps.encode(ss.read()))
>       displayInfo();
> 
>   if (millis() > 5000 && gps.charsProcessed() < 10)
>   {
>     Serial.println(F("No GPS detected: check wiring."));
>     while(true);
>   }
> }
> 
> void displayInfo()
> {
>   Serial.print(F("Location: ")); 
>   if (gps.location.isValid())
>   {
>     Serial.print(gps.location.lat(), 6);
>     Serial.print(F(","));
>     Serial.print(gps.location.lng(), 6);
>   }
>   else
>   {
>     Serial.print(F("INVALID"));
>   }
> 
>   Serial.print(F("  Date/Time: "));
>   if (gps.date.isValid())
>   {
>     Serial.print(gps.date.month());
>     Serial.print(F("/"));
>     Serial.print(gps.date.day());
>     Serial.print(F("/"));
>     Serial.print(gps.date.year());
>   }
>   else
>   {
>     Serial.print(F("INVALID"));
>   }
> 
>   Serial.print(F(" "));
>   if (gps.time.isValid())
>   {
>     if (gps.time.hour() < 10) Serial.print(F("0"));
>     Serial.print(gps.time.hour());
>     Serial.print(F(":"));
>     if (gps.time.minute() < 10) Serial.print(F("0"));
>     Serial.print(gps.time.minute());
>     Serial.print(F(":"));
>     if (gps.time.second() < 10) Serial.print(F("0"));
>     Serial.print(gps.time.second());
>     Serial.print(F("."));
>     if (gps.time.centisecond() < 10) Serial.print(F("0"));
>     Serial.print(gps.time.centisecond());
>   }
>   else
>   {
>     Serial.print(F("INVALID"));
>   }
> 
>   Serial.println();
> }

Thanks!

you sure the GPS works , try to direct connect it to a usb-serial and use a terminal program or the (if u-blox) use U-center

Yes the GPS does work, it does take like 10 mins to lock in the location. I tested it on Arduino Uno.
Thanks

Looks like the program is crashing, perhaps an issue with the softwareserial library. It puzzles me why your using softwareserial in the first place. .

Try the program with the GPS connected on the Serial2 hardware serial port.

Hi,

I got the same problem, I am using the Heltec ESP32 Wifi LoRa shown here:

@battlecruiser Have you find a solution to your problem ?
@LoRaTracker Which Serial 2 Hardware Serial Port talk you about ?

Thanks

Found on Google;

1 Like

Incredible ! It works thank you very much @LoRaTracker :blush:

@QuentinFombaron hi Quentin, i have a heltec wireless stick lite, but i didnt understood the answer, or i mean the way to fix it from @LoRaTracker.
Thanks for your help

Hey, did you get your issue solved? Because I’ve got good news for you. You might like the latest articles I’ve plubished on my website, you can acess it from here: https://flaviobabos.com.br/arduino/

NOTE: If you dont mind, you’ll might have to translate it into english! Thanks a lot!

Hello,
Hardware Serial2 resolved the problem with the GPS module, but GPIO16/U2_RXD is marked as OLED_RST. GPS works alone but I can´t print data to HELTEC display. Does it have also any solution?

See the post from Feb 19 above, there is a link on how to re-direct serial port pins.

I have same problem ,
i connected to 16 and 17 , to avoid the hardware serial .
– i get No GPS detected: check wiring.

i was not sure what U1UXD and U2UXD map to for pins , i see the code has 16 and 17
so i used it as in code below

 static const int RXPin = 16, TXPin = 17;
static const uint32_t GPSBaud = 9600;
  Serial2.begin(GPSBaud,SERIAL_8E1,RXPin,TXPin);

Update , i changed the port got new behaviour
static const int RXPin = 17, // GPS-TX wire goes in this port
TXPin = 2; // GPS-RX goes in this pi
i get now
Location: INVALID Date/Time: INVALID

A simple test sketch for a GPS, do not continue until you can see meaningful output from the GPS in the IDE serial monitor. The program reads characters from the GPS and sends then to the serial monitor, adjust the GPSTX and GPSRX pins to suit your wiring;

#define GPSTX 16              //pin number for TX output from ESP32 - RX into GPS
#define GPSRX 17              //pin number for RX input into ESP32 - TX from GPS

#define GPSserial Serial2     //define GPSserial as ESP32 Serial2 


void loop()
{
  while (GPSserial.available())
  {
    Serial.write(GPSserial.read());
  }
}


void setup()
{
  
  GPSserial.begin(9600, SERIAL_8N1, GPSTX, GPSRX);           //format is baud, mode, UART RX data, UART TX data 
                                                                 
  Serial.begin(115200);
  Serial.println("GPS_Echo_ESP32 Starting");
}

The two NMEA sentences the TinyGPS library needs to read start with;

$GPRMC
$GPGGA