ESP32 Thing Motion Shield Hookup Guide

Pages
Contributors: MTaylor
Favorited Favorite 2

Using the GPS Port

The GPS port is just a pass-through to the serial port, so configuration is easy. Simply start the serial port at the desired baud, usually 9600.

This example simply passes serial monitor data to the GPS port, and GPS data to the serial monitor. Set the serial speeds when calling begin. Serial is the USB serial port, and GPSUART is the GPS port.

language:c
#include <Arduino.h>
HardwareSerial GPSUART(2);  // Set up GPS UART on pins 16 & 17

void setup()
{
  Serial.begin(115200);
  GPSUART.begin(9600);
  delay(1000);
  Serial.println("Sketch Started.");
}

void loop() {
  //Pass usb data to the gps
  if (Serial.available())
  {
    GPSUART.write(Serial.read());
  }
  //Pass gps data to the usb
  if (GPSUART.available())
  {
    Serial.write(Serial1.read());
  }
}

Different GPS Receivers Connected to GPS port

(left) Connection to the GP-20U7. (right) Connection to the GP-735.

As for the hardware, either plug in the recommend 3-wire GPS module (rx only), or wire in a 4-wire module (that can be run from 3.3V) to the provided pin header.

The data that the GPS will emit comes in the form of NMEA messages. See the NMEA Reference Manual (PDF) for information on decoding.