Arduino GPS tracker project with NEO-6M GPS module and MicroSD logger
Arduino Build Lab

Arduino GPS Tracker

Learn how to build a portable Arduino GPS tracker that reads satellite data, logs latitude and longitude to a MicroSD card, and runs from battery power. You will wire the GPS module, read serial NMEA data, save a CSV log, and test the tracker outdoors where GPS actually works best.

What You Will Build

You are building a compact GPS data logger. When the tracker is powered on, the GPS module listens for satellite signals. The Arduino reads the GPS serial stream, extracts useful location data, and saves it as a CSV file on the MicroSD card.

After a walk, bike ride, field test, or vehicle trip, you can remove the card and open the log on your computer. The result is a simple but very real location tracking system.

Arduino Nano GPS tracker full build with GPS module, MicroSD logger, and portable battery

Parts You Need

Recommended Parts List

Component Description Amazon Link
Arduino Nano Main controller board for the GPS tracker View on Amazon
NEO-6M GPS Module Receives live satellite GPS coordinates View on Amazon
MicroSD Module Stores GPS route data to memory card View on Amazon
MicroSD Card Stores CSV tracking logs View on Amazon
USB Power Bank Portable battery power for field testing View on Amazon
Jumper Wires Breadboard and module connections View on Amazon
Important: GPS modules usually need a clear view of the sky. Indoor testing is often weak or totally dead. Test near a window only for basic serial checks, then go outdoors for real lock testing.

How GPS Serial Data Works

The GPS module sends a constant stream of text sentences called NMEA data. Those sentences contain time, satellite status, latitude, longitude, speed, altitude, and other values. Reading raw GPS sentences by hand is ugly, so the Arduino sketch uses TinyGPSPlus to parse the data into clean values you can use.

The basic flow is simple:

  1. The GPS module sends serial data through its TX pin.
  2. The Arduino receives that data on a software serial pin.
  3. TinyGPSPlus checks the stream and extracts valid location updates.
  4. The SD module writes each valid point to gpslog.csv.
Computer monitor showing live Arduino GPS serial data with latitude and longitude

Wiring the GPS Tracker

Wire the project carefully. The GPS module uses serial communication. The MicroSD card uses SPI communication. Keep the wiring neat so you can troubleshoot fast if the SD card or GPS module fails to start.

Arduino GPS tracker wiring diagram with NEO-6M GPS and MicroSD card module
GPS ModuleArduino Pin
VCC5V or 3.3V depending on your breakout board
GNDGND
TXD4
RXD3
MicroSD ModuleArduino Nano/Uno Pin
VCC5V
GNDGND
CSD10
MOSID11
MISOD12
SCKD13
Close-up of NEO-6M GPS module connected to Arduino NanoMicroSD card logger module connected to Arduino GPS tracker

Install the Arduino Libraries

  1. Open the Arduino IDE.
  2. Go to Sketch - Include Library - Manage Libraries.
  3. Search for TinyGPSPlus and install it.
  4. The SD, SPI, and SoftwareSerial libraries are normally already included with the Arduino IDE.

Full Arduino GPS Logger Code

This version reads GPS coordinates, prints them to the Serial Monitor, and saves valid points to a CSV file on the MicroSD card.

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <SD.h>

TinyGPSPlus gps;
SoftwareSerial gpsSerial(4, 3); // GPS TX to D4, GPS RX to D3

const int chipSelect = 10;
File gpsFile;

void setup() {
  Serial.begin(9600);
  gpsSerial.begin(9600);

  Serial.println("Arduino GPS Tracker Starting...");

  if (!SD.begin(chipSelect)) {
    Serial.println("SD card failed. Check wiring and card format.");
    return;
  }

  Serial.println("SD card ready.");

  gpsFile = SD.open("gpslog.csv", FILE_WRITE);
  if (gpsFile) {
    gpsFile.println("Date,Time,Latitude,Longitude,Altitude_m,Speed_kmph,Satellites");
    gpsFile.close();
  }
}

void loop() {
  while (gpsSerial.available() > 0) {
    gps.encode(gpsSerial.read());

    if (gps.location.isUpdated()) {
      logGPSData();
    }
  }
}

