esp32-GY-NEO6MV2-example
Project Information
Test GY-NEO6MV2 module and show results via captive portal.
Flash to Device
Login required: You need to login or create an account to flash this project.
Source Files (3)
Download AllREADME
ESP32 GPS Captive Portal
View live GPS data over WiFi through a captive portal
This project turns an ESP32 Dev Board into a small WiFi-accessible GPS readout using a GY-NEO6MV2 (u-blox NEO-6M) module. When powered, the ESP32 creates an open WiFi Access Point and a captive portal. As soon as a device connects to the AP, a status page appears that shows live GPS data (fix status, satellites, position, altitude, speed and UTC time), auto-refreshing every second.
⭐ Features
- Open WiFi Access Point (no password)
- SSID:
ESP32-GPS
- SSID:
- Captive portal
- Any URL request (e.g.
google.com) is redirected to the GPS status page - Works with Android / iOS / Windows / Linux
- Any URL request (e.g.
- Live GPS dashboard
- Fix status, satellite count, HDOP
- Latitude / longitude, altitude, speed, course
- UTC date & time
- Auto-refresh every 1 second (AJAX, no page reload)
- Disconnection detection
- If the module is unplugged (no data for 2 s), the page shows a clear NO DATA error instead of stale values
- Privacy-friendly
- Coordinates are rounded to 2 decimal places (~1 km) on the server, so exact location is never sent to the client
- No external network or internet required
📦 Hardware requirements
- ESP32 Dev Board (e.g. ESP32-DevKitC)
- GY-NEO6MV2 GPS module (u-blox NEO-6M) with antenna
Wiring (ESP32 ↔ NEO-6M)
| GPS module | ESP32 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| TX | GPIO16 (RX) |
| RX | GPIO17 (TX) |
Note: TX/RX are crossed — module TX → ESP32 RX and module RX → ESP32 TX. UART2 (GPIO16/17) is used so it does not conflict with the USB serial (UART0) used for programming and debugging.
Default GPS pins in the code:
#define GPS_RX_PIN 16 // ESP32 RX <- GPS TX
#define GPS_TX_PIN 17 // ESP32 TX -> GPS RX
#define GPS_BAUD 9600
🚀 Getting started
Wire the GPS module to the ESP32 as shown above.
Open FlashESP project.
CLick "Flash to Device"
Choose port.
Click "Install main".
On your phone/laptop, connect to the WiFi network
ESP32-GPS(open, no password).The captive portal should open automatically. If not, open a browser and go to:
http://192.168.4.1Watch the live GPS data. The first fix may take a few minutes outdoors or near a window (indoors it often won't lock at all).
🔍 Troubleshooting
| Symptom | Likely cause / fix |
|---|---|
| NO DATA from GPS | Check wiring (TX/RX crossed), power, and that the module LED is present. Try baud 38400. |
| Data flows but Fix = NO for a long time | Normal indoors — move the antenna near a window or outside and wait. |
| Garbage in serial monitor | Wrong baud rate — change GPS_BAUD to 38400. |
| Module LED never blinks | No fix yet — it only blinks (~1 Hz) after locking a position. |
⚙️ Configuration
| Setting | Location | Description |
|---|---|---|
ap_ssid |
top of sketch | Access Point name |
GPS_RX_PIN / GPS_TX_PIN |
top of sketch | ESP32 UART pins for the GPS |
GPS_BAUD |
top of sketch | GPS serial speed (default 9600) |
GPS_TIMEOUT_MS |
top of sketch | How long without data before "NO DATA" is shown (default 2000 ms) |
| Coordinate precision | gpsJson() |
String(gps.location.lat(), 2) — change 2 → 1 for coarser (~11 km), or higher for finer |
📄 License
Free to use and modify.