GPS parsing for ESP32 T-Beam

esp32 t-beam lilygo gps ublox uart neo-6m parsing

Pre-requisites

This example contains displaying latitude and longitude from uBlox Neo-6M module on the serial monitor on a ESP-32 based LilyGO T-Beam T22_V1.1, 20191212. Pins IO12 is used as TX and pin IO34 is used as RX as shown in the schematic for V1.1.

  1. Flash the firmware with the make command.
  2. Connect the serial monitor.
  3. Leave it in the open outdoors for a while to get a GPS fix.
  4. Ensure RED LED is blinking to show the time pulse.
  5. Ensure serial monitor shows the latitude and longitude.

Code

Download code
#include "src/gps/gps.h"

int interval = 2000;
long lastSendTime = 0;
LatLong latlong = {0.0, 0.0};

void setup() {
  initGPS();

  Serial.begin(115200);
  Serial.println("Hello GPS");
}

void loop() {
  // Get GPS data as soon as it is available,
  // But display it on the serial monitor only every 2 seconds
  while (isGPSAvailable()) {
    getLatLong(&latlong);
  }

  if (millis() - lastSendTime > interval) {
    Serial.print(millis());
    Serial.print(" Lat-Long: ");
    Serial.print(latlong.latitude, 7);
    Serial.print(", ");
    Serial.println(latlong.longitude, 7);

    lastSendTime = millis();
  }
}

Serial console

Serial output from the firmware.

GPS parsing for ESP32 T-Beam serial console

Prototype

A photo of the actual setup.

GPS parsing for ESP32 T-Beam prototype

References