PandaByte GPS GNSS Module: Location Tracking

by pandabyte in Circuits > Arduino

24 Views, 0 Favorites, 0 Comments

PandaByte GPS GNSS Module: Location Tracking

gps.png

The PandaByte GPS Module is a GPS GNSS receiver capable of providing real-time latitude, longitude, altitude, UTC time, date, speed, and satellite information. It is suitable for applications such as vehicle tracking, asset monitoring, navigation, drone systems, wildlife monitoring, and IoT-based location-aware projects.

The module communicates with the microcontroller using a UART (Serial) interface, making it easy to interface with ESP32, Arduino, Raspberry Pi Pico, and other development boards.

Like other PandaByte Grove modules, it supports both:

  1. Traditional male header connections
  2. 4-pin Grove connector for plug-and-play prototyping

In this guide, you will learn:

  1. GPS module pin configuration
  2. UART communication
  3. Circuit connections
  4. Reading GPS coordinates
  5. Arduino programming using TinyGPSPlus


Supplies

gps2.png

Hardware

  1. PandaByte GPS Module
  2. PandaByte xC3m ESP32-C3 Development Board
  3. PandaByte Grove Expansion Board
  4. USB Cable
  5. Grove Cable (or Dupont jumper wires)

Software

  1. Arduino IDE
  2. TinyGPSPlus Library by Mikal Hart

Install Library

Open Arduino IDE

Sketch → Include Library → Manage Libraries

Search for TinyGPSPlus

Install the library developed by Mikal Hart.

Circuit Connections

gps pins.png
  1. Perform connection as per the table.
  2. Important: The module TX pin always connects to the microcontroller RX pin, and the module RX pin connects to the microcontroller TX pin.

Programming

Program to display time, Latitude, Longitude, and Altitude values on the serial monitor.

#include <TinyGPSPlus.h>

TinyGPSPlus gps;

#define rxPin 8
#define txPin 9

HardwareSerial Serial2(0);

void setup()
{
Serial.begin(115200);

Serial2.begin(9600, SERIAL_8N1, rxPin, txPin);
}

void loop()
{
while (Serial2.available() > 0)
{
if (gps.encode(Serial2.read()))
displayInfo();
}

if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println("No GPS detected: check wiring.");
while (true);
}
}

void displayInfo()
{
if (gps.time.isValid())
{
Serial.print("TIME=");
Serial.println(gps.time.value());

Serial.print("LAT=");
Serial.println(gps.location.lat(), 6);

Serial.print("LONG=");
Serial.println(gps.location.lng(), 6);

Serial.print("ALT=");
Serial.println(gps.altitude.meters());

Serial.println();
}
else
{
Serial.println("Invalid Location");
}
}


Output

The first GPS fix may take 2-5 minutes depending on satellite visibility. It is best to keep the GPS module outside in an open area to quickly lock to satellites.

After the GPS acquires satellites, the Serial Monitor displays values similar to:

TIME=10453200
LAT=28.613939
LONG=77.209021
ALT=218.40

If the GPS has not yet obtained a satellite lock, the Serial Monitor displays:

Invalid Location

If no GPS module is detected:

No GPS detected: check wiring.

Important Information

  1. The GPS module communicates using UART serial communication.
  2. The default baud rate is 9600 bps.
  3. For the xC3m ESP32-C3 board, GPIO 8 is configured as RX, while GPIO 9 is configured as TX.
  4. Always connect the GPS TX pin to the microcontroller RX pin, and the GPS RX pin to the microcontroller TX pin.
  5. The first position fix (cold start) may take longer than subsequent fixes.
  6. GPS modules work best outdoors with a clear view of the sky. Indoor reception may be weak or unavailable.