Learn to interface the NEO-M8N GPS Module with the ESP32 programmed with Arduino IDE to get GPS data: latitude, longitude, altitude, UTC time, number of visible satellites, and more. Finally, we’ll show you how to log GPS data to a file on a microSD card and how to handle that data to display a path on Google Earth.

In summary, in this tutorial you’ll learn how to:
- Wire the NEO-M8N GPS module to the ESP32 via serial;
- Get raw GPS data;
- Parse raw data to obtain selected and readable GPS information;
- Get your current location;
- Log the location to a file on the microSD card;
- Transform your data into a .kml file that Google Earth can read;
- Upload the .kml file to Google Earth to display a path.
Table of Contents
We’ll cover the following subjects:
- Introducing the NEO-M8N GPS Module
- Wiring the NEO-M8N GPS Module to the ESP32
- Getting Raw GPS Data – Testing the NEO-M8N GPS Module with the ESP32
- Parsing NMEA Sentences with TinyGPSPlus Library
- GPS Logger and Display Path on Google Earth
Prerequisites
This tutorial focuses on programming the ESP32 using the Arduino core. Before proceeding, you should have the ESP32 Arduino core installed in your Arduino IDE. Follow the next tutorial to install the ESP32 on the Arduino IDE, if you haven’t already.
Introducing the NEO-M8N GPS Module
The NEO-M8N GPS module is one of the most popular GPS receivers used with microcontrollers in navigation and tracking projects. It can get data about latitude, longitude, altitude, and time.
It supports multiple satellite systems, including GPS, Galileo, GLONASS, and BeiDou. It offers better satellite tracking than the NEO-6M, making it more reliable in challenging conditions.

According to the datasheet, it has a horizontal position accuracy of 2.5 to 4 meters and quick startup times (1 second for hot start, 26–57 seconds for cold start—expect longer times if you’re close to buildings).
The module includes a backup battery, built-in EEPROM, and an LED indicator that blinks when a position fix is achieved.
This module typically comes with a ceramic GPS antenna. But, you can change it to any other compatible antenna that might suit your project better. For example, I like to use the one at the right in the picture below because it is waterproof, and the antenna comes with a long cable which allows for more flexibility.

The NEO-M8N GPS Module communicates with a microcontroller using Serial communication protocol, and works with standard NMEA sentences. NMEA stands for National Marine Electronics Association, and in the world of GPS, it is a standard data format supported by GPS manufacturers.
Where to buy?
You can check our Maker Advisor Tools page to compare the NEO-M8N GPS receiver module price in different stores:
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Wiring the NEO-M8N GPS Module to the ESP32
We’ll connect the NEO-M8N GPS Module using the ESP32 default UART2 pins. You can use the following picture and table as a reference.

NEO-M8N GPS Module | ESP32 |
VCC | 3V3 |
RX | TX2 (GPIO 17) |
TX | RX2 (GPIO 16) |
GND | GND |
Getting Raw GPS Data – Testing the NEO-M8N GPS Module with the ESP32
To get raw GPS data you need to start a serial communication with the GPS module and read the available data.

