How to interface a GPS module with Arduino


In this tutorial we are going to interface a GPS Module with Arduino.

Any GPS module with serial communication will do, but we will be using the popular U-BLOX Neo 6M here.

Parts used in this tutorial

  • An Arduino Uno
  • Ublox NEO-6M GPS Module
  • 4 jumper cables

You can buy the module from the usual suspects: ebay, Amazon or Aliexpress. The one used in this tutorial was sourced from Aliexpress. Here’s the transaction page with the keywords you should be looking for:

U-blox NEO-6M GPS Module used in this tutorial
U-blox NEO-6M GPS Module used in this tutorial

You can note straight away that the module only uses 4 pins: VCC, GND, RX, and TX: this is because these modules communicate over a simple serial RS232 connection; the exact same protocol the Arduino uses when you write “Serial.begin”.

The module is incredibly simple: it just spits non stop NMEA data strings to the TX pin. “NMEA” stands for “National Marine Electronics Association” and is a standard text protocol shared by all GPS. This tutorial will only demonstrate how to exploit the data stream, but feel free to dig deeper in the underlying features this standard has to offer!

The GPS module with the antenna attached
The GPS module with the antenna attached


Connecting the GPS Module to Arduino

To connect your GPS module to Arduino, use a +5V from the power side of the Arduino and any ground pin. Any two pins will work for the serial communication, but on this tutorial we will use 3 and 4:

  • Connect Arduino pin 3 to the RX pin of the GPS Module.
  • Connect Arduino pin 4 to the TX pin of the GPS Module.

WARNING: Most GPS module are happy to work off 5V, but the U-BLOX Neo 6M used here can only support a maximum voltage of 3.6V. If you look closely on the GPS board you will see a tiny K833 series 3.3V voltage regulator. Please make sure the module you buy benefits from the same level of security.

Arduino connected to GPS Module
Arduino connected to GPS Module

Once everything is ready, you should have something looking like the picture below:

GPS Module connected to Arduino Uno. Note: the Uno is a beautifully made Robotdyn clone.
GPS Module connected to Arduino Uno. Note: the Uno is a beautifully made Robotdyn clone.

Reading raw data from the GPS

Reading raw data from the GPS is a very trivial matter: simply create a new serial connection using SoftwareSerial and match the default baud rate of your GPS module. On most, it should be 9600 bauds; but don’t take my word for it and check on your module.

Default baudrate specified on this particular module.
Default baud rate specified on this particular module.

The code below just outputs to the SerialMonitor whatever it can read from the GPS without filtering:

#include <SoftwareSerial.h>

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()

void loop()
  // Output raw GPS data to the serial monitor
  while (ss.available() > 0){

Your Serial Monitor should look like this:

Raw GPS Data
Raw GPS Data

This gibberish is the “native language” of your GPS and contains all the information a GPS can provide: time, latitude, longitude, GPS satellites in view… However, there is no need to dig deeper into this, as the community has long jumped in to provide libraries that are able to decode and interpret automatically these strings of characters. In this tutorial we will focus on TinyGPS++.

Using a library: TinyGPS++

While it is entirely possible to work with GPS raw data, you might want to consider using one of the numerous libraries first. On Arduino, the reference and most advanced GPS lib is Mikal Hart’s TinyGPS++. Head over to GitHub and download the latest release first. Once complete, unzip the content into your “libraries” subfolder of your Arduino IDE installation and restart the IDE itself.

Installing TinyGPS++ library
Installing TinyGPS++ library

You should now have a new set of “Examples” under File/Examples/TinyGPSPlus.

“DeviceExample” has all the information you need. Don’t forget to set the correct baud rate, RX and TX pins and you are ready to go!

Raw GPS data parsed by TinyGPS++
Raw GPS data parsed by TinyGPS++


If you have troubles getting any data coming out of your module; let it stay plugged at 5V for about a minute. GPS modules have really slow “cold start” times. When it’s ready, some modules have a blinking LED indicating it’s sending data. Make sure to check this out before thinking your device is faulty.

For now, enjoy playing with your new toy!

Leave a comment

Your email address will not be published. Required fields are marked *

38 thoughts on “How to interface a GPS module with Arduino”