Arduino GPS Shield Functions Explainer

Today I’ll be explaining the functions of the Arduino GPS shield in 1Sheeld and how to use it to get longitude and latitude locations.

The Arduino GPS shield in 1Sheeld allows you to use your smartphone as a GPS receiver to be able to track your Arduino project wherever it is, using the GPS sensor on your smartphone.

If it’s the first time to hear of 1Sheeld board or didn’t use it before then it will be nice of you to check 1Sheeld’s getting started tutorial and then get back here.

First, it is important to understand how the GPS sensor works. GPS stands for Global Positioning System, and a GPS system is a receiver with an antenna that uses a network of 24 satellites covering Earth’s orbit. They provide position, timing and velocity information. Based on that, you can determine a single point of intersection between the longitude and latitude lines.

                                                                     BBC illustration of longitude and latitude lines

Now that we know how a GPS sensor works, let’s use the Arduino GPS shield by downloading 1Sheeld library, to access its functions.

1Sheeld Arduino GPS shield functions

  • getLatitude
  • getLongitude
  • isInRange
  • getDistance
  • radian
  • setOnValueChange

The first 2 functions: getLatitude and getLongitude

These are the 2 main functions of the Arduino GPS shield, they get the latitude and longitude data f the smartphone, so you are able to get its location.

From the description of the functions, you realize it has no parameters and 1 return value which is the latitude and the longitude. The values are returned as a float.

The syntax for these functions are:



A good use of these functions is the GPS car tracking device project by Mohammed Selim, where he put an Arduino, a 1Sheeld and a smartphone inside his car. The Arduino GPS shield in 1Sheeld gets the longitude and latitude of the car and the Arduino sends him an SMS containing the coordinates of the car.

isInRange function

Assume that you are building a project to know if your car is stolen or not. So, you put an Arduino GPS system in your car, you set a specific coordinates ranging 20 meters away from home, and you want to know if your car gets out of this range or not.

This is exactly what the isInRange function does. Form the description, you get to know that you need to feed this function the following parameters:

  • A certain latitude
  • A certain longitude
  • The maximum range of meters you would specify

The return would be a yes or no, which means a boolean return.

The syntax for this function is:


Example of this function:


This function returns a distance between a given latitude and longitude, and the smartphone in your Arduino GPS project. The distance is returned in the form of a float representing the distance in meters.

To do that, you have to send 2 parameters which are the latitude and the longitude of the specific location you want to measure the distance between it and the Arduino GPS project.The syntax for this function is:

float GPS.getDistance(fixedLatitude,fixedLongitude);


This is a helper function that converts the value of a GPS latitude or longitude reading from degree to radian. The default values from the Arduino GPS s come in a degrees format, but in some calculations, you’ll need to use the value in radian.

The function takes a float parameter in degrees and returns a float parameter in radians.

The syntax for this function is:


Finally, the setOnValueChange function

This is a default function in all 1Sheeld Arduino shields, it indicates a change in any of the values of a certain sensor shield, which in this case: The Arduino GPS shield.

This function triggers a function written by the user to run once there is a change in the latitude or longitude value.The syntax for this function is:


An example of this function is:

At the end, I hope I have covered all the Arduino GPS Shield functions very clearly and if you have any queries please share them with me down in the comments.
And of course, don’t forget to check out lots of Arduino Projects made using 1Sheeld especially, that many of them have used the Arduino GPS shield.

Related Blogs

Arduino Robotics

Arduino Robotics Series, from a car to a robot arm

Arduino keeps standing out from the crowd of all-around development boards due too its ease of use and budget price. As a result, this has enabled almost anyone to get his own idea into life no matter how crazy or even useless to the whole world it was, except for its maker! Also, it has …

Arduino Robot Arm

How to build an Arduino Robot Arm placed on RC Car

Arduino robots are always funny and definitely more enjoyable when combined with robotic arm! And today, I will walk you through the making of a simple Arduino Robot Arm that’s made of cardboard and how you can attach it over your Arduino Bluetooth RC Car / Robot that you have made so far through this series. …

Arduino Line Following Robot

How to build an Arduino Line Following Robot using Cardboard

Arduino Line Following Robot is one of the easiest and most well-known projects that anyone can make to learn the basics of programming, electronics, and mechanics all in one project. It’s known that this project is common for most of the makers and tech students and today I am going to give it a revisit …

Arduino Obstacle Avoiding Robot

How to build an Arduino Obstacle Avoiding Robot using Cardboard

Back again with another Arduino Bluetooth RC Car tutorial but with an advanced feature that makes your car autonomous by adding ultrasonic sensors to the RC Car you have made before!. Yeah, I know that you may have seen other tutorials using ultrasonic to make the car/robot avoid obstacles ahead, but I am going to …

Arduino Bluetooth RC car

How to make an Arduino Bluetooth RC Car using Cardboard

  Cardboard crafts are one of the most popular and easy to make DIY stuff. Mixing this with the unmatchable enjoyment of RC Cars and the ease of using Arduino, I am going to show you how to make a Cardboard Arduino Bluetooth RC car that you can control via Bluetooth from your smartphone.  …

Arduino Security Camera

Arduino Security Camera System (Arduino Home Hacks #4)

Arduino Security Camera Have you ever wanted to check your home in real time? Afraid that maybe someone has stormed in, don’t remember if you shut the door or not or maybe wanna check if your Hyper-energetic dog has broken any of your dishes AGAIN!! 🙂 Then this is the perfect place for you cause today …