GPS parsing for ESP32 T-Beam

Updated on 12 April 2022
dev board LilyGO T-Beam
chip ESP32-DOWDQ6
chip NEO-6M
sensor GPS
features UART parsing
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Buy the components

Code

Download code gps-parsing-esp32-t-beam.ino
#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();
  }
}

Makefile

BOARD?=esp32:esp32:t-beam
PORT?=/dev/cu.SLAB_USBtoUART

.PHONY: default lint all flash clean

default: all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD)

clean:
	rm -r build

Prototype

A photo of the actual setup.

GPS parsing for ESP32 T-Beam prototype

Serial console

Serial output from the firmware.

GPS parsing for ESP32 T-Beam serial console

Description

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.

References

Watch