Arduino Uno is a microcontroller board that can be interfaced with various sensors and modules, including GPS modules, to obtain real-time location information. UBlox NEO-M8N GPS Module is a high-performance GPS receiver that provides accurate positioning information. In this tutorial, we will walk you through interfacing and programming the GPS module with an Arduino Uno, NMEA message formats, and GPS data interpretation for real-world application. If you are designing a tracking system, navigation system, or location-based automation, this tutorial will walk you through how to set up and retrieve accurate GPS coordinates efficiently.
Materials Required
Part | Quantity |
---|---|
Arduino Uno | 1 |
UBlox NEO-M8N GPS Module | 1 |
Jumper Wires (Male-to-Male) | 4 |
USB Cable (Type A to B) | 1 |
Working
The UBlox NEO-M8N GPS module calculates position through the analysis of timed signals from a group of satellites. It calculates signal delays from a minimum of four satellites through trilateration to calculate precise latitude, longitude, altitude, and velocity. The module processes the information and broadcasts formatted NMEA-0183 standardized messages (such as GGA and GPRMC) via its serial interface. Arduino Uno accepts them through a SoftwareSerial connection and then decodes and processes them using the TinyGPS++ library to obtain usable location data.
Pinout

VIN: Module power supply – 5V
GND: Ground
RX: Received data via serial protocol
TX: Sending data via serial protocol
Hardware Overview

UBlox NEO-M8N GPS Module
The UBlox NEO-M8N GPS Module is a high-speed GPS reciever that is made for precise positioning. It contains a 72 channel Ublox M8 engine which enables it to simultaneously track multiple satelite systems to provide enhaced accuracy. It has a Ceramic Active Antenna, which enhances signal reception even in difficult conditions. It sends NMEA 0183 standard data to provide real-time GPS data. It has four pin connections: VCC (power supply, generally 3.3V–5V), GND (ground), TX (transmiter to send GPS data), and RX (reciever to receive commands).
OnBoard Component:
RF Components – With another LNA to amplify the weak signals further and another SAW filter to enhance signal purity.
RTC Crystal – Offers accurate timekeeping and rapid satellite acquisition after power cycles.
Antenna System – Comprises an onboard antenna and pins to connect active and passive external antennas for best reception according to requirement.
Data Logging – Able to retain position data for later analysis.
Communication Interfaces – Includes UART, I2C, and SPI for microcontroller communication.
1PPS Output – Provides accurate timing pulses for synchronism.
Status Indicators – Some breakout boards have LEDs that show power and GPS fix status.
Connection between GPS Module and Arduino Uno

To interface the GPS module with Arduino Uno, do the following:
Firstly, connect the Vcc of the GPS module to 5V of Arduino Uno.
Secondly, Connect the GPS Rx (Receiver) to D3 on Arduino.
Then, Connect Tx of GPS to D4 of Arduino.
Finally, Connect the GND (Ground) of the GPS to the GND of Arduino Uno.
Download & Install Required Libraries

You will need to install some libraries in the Arduino IDE. Download the following:
Software Serial Library
TinyGPS and TinyGPS plus Library for Arduino
Download and install them in the Arduino IDE.
Using Arduino Software (IDE)
- Open the Arduino IDE and import the example code:
- First, Choose File
- Then, Go to Examples
- After that, Select TinyGPSPlus-master
- Finally, Open the DeviceExample or copy the code and upload it to arduinio
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
/*
This sample sketch demonstrates the normal use of a TinyGPSPlus (TinyGPSPlus) object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;
// The TinyGPSPlus object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
void setup()
{
Serial.begin(115200);
ss.begin(GPSBaud);
Serial.println(F("DeviceExample.ino"));
Serial.println(F("A simple demonstration of TinyGPSPlus with an attached GPS module"));
Serial.print(F("Testing TinyGPSPlus library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
Serial.println(F("by Mikal Hart"));
Serial.println();
}
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while(true);
}
}
void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
Reviewing the Output
Run the code and use Serial Monitor in Arduino IDE. You can observe NMEA sentences in the output. These are the raw GPS messages.
COM19
X
Send
SGLGSV, 3, 3,09,88,02,181, *56
$GNGLL, 1837.84356, N, 07352.30253, E, 074131.00, A, D*77
$GNRMC, 074132.00, A, 1837.84366, N, 07352.30260, E, 0.139,,281119,,,D*67
SGNVTG,,T,,M, 0.139, N, 0.258, K, D*3C
$GNGGA, 074132.00, 1837.84366, N, 07352.30260, E, 2, 10, 1.49, 605.0, M, -67.7, M,, 0000*61
SGNGSA, A, 3, 31, 14, 10, 32, 25, 41, 26,,,,,, 2.33, 1.49, 1.79*1C
SGNGSA, A, 3, 77, 76, 66,,, 2.33, 1.49, 1.79*1C
$GPGSV, 4, 1, 15, 01, 26, 314, 25, 08, 07, 243, 23, 10, 40, 094, 33, 11, 19, 293, 25*78
$GPGSV, 4, 2, 15, 14, 48, 354, 27, 16, 05, 184,, 20, 18, 118,, 22, 15, 319, 19*7E
$GPGSV, 4, 3, 15, 25, 14, 071, 31, 26, 21, 163, 25, 27, 09, 211,, 31, 85, 100, 41*7D
$GPGSV, 4, 4, 15, 32, 35, 029, 42, 40, 59, 227,, 41, 66, 153, 40*4E
$GLGSV, 3, 1, 09, 66, 30, 042, 43, 67, 27, 341, 22, 76, 31, 045, 44, 77, 59, 123, 39*6A
$GLGSV, 3, 2, 09, 78, 23, 181, 18, 81, 27, 219,, 82, 30, 277, 13, 83, 08, 321, *6E
$GLGSV, 3, 3, 09, 88, 02, 181, *56
$GNGLL, 1837.84366, N, 07352.30260, E, 074132.00, A, D*77
$GNRMC, 074133.00, A, 1837.84370, N, 07352.30263, E, 0.255,, 281119,,, D*6B
Autoscroll
Show timestamp
Newline
115200 baud
Clear output
NMEA Message Format Understanding
NMEA messages begin with a $ and are separated by commas. The $GNGGA message provides 3D location information.
This is how you decipher the message:
GN in $GNGGA is GPS position. GGA stands for Global Positioning System Fix Data. The initial section prior to the comma identifies the message type.
Example of a NMEA sentence:
mathematicaCopyEdit$GNGGA,073242,1837.84511,N,07352.30436,E,1,11,17,8,M,-67.7,M,,,*60
Breaking it down:
- 073242 → Time when GPS data was recorded (07:32:42 UTC)
- 1837.84511,N → Latitude (18° 37.84511’ North)
- 07352.30436,E → Longitude (73° 52.30436’ East)
- 1 → Fix quality (1 = GPS fix, 2 = DGPS fix, 0 = no fix, etc.)
- 11 → Number of satellites detected
- 17 → Horizontal dilution of position (lower is better)
- 8,M → Altitude in meters above sea level
- -67.7,M → Geoid height (sea level height above WGS84 ellipsoid)
- Empty fields → DGPS update time and station ID (if available)
- *60 → Checksum value (used for error checking)