void logGPSData() {
  double latitude = gps.location.lat();
  double longitude = gps.location.lng();
  double altitude = gps.altitude.meters();
  double speed = gps.speed.kmph();
  int satellites = gps.satellites.value();

  Serial.print("Latitude: ");
  Serial.println(latitude, 6);
  Serial.print("Longitude: ");
  Serial.println(longitude, 6);
  Serial.print("Satellites: ");
  Serial.println(satellites);
  Serial.println("----------------------");

  gpsFile = SD.open("gpslog.csv", FILE_WRITE);

  if (gpsFile) {
    if (gps.date.isValid()) {
      gpsFile.print(gps.date.month()); gpsFile.print("/");
      gpsFile.print(gps.date.day()); gpsFile.print("/");
      gpsFile.print(gps.date.year());
    } else {
      gpsFile.print("NO_DATE");
    }

    gpsFile.print(",");

    if (gps.time.isValid()) {
      gpsFile.print(gps.time.hour()); gpsFile.print(":");
      gpsFile.print(gps.time.minute()); gpsFile.print(":");
      gpsFile.print(gps.time.second());
    } else {
      gpsFile.print("NO_TIME");
    }

    gpsFile.print(",");
    gpsFile.print(latitude, 6);
    gpsFile.print(",");
    gpsFile.print(longitude, 6);
    gpsFile.print(",");
    gpsFile.print(altitude);
    gpsFile.print(",");
    gpsFile.print(speed);
    gpsFile.print(",");
    gpsFile.println(satellites);

    gpsFile.close();
  } else {
    Serial.println("Could not open gpslog.csv");
  }
}

Portable Power Setup

For the first build, use a USB power bank. It is safer, easy to recharge, and gives you stable 5V power. Once the project works, you can move to a smaller Li-ion battery module and a project enclosure.

Portable Arduino GPS tracker battery power setup in transparent enclosure
Do not skip this: If you use a lithium battery, use a proper charging and protection board. Do not connect raw Li-ion cells directly to an Arduino project unless you know exactly what you are doing.

Outdoor Field Test

Take the tracker outside, power it on, and give the GPS module time to lock. A cold start can take several minutes. Once it has lock, move around slowly and watch the Serial Monitor. If the latitude and longitude values update, your tracker is working.

Arduino GPS tracker being tested outdoors on a hiking trail
  1. Power the tracker from the USB battery pack.
  2. Wait for GPS lock outdoors.
  3. Let it log for at least 5 to 10 minutes.
  4. Remove the MicroSD card.
  5. Open gpslog.csv on your computer.

Reading the CSV Log

Your CSV file will contain rows of location data. You can open it in a spreadsheet, clean it up, and use the latitude and longitude points with mapping tools.

Spreadsheet showing Arduino GPS CSV location logging data
ColumnMeaning
DateGPS date if available.
TimeGPS time in UTC.
LatitudeNorth/south coordinate.
LongitudeEast/west coordinate.
Altitude_mEstimated altitude in meters.
Speed_kmphEstimated movement speed.
SatellitesNumber of satellites used by the GPS module.

Troubleshooting

ProblemFix
No GPS coordinatesGo outdoors, wait longer, and check that GPS TX goes to Arduino D4.
SD card failedFormat the card as FAT32, check CS pin D10, and verify SPI wiring.
Random characters in Serial MonitorSet the Serial Monitor to 9600 baud.
Only zeros or invalid dataThe GPS has not locked yet. Wait outside with a clear sky view.
Tracker resets on batteryUse a better USB power bank or check your battery module current output.

Recommended Video Section

These lightbox videos support the build: NEO-6M GPS setup, Arduino GPS data logging to MicroSD, and a complete Arduino GPS tracker walkthrough.

Arduino GPS tracker tutorial video thumbnailNEO-6M GPS wiring tutorial thumbnailPortable Arduino GPS logger video thumbnail

Download the Full GPS Tracker PDF Guide

Save the complete Arduino GPS Tracker tutorial offline with wiring, code, GPS logging setup, portable power notes, and troubleshooting steps.

📄 Download PDF Guide