GPS for ESP32 T-Beam

dev board LilyGO T-Beam
chip ESP32
chip NEO-6M
sensor gps
features uart

Before starting

Dependancies

Ensure the following requirements are available:

Pre-requisites

Try these simpler examples:

Buy the components

Description

This example contains displaying GPS 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 to view the raw NMEA sentences.
  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.

Code

Download code
#include <HardwareSerial.h>
#define GPS_SERIAL_NUM 1
#define GPS_RX_PIN 34
#define GPS_TX_PIN 12

HardwareSerial GPSSerial(GPS_SERIAL_NUM);

void setup() {
  Serial.begin(115200);
  GPSSerial.begin(9600, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);

  Serial.println("Hello GPS");
}

void loop() {
  if (Serial.available()) {
    char c = Serial.read();
    GPSSerial.write(c);
  }
  if (GPSSerial.available()) {
    char c = GPSSerial.read();
    Serial.write(c);
  }
}

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

References