How to Interface GPS with Arduino
Every single location in the entire globe can be specified in terms of geographical coordinates. The geographical coordinate is a system which specifies any given location on the earth surface as latitude and longitude. There are devices which can read the geographical coordinates of a place with the help of the signals received from a number of satellites orbiting the earth. The system of satellites which helps in the positioning of a place is called Global Positioning System (GPS). The devices which can read the geographical coordinates of a place with the help of at least four GPS satellites are called GPS Receiver or simply GPS module.
The GPS module continuously produces a set of data regarding the position of the earth surface where it is situated which includes the current position with respect to the equator of the earth in terms of Latitude and Longitude. This data can be decoded and printed into the readable format with the help of a microcontroller only. In this project the data regarding the geographical coordinate is extracted from the GPS output with the help of the Arduino. The Arduino can be used as a stand-alone board of which the output or inputs can be taken from the boards or given to the board. They can communicate using standard communication ports like USART, TWI, SPI etc. which enables them to be connected with various kinds of devices. The Arduino board is designed for easy prototyping and the IDE used for coding is very simple and provides so many libraries for interfacing with common external devices.
The GPS module used in this project is SR-91 based GPS module which can communicate the data regarding the current location to a PC or microcontroller through the serial port.
The arduino board used in this project is the arduino pro-mini board and the IDE version of the arduino is 1.0.3 for windows.
Since the arduino pro-mini board has no circuitary for interfacing it with the serial port or the USB port of the PC, an external USB to TTL converter board is required to connect it with the PC. This hardware helps in programming the arduino board and also helps in the serial communication with the USB port of the PC.
It is assumed that the reader has gone through the project getting started with arduino and tried out all the things discussed there.
The Arduino read the serial data from the GPS module using the serial communication functions provided by the Arduino library. The functions like Serial.begin() which helps to initialize the serial port with a given baud rate, Serial.write() to send a data to the serial port, Serial.available() and Serial.read() functions to read data from the serial port are used in this project and they are already discussed in previous projects on on how to do serial communication with the Arduino, how to send and receive serial data using arduino and how to do serial debugging with the Arduino.
Using the function Serial.read() the Arduino continuously reads the data from the GPS module, looking for Latitude-Longitude details. The GPS send the data in standard NMEA format which consist of the real time data regarding the current position. The format includes so many sentences and among them one particular sentence referred to as “Global Positioning System Fix Data” is extracted to read the Latitude Longitude.
The screenshot of the “Global Positioning System Fix Data” among the NMEA format data output from the GPS module is shown in the following image;
Each sentence has a sentence identifier, actual data separated by commas and a check sum which has to be extracted to make it in readable format. The details of the sentence “Global Positioning System Fix Data” is given in the following table;
|Global Positioning System Fix Data|
|41d 24.8963′ N or 41d 24′ 54″ N|
|81d 51.6838′ W or 81d 51′ 41″ W|
– 0 = Invalid
– 1 = GPS fix
– 2 = DGPS fix
|Data is from a GPS fix|
|Number of Satellites|
|5 Satellites are in view|
|Horizontal Dilution of Precision (HDOP)|
|Relative accuracy of horizontal position|
|280.2 meters above mean sea level|
|Height of geoid above WGS84 ellipsoid|
|Time since last DGPS update|
|No last update|
|DGPS reference station id|
|No station id|
|Used by program to check for transmission errors|
To simply output the Latitude-Longitude coordinate using the Arduino, the code written for the project continuously reads the characters from the GPS module and check them for two consecutive ‘G’ s, so as to get the sentence starting with $GPGGA. Once the message is found the code seeks through the message, skipping the letters till the first two commas and printing the rest as the Latitude, till the following comma. The code again skips the characters till it found another comma and the following letters till the next comma are printed as Longitude.
For more detail: How to Interface GPS with Arduino
This Post / Project can also be found using search terms:
- interfacing ardiuno with gps module and ardiuno code pdf
- how to interface arduino to gps pdf download
- how to interface arduino with gps
- how to interface GPS with ardino