Overview

A GPS module is the component of choice when your project involves getting GPS coordinates, such as a when you are building a tracker or any similar project. In this tutorial you will discover how to connect a GPS Module to an Arduino. Using a GPS module can be a little tricky but with the right approach we can get it working in no time.

Details

GPS Modules/ Receivers communicate with the satellites that make up the Global Positioning System to accurately calculate position and time anywhere on the planet. For a more detailed explanation on how GPS works, check out this GPS tutorial on Sparkfun. There are many tutorials available on the market.

You can get GPS Modules at Amazon or ebay for cheap. If you live in Ghana you can buy one at Invent Electronics. We will be using the Ublox-Neo 6M for this example since it is relatively easy to use and you can get it up and running with very little configuration.

Here is a complete list of components needed for this circuit

  • Ublox Neo-6M/7M GPS module
  • Arduino Uno
  • Some jumper wires
  • A breadboard (optional)

This is how the GPS Module looks like. It is very easy to connect to your Arduino board requiring only four pins for VCC, GND, Rx and Tx since data is sent over a serial interface

uart-gps-neo-7m-c_l_1_5-e1479725162921

Schematic

Below is a Fritzing image of how to connect the GPS module to an Arduino. We will be using Software Serial for this project therefore pins Rx and Tx of the GPS module will be connected to pins and of the Arduino respectively.  VCC and GND go to 5v and GND of the Arduino respectively as usual. This has been defined in the example code but you can change it as per your wish.

Arduino Code

To get started you’ll need to download the TinyGPS++ library by Mikal Hart and install it into your Arduino folder.  Check out this Sparkfun tutorial on how to install an Arduino library if you don’t know how to do so already.

The TinyGPS++ library is basically a parser which takes in the raw NMEA data being outputted by the GPS module, parses it and extracts and displays relevant data from it such as latitude, longitude, data, time and even altitude. After extraction you are at liberty to use the data in your application.

Here is one of the example sketches you can run to test your GPS module.

The code is found in the Arduino example sketches under the TinyGPS++ category

 

After uploading the code, press Ctrl + Shift + M to open the Serial monitor. If all goes well, the GPS light should start blinking and the data should start pouring in. The results are fairly accurate most of the time with deviations of not more than 100 meters in many cases. I copied the GPS readings I was getting, put it in  Google Maps and got my location fairly accurately.

 

arduino-gps-serial-monitor

Here is GPS data pouring in from the GPS module

Here is a complete assembly of the circuit

NOTE

Each GPS module has its own baud rate which is specified on the datasheet by the manufacturer. The Ublox NEO-7M I am using has a baud rate of 9600. It may vary for other GPS modules so do well to check what baud rate your particular board uses

 

So, thats it!

I hope you enoyed this tutorial. Please leave a comment. The feedback gives me a lot of motivation to do more tutorials.

%d bloggers like this: