GPS is an important capability you would need especially for Ariel and water bots. GPS has widely used also in security tagged devices like child tracker, car tracker.
You would by now be knowing ‘Triangulation
‘ model to calculate distance from two points. However, with GPS we need to determine 4 values, i.e. latitude, longitude, elevation, and time based on a process called as
. To know more about the theory of GPS have a look at the references section.
The aim of this blog:
We will explore what are options we have to interface GPS with an Arduino UNO using both I2C and shield options. We will also look at the standard libraries and codes that can be used to test GPS via Arduino.
Things to consider in a GPS module:
A module is an add-on electronics circuit board. A shield in Arduino world is a stack-able electronics board that sits on top of GPIO pins and adds the respective shield feature like GPS, Ethernet, Motor driver. In Raspberry Pi world this is called as a ‘hat’.
With GPS we need to determine 4 values, i.e. latitude, longitude, elevation, and time called as
a) The number of channels:
GPS provides you with a number of channel options. Channel in GPS in very layman terms are like windows in a house. Each window will wait for the signal to receive in various frequencies before a signal lock. After a signal lock is achieved some channels may be switched off. More channels may not be actually needed for DIY robotics as time for locking is not killing in most cases.
b) Almanac and Ephemeris GPS data:
These are the two types of data received. Ephemeris data is the orbital information of the satellite sending the data and Almanac data is the status information of all the satellites in the GPS program. Almanac is more generic data compared to Almanac data.
c) Start-up Times (Hot, Warm, and Cold):
Start-up time is the time a GPS module takes to lock a signal and depending on this there are 3 types which you find in the market.
Cold Start – If you power down the module for a long period of time and the backup cap dissipates, the data is lost. On the next power up, the GPS will need to download new almanac and ephemeris data. This is called as ‘cold start’ and these modules take the longest time to lock.
Warm Start – Depending on how long your backup power lasts, you can have a warm start, which means some of the almanac and ephemeris data is preserved, but it might take a bit extra time to acquire a lock. This is called as ‘warm start’.
Hot Start – A hot start means all of the satellites are up to date and are close to the same positions as they were in the previous power on state. With a hot start the GPS can immediately lock.
d) The rate of update:
This is the time after which GPS module will re-check for the signal. So 1 Hz will mean check every second for the signal. So again for DIY projects, you can settle for a decent update rate as you don’t need to recalculate GPS position more than a second. This, however, does not hold true for Ariel robots which need more frequent updates. So get you pick here based on your project type.
Ephemeris data is the orbital information of the satellite sending the data and Almanac data is the status information of all the satellites in the GPS program. Almanac is more generic data compared to Almanac data.
Like as electronics check power requirements. Power is Voltage x Current so check the datasheet to correspond. Most have 3.3 V at 30 mA.
Arduino based GPS using I2C option:
I2C is one of the options when it comes to linking GPS to your Arduino bot.
The board we will talk is from Parallax and is called as
This one is simple to configure and has 4 pins i.e positive, negative, signal and ground.
The map is as below-
GND -> GND Arduino 5V -> GPS 5V Arduino Pin 3 -> Rx Arduino Pin 4 -> Tx
Once connected the device can be checked by the Arduino IDE.
This library also provides the sample codes which you can readily use for the sample test.
Arduino based GPS using the shield:
There are a number of shields available for the GPS. One such shield is the ‘Adafruit ultimate GPS logger shield’.
The Adafruit ultimate GPS logger shield is amazing because:
a) It has amazing documentation b) Library is well documented with example c) Has a stackable head where you can mount additional components e) Had provided extra Tx Rx of the GPS on the proto board f) Build in data logger which can be used with SD card
You can connect the shield using the soft port 7,8 of the Arduino. Note this works for Arduino family with soft port enabled like UNO.
The libary provided is at the link below and is called as ‘ Adafruit_GPS’.
Open up the File→Examples→Adafruit_GPS→leo_echo sketch and upload it to the Arduino. Then open up the serial monitor. This sketch simply reads data from the software serial port (pins 7&8) and outputs that to the hardware serial port connected to USB.
The coin battery is needed for time keeping when the board has no direct power and is recommended but not mandatory. The baud rate is at 9600 at 1Ghz but the rate can be increased as well.
Both the board are not that costly and can be an ideal component of your next robotic project using Arduino. The example library provides a quick testing option. GPS based navigation in robots can be very interesting and can add loads of values to your robot.
So why not give it a try?
References and attribution: