GravityTroubleshooting

tel0157 gss gps

userHead jamess2345 2026-07-17 05:43:40 52 Views1 Replies

I am using the tl0157 gps in urat mode.  I can not get it to return getSog() and getCog() they remain at 0 while moving.  It does return Long and Lat.  However N W are reversed.  Below is my code  

 

/*

  TEL0157 UART Simple Road Test


 

  GPS wiring:

    5V -> VCC

    GND -> GND

    GPIO43 ESP32 TX -> TEL0157 C/R

    GPIO44 ESP32 RX <- TEL0157 D/T


 

  TEL0157 selector switch: UART

*/


 

#include "DFRobot_GNSS.h"

#include <HardwareSerial.h>


 

static const uint32_t GPS_BAUD = 9600;

static const uint8_t GPS_RX_PIN = 44;

static const uint8_t GPS_TX_PIN = 43;


 

HardwareSerial GPSSerial(2);


 

DFRobot_GNSS_UART gnss(&GPSSerial, GPS_BAUD, GPS_RX_PIN, GPS_TX_PIN);


 

unsigned long previousPositionPrint = 0;


 

void setup()

{

  Serial.begin(115200);

  delay(2000);


 

  Serial.println();

  Serial.println("TEL0157 UART SIMPLE ROAD TEST");

  Serial.println("ESP32 RX GPIO44 <- GPS D/T");

  Serial.println("ESP32 TX GPIO43 -> GPS C/R");

  Serial.println("TEL0157 switch must be set to UART");


 

  while (!gnss.begin())

  {

    Serial.println("TEL0157 NOT DETECTED");

    delay(1000);

  }


 

  Serial.println("TEL0157 detected");


 

  gnss.enablePower();

  delay(100);


 

  gnss.setGnss(eGPS_BeiDou_GLONASS);

  delay(100);


 

  gnss.setRgbOn();


 

  Serial.println("Take the unit outdoors and drive above 5 MPH.");

}


 

void loop()

{

  double sogKnots = gnss.getSog();

  double speedMPH = sogKnots * 1.15078;


 

  Serial.println("------------------------------------");

  Serial.print("SOG knots: ");

  Serial.println(sogKnots, 4);


 

  Serial.print("Speed MPH: ");

  Serial.println(speedMPH, 2);


 

  if (millis() - previousPositionPrint >= 5000)

  {

    previousPositionPrint = millis();


 

    uint8_t satellites = gnss.getNumSatUsed();

    sLonLat_t latitude = gnss.getLat();

    sLonLat_t longitude = gnss.getLon();

    double course = gnss.getCog();


 

    Serial.print("Satellites used: ");

    Serial.println(satellites);


 

   Serial.print("Latitude: ");

Serial.print(latitude.latitudeDegree, 7);

Serial.println(" N");


 

Serial.print("Longitude: ");

Serial.print(longitude.lonitudeDegree, 7);

Serial.println(" W");


 

    Serial.println((char)longitude.lonDirection);


 

    Serial.print("Course: ");

    Serial.println(course, 2);

  }


 

  delay(1000);

}


  And below here is the serial monitor while driving.  Longitude: 92.8673290 W

N

Course: 0.00

------------------------------------

SOG knots: 0.0000

Speed MPH: 0.00

------------------------------------

SOG knots: 0.0000

Speed MPH: 0.00

------------------------------------

SOG knots: 0.0000

Speed MPH: 0.00

Satellites used: 8

Latitude: 44.9985172 N

Longitude: 92.8679000 W

N


 I am using the following PCB micro esp32  https://docs.waveshare.com/ESP32-S3-LCD-2.8C any  help you can provide would be appreciated

icon TEL0157_UART_Simple_Road_Test.zip 1KB Download(0)
2026-07-17 17:49:21

Your pin mapping looks right: on the ESP32-S3-LCD-2.8C, TXD is GPIO43 and RXD is GPIO44, so TEL0157 D/T(TX) -> GPIO44 RX and C/R(RX) -> GPIO43 TX is correct. One important board detail: Waveshare says the 4-pin UART header is disabled when the USB-to-UART Type-C port is connected, so test with that port disconnected if possible.


For the N/W issue, don’t hard-code the hemisphere text. Print the direction fields returned by the library:

Serial.print("Latitude: ");
Serial.print(latitude.latitudeDegree, 7);
Serial.print(" ");
Serial.println((char)latitude.latDirection);

Serial.print("Longitude: ");
Serial.print(longitude.lonitudeDegree, 7);
Serial.print(" ");
Serial.println((char)longitude.lonDirection);


At your location, the expected result is N for latitude and W for longitude. If longitude.lonDirection still prints N, please try the stock DFRobot TEL0157 UART example and share the installed DFRobot_GNSS library version.


For getSog() and getCog(), the library reports SOG in knots and COG in degrees. Since latitude/longitude and satellites are updating, the next check is whether the module’s raw GNSS data contains nonzero speed/course while moving. If raw $GNRMC / $GNVTG also shows zero or blank speed/course, the module is reporting zero. If raw data has nonzero speed/course but getSog() / getCog() stay at 0, that points to a library parsing/register issue.

userHeadPic Yx