The following code establishes a serial communication with the GPS module and reads the available data.
/*********
Rui Santos & Sara Santos - Random Nerd Tutorials
Complete instructions at https://RandomNerdTutorials.com/esp32-neo-m8n-gps-logger-google-earth/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
#define GPS_BAUD 9600
// Create an instance of the HardwareSerial class for Serial 2
HardwareSerial gpsSerial(2);
void setup(){
// Serial Monitor
Serial.begin(115200);
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
}
void loop(){
while (gpsSerial.available() > 0){
// get the byte data from the GPS
char gpsData = gpsSerial.read();
Serial.print(gpsData);
}
delay(1000);
Serial.println("-------------------------------");
}
How Does the Code Work?
This sketch assumes you are using GPIO 16 and GPIO 17 as RX and TX serial pins to establish serial communication with the GPS module. If you’re using other pins you should edit that on the following lines:
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
Also, if your module uses a different default baud rate than 9600 bps, you should modify the code on the following line:
#define GPS_BAUD 9600
Then, we create an instance of the HardwareSerial to use UART 2 called gpsSerial.
// Create an instance of the HardwareSerial class for Serial 2
HardwareSerial gpsSerial(2);
In the setup(), we initiate the Serial Monitor.
// Serial Monitor
Serial.begin(115200);
Then, we initialize a serial communication with the GPS module.
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
In the loop(), the code listens to the GPS serial port, and when data is received from the module, it is printed in the serial monitor.
void loop(){
while (gpsSerial.available() > 0){
// get the byte data from the GPS
char gpsData = gpsSerial.read();
Serial.print(gpsData);
}
delay(1000);
Serial.println("-------------------------------");
}
Testing the Code
Upload the code to your board.

Make sure the antenna is connected and that the module or antenna is placed outside or next to a window so that it can get data from the satellites.

The module’s blue LED will start blinking when it finds a position fix.
The Serial Monitor will display NMEA sentences with GPS data.
Important: if you’re running this sketch for the first time, it may take a few minutes until the module gets a position fix. You’ll start getting actual data when the blue LED starts blinking. If you’re inside a building, it is very unlikely that you can get GPS data. Go outside or place your antenna outside to maximize your chances of catching a satellite signal.

You should get a bunch of information in the GPS standard language, NMEA. Each line you get in the serial monitor is an NMEA sentence.
NMEA stands for National Marine Electronics Association, and in the world of GPS, it is a standard data format supported by GPS manufacturers.
NMEA Sentences
NMEA sentences start with the $ character, and each data field is separated by a comma.
$GNRMC,115209.00,A,4114.5500,N,00861.4900,W,0.129,,160125,,,D*XX
$GNVTG,,T,,M,0.129,N,0.239,K,D*XX
$GNGGA,115209.00,4114.5500,N,00861.4900,W,2,10,0.93,130.6,M,50.1,M,,0000*XX
$GNGSA,A,3,24,25,28,32,29,,,,,,,,1.65,0.93,1.37*XX
$GNGSA,A,3,78,66,67,77,,86,26,083,20*XX
$GLGSV,3,3,09,87,13,131,*XX
$GNGLL,4114.5500,N,00861.4900,W,115209.00,A,D*XX
There are different types of NMEA sentences. The type of message is indicated by the characters before the first comma.
The GN after the $ indicates it is a GPS position. The $GNGGA is the basic GNSS NMEA message, that provides 3D location and accuracy data.
In the following sentence:
$GNGGA,110827.00,4114.32485,N,00831.79799,W,1,10,0.93,130.6,M,50.1,M,,*5F
Here’s how the fields look for the M8N:
- $GNGGA: Global GNSS location data.
- 110827.00: Time in UTC (11:08:27).
- 4114.32485,N: Latitude.
- 00831.79799,W: Longitude.
- 1: Fix quality (1 = GPS fix, 2 = DGPS, etc.).
- 10: Number of satellites tracked (higher for M8N compared to NEO-6M).
- 0.93: Horizontal dilution of precision (lower is better).
- 130.6,M: Altitude above mean sea level (in meters).
- 50.1,M: Height of geoid above the WGS84 ellipsoid.
- *5F: Recalculated checksum for the NEO-M8N.
The other NMEA sentences provide additional information:
- $GNRMC – Essential GNSS PVT (Position, Velocity, Time) data
- $GNVTG – Velocity and track information
- $GNGGA – GNSS Fix Information
- $GNGSA – GNSS DOP and active satellites
- $GLGSV – Detailed satellite information (GLONASS)
- $GNGLL – Geographic Latitude and Longitude.
For more information about NMEA sentences, I found this website with very detailed information.
You can use this Online NME Analyser and paste your sentences there to interpret the GPS data.
However, the easiest way to get and interpret the GPS data you want is to parse your NMEA sentences directly in the code. For that, we can use the TinyGPSPlus library that provides methods to extract data from the NMEA sentences easily.
Parsing NMEA Sentences with TinyGPSPlus Library
The TinyGPSPlus library makes it simple to get GPS data in a format that is easy to understand. You can click here for more information about the TinyGPSPlus Library.
Installing the TinyGPSPlus Library
In the Arduino IDE, go to Sketch > Include Library > Manage Libraries or click on the Library Manager icon at the left sidebar.
Search for TinyGPSPlus and install the library by Mikal Hart.

Getting GPS Data Using the NEO-M8N GPS Module and the TinyGPSPlus Library
The following code shows how to get GPS data using the TinyGPSPlus library. We’ll get date, time, speed, altitude, number of visible satellites, and HDOP (a measurement of how precise the signal is).
/*********
Rui Santos & Sara Santos - Random Nerd Tutorials
Complete instructions at https://RandomNerdTutorials.com/esp32-neo-m8n-gps-logger-google-earth/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/
#include <TinyGPS++.h>
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
#define GPS_BAUD 9600
// The TinyGPS++ object
TinyGPSPlus gps;
// Create an instance of the HardwareSerial class for Serial 2
HardwareSerial gpsSerial(2);
void setup() {
// Serial Monitor
Serial.begin(115200);
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
}
void loop() {
// This sketch displays information every time a new sentence is correctly encoded.
unsigned long start = millis();
while (millis() - start < 1000) {
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
if (gps.location.isUpdated()) {
Serial.print("LAT: ");
Serial.println(gps.location.lat(), 6);
Serial.print("LONG: ");
Serial.println(gps.location.lng(), 6);
Serial.print("SPEED (km/h) = ");
Serial.println(gps.speed.kmph());
Serial.print("ALT (min)= ");
Serial.println(gps.altitude.meters());
Serial.print("HDOP = ");
Serial.println(gps.hdop.value() / 100.0);
Serial.print("Satellites = ");
Serial.println(gps.satellites.value());
Serial.print("Time in UTC: ");
Serial.println(String(gps.date.year()) + "/" + String(gps.date.month()) + "/" + String(gps.date.day()) + "," + String(gps.time.hour()) + ":" + String(gps.time.minute()) + ":" + String(gps.time.second()));
Serial.println("");
}
}
}
How Does the Code Work?
You start by importing the TinyGPSPlus library.
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
Then, you define the UART 2 RX and TX pins and the GPS baud rate. If your board uses different UART 2 pins, or if the GPS module uses a different baud rate, you can modify them on the following lines.
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
#define GPS_BAUD 9600
Then, you create a TinyGPSPlus object:
TinyGPSPlus gps;
Create an instance of the HardwareSerial class for Serial 2 called gpsSerial.
HardwareSerial gpsSerial(2);
In the setup(), initialize the Serial Monitor and the serial communication with the GPS module.
void setup() {
// Serial Monitor
Serial.begin(115200);
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
}
In the loop() is where you request the information. Parse the data from the GPS module into the TinyGPSPlus object using the encode() method as follows.
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
Then, you can query the gps object to see if any data fields have been updated:
if (gps.location.isUpdated()) {
If there is new data, we can get it as follows:
Latitude | gps.location.lat() |
Longitude | gps.location.lng() |
Speed (km/h) | gps.speed.kmph() |
Altitude (meters) | gps.altitude.meters() |
HDOP | gps.hdop.value() |
The number of visible satellites | gps.satellites.value() |
Year | gps.date.year() |
Month | gps.date.month() |
Day | gps.date.day() |
Hour | gps.time.hour() |
Minutes | gps.time.minute() |
Seconds | gps.time.second() |
In the code, we get the data and print all the information in the Serial Monitor.
Serial.print("LAT: ");
Serial.println(gps.location.lat(), 6);
Serial.print("LONG: ");
Serial.println(gps.location.lng(), 6);
Serial.print("SPEED (km/h) = ");
Serial.println(gps.speed.kmph());
Serial.print("ALT (min)= ");
Serial.println(gps.altitude.meters());
Serial.print("HDOP = ");
Serial.println(gps.hdop.value() / 100.0);
Serial.print("Satellites = ");
Serial.println(gps.satellites.value());
Serial.print("Time in UTC: ");
Serial.println(String(gps.date.year()) + "/" + String(gps.date.month()) + "/" + String(gps.date.day()) + "," + String(gps.time.hour()) + ":" + String(gps.time.minute()) + ":" + String(gps.time.second()));
Serial.println("");
Testing the Code
Upload the code to your ESP32 board. Open the Serial Monitor at a baud rate of 115200. Make sure your GPS module is placed outside or next to a window to get data from satellites.
Note: you may need to wait a few seconds or minutes until the module can get a position fix.

You’ll get data on the Serial Monitor about your current location, speed, altitude, number of visible satellites HDOP, and time.
HDOP stands for Horizontal Dilution of Precision. This is a measurement of position-fixing accuracy. The higher the HDOP value is, the less accurate the position fix will be. Ideally, you should get a value lower than 2. A lower value means a better accuracy.
GPS Logger and Display Path on Google Earth
Now that you’re more familiar with using the NEO-M8N GPS module with the ESP32, let’s create a GPS logger that records your location over time to a file on a microSD card. Then, you can modify and use that file on Google Earth to visualize how the location changed over time (path).

Project Overview
Here’s a quick overview of how this project works:
- The ESP32 is connected to the NEO-M8N GPS Module and gets data about the location;
- When the location changes at least one meter, we save the location data (latitude, longitude, and altitude) to a file on the microSD card;
- To visualize the data on Google Earth, we’ll show you how to manually convert a .txt file with the location coordinates to a .kml file that Google Earth can read;
- We’ll show you how to upload the .kml to Google Earth to visualize that path.
Parts Required
Here’s a list of the parts required for this project:
- ESP32 Board – read Best ESP32 Development Boards
- NEO-M8N GPS Module
- MicroSD card Module
- MicroSD card
- Breadboard
- Jumper wires
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Wiring the Circuit
Wire the GPS Module to the ESP32 default UART2 pins (as we did previously) and the microSD card module to the ESP32 default SPI pins. You can use the following diagram or the next tables as a reference.

You may also like reading: ESP32: Guide for MicroSD Card Module using Arduino IDE.
NEO-M8N GPS Module | ESP32 |
VCC | 3V3 |
RX | TX2 (GPIO 17) |
TX | RX2 (GPIO 16) |
GND | GND |
MicroSD Card Module | ESP32 |
3V3* | 3V3 |
CS | GPIO 5 |
MOSI | GPIO 23 |
CLK | GPIO 18 |
MISO | GPIO 19 |
GND | GND |
Code
The following code initializes the microSD card and the GPS module and saves GPS data as soon as the data points are available and the new point is at least 1 meter from the previous one.
/*********
Rui Santos & Sara Santos - Random Nerd Tutorials
Complete instructions at https://RandomNerdTutorials.com/esp32-neo-m8n-gps-logger-google-earth/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/
#include <TinyGPS++.h>
#include <FS.h>
#include <SD.h>
#include <SPI.h>
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
#define GPS_BAUD 9600
// The TinyGPS++ object
TinyGPSPlus gps;
// Create an instance of the HardwareSerial class for Serial 2
HardwareSerial gpsSerial(2);
String GPSdataToAppend;
// Previous GPS coordinates
double lastLat = 0.0;
double lastLng = 0.0;
// Initialize SD card
void initSDCard() {
if (!SD.begin()) {
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD card attached");
return;
}
Serial.print("SD Card Type: ");
if (cardType == CARD_MMC) {
Serial.println("MMC");
} else if (cardType == CARD_SD) {
Serial.println("SDSC");
} else if (cardType == CARD_SDHC) {
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
Serial.printf("SD Card Size: %lluMB\n", cardSize);
}
// Append data to the SD card
void appendFile(fs::FS &fs, const char *path, const char *message) {
Serial.printf("Appending to file: %s\n", path);
File file = fs.open(path, FILE_APPEND);
if (!file) {
Serial.println("Failed to open file for appending");
return;
}
if (file.print(message)) {
Serial.println("Message appended");
} else {
Serial.println("Append failed");
}
file.close();
}
void setup() {
// Serial Monitor
Serial.begin(115200);
// Initialize the microSD card
initSDCard();
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
}
void loop() {
unsigned long start = millis();
while (millis() - start < 1000) {
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
if (gps.location.isUpdated()) {
double currentLat = gps.location.lat();
double currentLng = gps.location.lng();
// Check if the distance from the last point is at least 1 meter
double distance = TinyGPSPlus::distanceBetween(lastLat, lastLng, currentLat, currentLng);
if (distance >= 1.0) {
lastLat = currentLat;
lastLng = currentLng;
// Prepare data to append
GPSdataToAppend = String(currentLng, 6) + "," + String(currentLat, 6) + "," + String(gps.altitude.meters());
Serial.println(GPSdataToAppend);
// Append to file
appendFile(SD, "/data.txt", GPSdataToAppend.c_str());
}
}
}
}
To save data in a format that Google Earth can read, we need to save longitude, latitude, and altitude in this order separated by commas. That’s what we do in this example. Later, we need to convert that information to a .kml file.
How Does the Code Work?
We start by importing the required libraries.
#include <TinyGPS++.h>
#include <FS.h>
#include <SD.h>
#include <SPI.h>
Then, we define the pins that will be used to communicate with the GPS module via serial communication protocol. As we’ve seen previously, we are using UART2 default pins.
// Define the RX and TX pins for Serial 2
#define RXD2 16
#define TXD2 17
We define the GPS baud rate, create a TinyGPSPlus instance called gps, and start Hardware Serial 2.
#define GPS_BAUD 9600
// The TinyGPS++ object
TinyGPSPlus gps;
// Create an instance of the HardwareSerial class for Serial 2
HardwareSerial gpsSerial(2);
We create a String variable that will hold all the information to store on the microSD card (longitude, latitude, and altitude in this order).
String GPSdataToAppend;
Then, we initialize the following variables to save the last latitude and longitude values. We need these variables to compare the current position to the last one.
// Previous GPS coordinates
double lastLat = 0.0;
double lastLng = 0.0;
The initSDCard() function calls all the necessary methods to initialize the microSD card.
// Initialize SD card
void initSDCard() {
if (!SD.begin()) {
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD.cardType();
if (cardType == CARD_NONE) {
Serial.println("No SD card attached");
return;
}
Serial.print("SD Card Type: ");
if (cardType == CARD_MMC) {
Serial.println("MMC");
} else if (cardType == CARD_SD) {
Serial.println("SDSC");
} else if (cardType == CARD_SDHC) {
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
Serial.printf("SD Card Size: %lluMB\n", cardSize);
}
The appendFile() function appends data to a file on the microSD card. It creates that file if it doesn’t exist yet.
// Append data to the SD card
void appendFile(fs::FS &fs, const char *path, const char *message) {
Serial.printf("Appending to file: %s\n", path);
File file = fs.open(path, FILE_APPEND);
if (!file) {
Serial.println("Failed to open file for appending");
return;
}
if (file.print(message)) {
Serial.println("Message appended");
} else {
Serial.println("Append failed");
}
file.close();
}
For more information about microSD card functions, check this tutorial: ESP32: Guide for MicroSD Card Module using Arduino IDE.
In the setup(), we initialize the Serial Monitor, the microSD card, and the GPS module.
void setup() {
// Serial Monitor
Serial.begin(115200);
// Initialize the microSD card
initSDCard();
// Start Serial 2 with the defined RX and TX pins and a baud rate of 9600
gpsSerial.begin(GPS_BAUD, SERIAL_8N1, RXD2, TXD2);
Serial.println("Serial 2 started at 9600 baud rate");
}
In the loop(), we check if new data is available from the GPS module every second. If there is, we encode the available data and get the current latitude and longitude.
unsigned long start = millis();
while (millis() - start < 1000) {
while (gpsSerial.available() > 0) {
gps.encode(gpsSerial.read());
}
if (gps.location.isUpdated()) {
double currentLat = gps.location.lat();
double currentLng = gps.location.lng();
Then, we check if the current position is at least one meter from the previous one.
// Check if the distance from the last point is at least 1 meter
double distance = TinyGPSPlus::distanceBetween(lastLat, lastLng, currentLat, currentLng);
If they are, we update the lastLat and lastLng variables to the current position.
if (distance >= 1.0) {
lastLat = currentLat;
We also prepare the data in a String to be saved on the microSD card.
GPSdataToAppend = String(currentLng, 6) + "," + String(currentLat, 6) + "," + String(gps.altitude.meters());
We print the data in the Serial Monitor.
Serial.println(GPSdataToAppend);
And finally, we append the data to a file called data.txt on the microSD card.
appendFile(SD, "/data.txt", GPSdataToAppend.c_str());
Testing the Project
Upload the code to your board. It should initialize the microSD card and after a few seconds, it should start appending data to the microSD card (make sure you’re outside or close to a window).

If everything seems to be working as expected, disconnect the ESP32 from your computer and apply power using a portable charger or battery. Go for a walk with your circuit so that it starts recording your coordinates over time and you can obtain a considerable amount of points to design a path.
After recording some data, disconnect the microSD card from the module and connect it to your computer. The microSD card should have a data.txt file with the coordinates of your path.
For you to upload that data to Google Earth and design a path, we need to convert that file to .kml format.
KML Files
KML is a file format used to display geographic data in an Earth browser such as Google Earth. KML uses a tag-based structure with nested elements and attributes and is based on the XML standard. We won’t go into detail about the structure of this file. If you want to learn more you can check this tutorial about KML files by Google.
Converting your data.txt file to .kml format
1) Open the data.txt file with the GPS data gathered from the GPS module.
2) Edit your file so that your coordinates are between the <coordinates></coordinates> tags as follows:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="yellowPoly">
<LineStyle>
<color>7f00ffff</color>
<width>4</width>
</LineStyle>
<PolyStyle>
<color>7f00ff00</color>
</PolyStyle>
</Style>
<Placemark><styleUrl>#yellowPoly</styleUrl>
<LineString>
<extrude>1</extrude>
<tesselate>1</tesselate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
YOUR COORDINATES GO HERE
</coordinates>
</LineString></Placemark>
</Document></kml>
3) Save that file.
4) Edit its name from data.txt to data.kml. You’ll receive a warning about changing the file format. Accept it. Now, the file should be usable to upload to Google Earth.
Display the Path on Google Earth
Now, follow the next steps to display and visualize your path on Google Earth.
1) Go to the Google Earth Website.
2) Create a new project and give it a name.

3) Go to File > Import File to Project > Upload from device.

4) Select the .kml file created previously.
5) Your path will be displayed on Google Earth with a yellow outline.

Wrapping Up
In this guide, you learned how to use the NEO-M8N GPS module with the ESP32 and how to get information about location and time.
We also showed you how to log GPS data to a microSD card and how to edit that data in a format that Google Earth can interpret to display your path.
We hope you’ve found this guide useful. We have other projects you may like:
- ESP32 TFT with LVGL: Display GPS Location, Date, and Time
- ESP32 Remote-Controlled Wi-Fi Car Robot (Arduino IDE)
- ESP32 Datalogger: Download Data File via Web Server (Arduino IDE)
If you’d like to learn more about the ESP32, make sure to check out our resources:
Thanks for reading.
Hi Sara,
very interesting I’ll try it.
But it will possible in a future project to show directly in a ESP32 CYD or a ILI9341 display Google Maps?
I.e precharging a limited zone of Google Maps in the Sd card.
Bye Renzo
No
Hi.
That’s a very interesting project and quite complicated.
I’m not sure if that’s possible to do with this kind of display and with the ESP32.
Maybe there are lightweight libraries to draw a map, but I’m not familiar with it at the moment.
Regards
Sara
hi
any link about external GPS antenna ?
and eventually howto properly connect it (solder)
Thanks
Hi.
Has long as the antenna as an ipex connector (to uFL) or ipex adapter to UFL to connect to the board, you don’t need to solder.
Make sure it works in the range of 3 to 5V.
You can get a ufl to ipx connector separately if needed.
You can search on an online store for “external antenna gps ipex”
Regards,
Sara
Qual simulador você utiliza para essas imagens?
Obrigado, excelente conteúdo!
Olá.
Uso o fritzing.
Cumprimentos,
Sara
I made a similar one, but with Micro python, writing directly on Esp32 flash. Now I can improve it with your .KML template.
Thank you!