πΊοΈ GPS Location Tracker
Parse live NMEA GPS sentences and serve your coordinates on a web map.
Overview
The Neo-6M GPS module receives satellite signals and outputs NMEA 0183 sentences over a 9600 baud UART connection. This project parses the GPRMC/GPGGA sentences to extract latitude, longitude, altitude, speed, and fix quality β then serves them on an ESP32 web page with a live Google Maps embed.
What you'll learn: NMEA sentence parsing with the TinyGPS++ library, UART bridging, ESP32 AsyncWebServer, and embedding dynamic map coordinates into HTML templates.
Estimated time: 1.5β2.5 hours. Difficulty: βββ Intermediate.
Components Needed
| Component | Specification | Qty | Notes |
|---|---|---|---|
| ESP32 Development Board | WiFi + Dual UART | 1 | Multiple hardware serial ports |
| Neo-6M GPS Module | 9600 baud UART | 1 | With ceramic patch antenna |
| Active GPS Antenna | SMA connector | 1 | For indoor testing |
| Jumper Wires | Female-to-Female | 4 | VCC, GND, TX, RX |
Step-by-Step Tutorial
1
Wire the GPS Module
Connect Neo-6M VCC β 3.3V, GND β GND, TX β ESP32 GPIO 16 (RX2), RX β GPIO 17 (TX2). The GPS TX β ESP32 RX.
2
Install TinyGPS++
Install
TinyGPS++ by Mikal Hart from the Library Manager. It parses all NMEA sentence types automatically.3
Wait for GPS Fix
GPS modules take 30β90 seconds to acquire a satellite fix outdoors. During this time
gps.location.isValid() returns false. Show a "Acquiring fix..." message.4
Build the Web Server
Set up ESPAsyncWebServer. On GET "/", serve an HTML page that embeds the lat/lon into a Google Maps iframe URL for a live map pin.
5
Add OLED Display
Optionally wire an SSD1306 OLED to show lat, lon, altitude, speed, and satellite count without needing a phone or browser.
The Neo-6M needs a clear view of the sky. Indoors, it may never get a fix. If testing indoors, use an active external antenna (connected via SMA) placed near a window for best results.
Code / Configuration
gps_tracker.ino
INO
// GPS Location Tracker - Volt X
#include <TinyGPS++.h>
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";
TinyGPSPlus gps;
HardwareSerial gpsSerial(2); // UART2: GPIO16 (RX), GPIO17 (TX)
AsyncWebServer server(80);
double lat = 0, lon = 0, alt = 0, spd = 0;
int sats = 0;
void setup() {
Serial.begin(115200);
gpsSerial.begin(9600, SERIAL_8N1, 16, 17);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(500);
Serial.println("WiFi OK: " + WiFi.localIP().toString());
server.on("/", HTTP_GET, [](AsyncWebServerRequest *req) {
String html = "<!DOCTYPE html><html><head><title>GPS Tracker</title></head><body>";Reviews & Ratings
β0 reviews
Sign in to leave a review
Loading reviews...