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
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.
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.
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:
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:
/* This function will be invoked each time a new value comes to arduino from the
smartphones gps sensor. */
/* Turn on the led once any button is pressed*/
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.
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 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 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 …
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 …
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 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 …