Getting location co-ordinates using the GPS shield

Ever wanted to know your exact location on Earth? Or you wanted to know how fast you are moving? A GPS is what we need. But what if I want to determine all this using an Arduino? A GPS shield will then come in handy! Therefore, in this tutorial, we will be exploring on how do we interface an Arduino board with a GPS shield.


The GPS shield I’m using uses a ublox receiver module & has a SD slot that support micro-SD card interfacing, which would be very useful if I want to keep/ record down certain coordinates. The GPS shield is quite easy to use: you just have to attach the small antennae on the shield, then insert the shield on top of an Arduino Uno or Mega and use Arduino Serial Monitor to retrieve the coordinates of your location.


To test out this shield, I used the following code below to display the coordinates of my current location. This is the sample code from Elecrow Wiki:

In line 4, we will import the software serial library. Why? The GPS shield has a UART, which is a hardware which supports serial communication that is used for serial communication with the satellites to get our location. And since arduino built-in serial support for serial communication (on pins 0 & 1) is used for arduino – computer communication, I need to use other digital pins for the GPS serial communication. This is where the Software Serial Library comes to the rescue.

Line 25 is where we will get the ouput/ values for my location as a series of standard strings of information, under something called the National Marine Electronics Association (NMEA) protocol. The output will contain the following information:

  • $GPGGA: Global Positioning System Fix Data
  • $GPGSV: GPS satellites in view
  • $GPGSA: GPS DOP and active satellites
  • $GPRMC: Recommended minimum specific GPS/Transit data

For more info on GPS on arduino, you can visit this page or here. There are many information that can be obtained from these series of trings, which includes your co-ordinate, the current UTC date & time, your current altitude, speed, and many more.

Following Elecrow’s tutorial, I found out that the serial output from the arduino can be parse by this software called u-center. (It’s actually their software [ublox], since they developed the GPS chip…) This is pretty handy in displaying all the details visually instantly (you won’t want to decode the location by yourself, right?) You can check out the software here:


For the one above, the satellites are still trying to locate me & the location may not be accurate. (Notice the cyan locator on the world map). After a while (around 5 minutes), my location has been locked down as the locator icon has turn green. The coordinates of my location now should be more accurate.


I noticed that some data was not displayed and some data (like the speed) were wrong. For example, I was not moving the GPS shield, but the software stated my speed as 0.38m/s. I’m not sure why…

After testing the GPS shield out, I decided to output some GPS data onto a LCD screen, so that I can create a small and portable “GPS device”. (It will be quite troublesome if I have to carry around my laptop with the wire connected to the Arduino, and people around will be giving me that weird look.) So, next up, we’ll be building a simple Arduino GPS device!


The “GPS” device

This is how GPS device will look like, which display the coordinates of the current location with an accuracy of up to 5 decimal places (in terms of longitude and latitude). Other than that, it will also tell you the current (UTC) date & time when you hole the button. For this device, I made use of the TinyGPS library instead of writing function to decode the long strings of information. This library will help decode & parse the long GPS information for you, so the code will not look so complex and will save your time. You can check out their library at their website:

Here are more images of the device in action:

Parts used:

  • LCD Screen x 1
  • Potentiometer x 1 (For LCD Display)
  • 330-Ohm Resistor x 1
  • LED x 1
  • Many Jumper Wires



[Coming soon…]



This is source code, which will display the current location coodinates. In addition, I have included a button to check date & time function when it is pressed:


You may also like...