Intro: Arduino GPS Shield Tutorial: Distance Calculator
GPS or Global Positioning System is a satellite-based radio navigation system which allows you to get your location and guide you through other locations through a well recognized and predefined map like Google maps, and in the world of Arduino, this is accomplished by the Arduino GPS Shield.
The GPS knows your location through the latitude and longitude values of your location which specifies where exactly are you from the world and we are going to use these two measurements to calculate the distance between your current location and the desired destination using the GPS shield on 1Sheeld in a quick and funny Arduino GPS Shield Tutorial .
Let’s talk about the idea behind this Arduino GPS Shield Tutorial ...
In the Arduino GPS Shield Tutorial , we are going to use the GPS Shield from 1Sheeld via its companion Android/iOS App to get the current location.
We achieve this by telling the App (by using the voice recognition shield), both the latitude and longitude of the desired location we want to reach and the Arduino will calculate the direct distance between the 2 locations in km unit (by using the GPS shield) and tells you (by using the text-to-speech shield) what is the distance.
If this is your first time to deal with 1Sheeld or you want to learn more about it, I recommend checking this quick and easy getting started tutorial.
Now, after you've become a little bit familiar with 1Sheeld, let's start!
Step 1: Hardware Components:
- Arduino Uno.
- 1Sheeld+ board.
- Arduino USB cable or 9-12v battery.
- Android/iOS phone with 1Sheeld App installed on it.
Step 2: Software Components:
Step 3: Connection and Schematic:
- Plug the 1Sheeld board into your Arduino as image1.
- Connect the LCD 16*2 as image2.
- Switch the 1Sheeld power to operate on 5v (Not the 3.3v) as image3.
1Sheeld have 2 modes: Uploading mode and Operating mode. You can switch between them using the switch close to the Digital pins and is called “UART SWITCH” on 1Sheeld and “SERIAL SWITCH” on 1Sheeld+.
- Firstly, you slide the switch towards the “SWITCH” notation as image4 which turns the 1Sheeld board into the Uploading mode to let you upload the Arduino code.
- Secondly, after you finish uploading the code, slide the switch towards the “UART” notation (or “SERIAL” at 1Sheeld+ board) as image5 which turns the 1Sheeld board into the Operating mode to communicate with your smartphone 1Sheeld App.
Finally, connect the Arduino via your PC using Arduino USB cable.
Step 4: Code
I would recommend checking the Arduino GPS Shield documentation to know more about the Arduino GPS Shield functionality and how to use them.
Now, switch the 1Sheeld board to the Uploading mode, upload the attached code for the Arduino Digital Clock. Switch the 1Sheeld board to the Operating mode then open the 1Sheeld app and connect it to the 1Sheeld board via Bluetooth.
As you see in the Arduino GPS Shield Tutorial video, you should select the GPS, Terminal, Text-to-speech and Voice recognition shields.
Once you navigate to the voice recognizer shield and tell your phone the location you want in terms of latitude and longitude values, it will calculate the distance between the current location and the location related to the entered latitude & longitude and tells you loudly the distance and also written in the Terminal shield tab.
In this tutorial, I wanted to know the distance between my current location "Integreight company" and the Ramsis Train Station in Cairo’s downtown and it was 8.327 km and I calculated it from Google maps too where the error was so little (Google maps distance is: 8.22km according to the screenshots).