How to Use GPS with Arduino

ARDUINO

By Saddam

GPS Interfacing with Computer Using Arduino

GPS is a very useful device which is used in many electronics projects and applications like vehicle tracking system, GPS Clock, Accident Detection Alert System, traffic navigation and surveillance system etc. But question is how to use the GPS and read the data from GPS? We can easily get the GPS data directly into our computer using Arduino. 

GPS stands for Global Positioning System and used to detect the Latitude and Longitude of any location on the Earth, with exact UTC time (Universal Time Coordinated). This device receives the coordinates from the satellite for each and every second, with time and date. GPS offers great accuracy and also provides other data besides position coordinates, we will into look it shortly.

GPS module SKG13BL

In this arduino GPS tutorial, we are going to explain that how to Test or Interface GPS module using Computer and Arduino. For interfacing GSM with computer we either need USB to Serial Converter or Arduino Board. Here we are using Arduino board to interface GPS. We only need Arduino Board, GPS module, computer and 12v/3.3v adaptor for power supply. Here we have used GPS receiver Module SKG13BL (shown in above figure).

GPS-interfacing-arduino-computer

Before connecting it to the computer, we first need to remove the Arduino IC (Atmega chip) from the Arduino Board, as we only need the serial circuitry of the Arduino. This is called the Gateway mode. Removing the IC is shown in below figures:

GPS interfacing arduino
GPS interfacing arduino remove ic

Now do the connection like given in below picture:

  1. GPS TX pin to Digital PIN 1 of Arduino (TXD)
  2. GPS Ground Pin to GND PIN of Arduino
  3. GPS Power (3.3v) Pin to 3.3v PIN of Arduino
GPS Interfacing with Arduino Fritzing Diagram
Gps and arduino

After connections, connect the USB cable to the computer, open your Arduino IDE software in computer, select com port and open serial monitor to listen the serial port and Power up the Arduino and GPS module.

Now you will see GPS data on Arduino Serial Monitor Window like below. Below are two snapshots, first one is, when GPS is not in range and second one is, when GPS in range.

GPS Data When GPS Receiver is out of range:

GPS Data When GPS Receiver is in Range:

GPS interfacing arduino serial monitor window

In serial Window, you can see some sentences that start from $ sign. These are NMEA sentences. GPS module sends the Real time tracking position data in NMEA format (see the screenshot above). NMEA format consist several sentences, in which four important sentences are given below. More detail about the NMEA sentence and its data format can be found here.

  • $GPGGA: Global Positioning System Fix Data
  • $GPGSV: GPS satellites in view
  • $GPGSA: GPS DOP and active satellites
  • $GPRMC: Recommended minimum specific GPS/Transit data

These strings contain many GPS parameters like: Time, Date, Longitude, Latitude, speed, no. of satellites in used, altitude and many other things.

For any location coordinates and time, we can use $GPGGA and $GPRMC.

For Date and time we can use $GPRMC string.

When we use GPS module for tracking any location, we only need coordinates and we can find this in $GPGGA string. Only $GPGGA (Global Positioning System Fix Data) String is mostly used in programs and other strings are ignored. This string consist fix data as below:

$GPGGA,104534.000,7791.0381,N,06727.4434,E,1,08,0.9,510.4,M,43.9,M,,*47
$GPGGA,HHMMSS.SSS,latitude,N,longitude,E,FQ,NOS,HDP,altitude,M,height,M,,checksum data
IdentifierDescription
$GPGGAGlobal Positioning system fix data
HHMMSS.SSSTime in hour minute seconds and milliseconds format.
LatitudeLatitude (Coordinate)
NDirection N=North, S=South
LongitudeLongitude(Coordinate)
EDirection E= East, W=West
FQFix Quality Data
NOSNo. of Satellites being Used
HDPHorizontal Dilution of Precision
AltitudeAltitude (meters above from sea level)
MMeter
HeightHeight
ChecksumChecksum Data

And $GPRMC string mainly contains velocity, time, date and position

$GPRMC,123519.000,A, 7791.0381,N, 06727.4434,E,022.4,084.4,230394,003.1,W*6A
$GPRMC,HHMMSS.SSS,A,latitude,N,longitude,E,speed,angle,date,MV,W,CMD
IdentifierDescription
RMCRecommended Minimum sentence C
HHMMSS.SSSTime in hour minute seconds and milliseconds format.
AStatus // A=active and V= void
LatitudeLatitude 49 deg. 16.45 min. North
NDirection N=North, S=South
LongitudeLongitude(Coordinate)
EDirection E= East, W=West
Speedspeed in knots
AngleTracking angle in degrees
DateTime stamp (Date in UTC)
MVMagnetic Variation
WDirection of variation E/W
CMD (*6A)Checksum Data

Mostly this string is used for taking time, date and speed.

Deja un comentario