How to Use GPS with Arduino

Arduino

BySaddam 36

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

Identifier

Description

$GPGGA

Global Positioning system fix data

HHMMSS.SSS

Time in hour minute seconds and milliseconds format.

Latitude

Latitude (Coordinate)

N

Direction N=North, S=South

Longitude

Longitude(Coordinate)

E

Direction E= East, W=West

FQ

Fix Quality Data

NOS

No. of Satellites being Used

HDP

Horizontal Dilution of Precision

Altitude

Altitude (meters above from sea level)

M

Meter

Height

Height

Checksum

Checksum 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

Identifier

Description

RMC

Recommended Minimum sentence C

HHMMSS.SSS

Time in hour minute seconds and milliseconds format.

A

Status // A=active and V= void

Latitude

Latitude 49 deg. 16.45 min. North

N

Direction N=North, S=South

Longitude

Longitude(Coordinate)

E

Direction E= East, W=West

Speed

speed in knots

Angle

Tracking angle in degrees

Date

Time stamp (Date in UTC)

MV

Magnetic Variation

W

Direction of variation E/W

CMD (*6A)

Checksum Data

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

Video

Comments

  • Akash Singh's picture
    Akash Singh
    Apr 13, 2016

    In place of removing the IC on arduino, we can upload a blank program i.e. with a blank setup() and blank loop()....

  • saddam khan's picture
    saddam khan
    Apr 21, 2016

    Very good..

    yes you can upload a blank program or led blinking program.

  • Sundari Ravi 's picture
    Sundari Ravi
    Jun 27, 2016

    Thank you for uploading this vedio. I have done this, now i want to extract only gprmc code and with 5 minutes interval.
    Please help me to finish my project.

  • RAJESH KUMAR's picture
    RAJESH KUMAR
    Jun 29, 2016

    why we are removing ic before connections

  • Abhishek's picture
    Abhishek
    Jul 09, 2016

    Its already mentioned that we only need the serial circuitry of the Arduino. This is called the Gateway mode.

  • indra's picture
    indra
    Mar 05, 2017

    what will happen if u dont remove the IC?

  • Selvakumar's picture
    Selvakumar
    Jul 16, 2016

    I done the same connection as you did and open the arduino IDE and serial monitor but i didn't get any data like your output.But i get some garbage output .Now what i do??? Help me as soon as possible

  • Abhishek's picture
    Abhishek
    Aug 13, 2016

    Follow the complete procedure carefully.

  • Jagrutkumar's picture
    Jagrutkumar
    Feb 07, 2018

    hello selvakumar, please check the baud rate in the code and set the same baud rate in arduino serial monitor.

  • Brana's picture
    Brana
    Aug 14, 2016

    Hi, I am doing my final year project "Real Time Arduino Vehicle Tracker",
    1. Why didn't you install a GPS Shield instead of a GPS Receiver?
    2. What are the difference between these two components?
    3. Do we really need an internal + an external GPS antennas if we use a GPS shield?
    4. Did you insert a SIM CARD to your GPS Receiver?

    Your help would be greatly appreciated. :)

  • Abhishek's picture
    Abhishek
    Aug 22, 2016

    Answer to your questions:
    1. You can use GPS shield with Arduino, it will be better.
    2. GPS shield is specifically for Arduino and can be fit on it easily whereas GPS receiver can be used with any microcontroller.
    3. Antenna will depend upon your GPS module, some module have it and some dont.
    4. No, SIM isn't inserted in GPS module.

  • ganapathi's picture
    ganapathi
    Aug 24, 2016

    in the serial monitor i can see that gps is sending the nmea formatted string with out lat and long values
    and even the status led of gps is not blinking

  • ajaykumar's picture
    ajaykumar
    Sep 21, 2016

    in the serial monitor the gps gives the nmea format but doesnt show any latitudes or longitudes , but i get result like, when the gps is not in range.what can i do now to get my gps receiver to a range.
    thank you

  • Maddy's picture
    Maddy
    Oct 07, 2016

    @ganapathi and @Ajay: If you are getting NMEA string without Long and Lat, that means your GPS module is not in range. Try placing the antenna in open sky and also provide proper power supply to it, it has two options for power supply 3v or 12v, set it correctly.

  • kashif's picture
    kashif
    Apr 19, 2017

    i have the same problem...then i privide external power to gps like rechargable battery...then my gps start giving me lat lng....it seems that arduino is not giving enough power to gps to operate properly>>>

  • sirt1013's picture
    sirt1013
    Oct 06, 2016

    How to get GPS longitudes and latitudes as variable from arduino kit, further i can use this variable in other purpopse.

    your help would be greatly appreciate!

  • Sohaib's picture
    Sohaib
    Oct 27, 2016

    I want to interface two gps if one fails another ll take over at the same time ...can I do this with ardeno

  • SivaKumar.S's picture
    SivaKumar.S
    Oct 27, 2016

    how to choose gps module for our preferred arduino?

  • SivaKumar.S's picture
    SivaKumar.S
    Oct 27, 2016

    shall we use any arduino model with any gps?/

  • Maddy's picture
    Maddy
    Oct 27, 2016

    Yes, but you should check datasheet of GPS before connections.

  • Ashish's picture
    Ashish
    Dec 22, 2016

    my project is " Smart helmate and accident detection''. In that first i detect accident happened or not, if yes then send location to nearest hospital and any one of his/her friend or family. The problem is I don't know how to do. i'm getting continuous data in serial monitor, i need specific coordinates of location and to send that msg to hospital and friend im using gsm kit with arduino. Please if u help me in this it will be great to me.

  • bdv prasad's picture
    bdv prasad
    Jan 08, 2017

    Hai Sir,
    Actually i have to receive the date from gps receiver by providing power supply to gps of 3.3v. How can i get that data as wireless?
    I hope i will get an answer.

  • rakshith's picture
    rakshith
    Jan 28, 2017

    In the serial monitor, I'm getting a single line output which consists of one NMEA string. How do i get multiple NMEA strings as shown in the video?

  • soumya ranjan's picture
    soumya ranjan
    Mar 07, 2017

    Can you please provide me the code for skytra gps along with the connection? I am unable to get the output.
    model no is S1216R8

  • Juleshwar's picture
    Juleshwar
    Mar 17, 2017

    Whatever I do the GPS data seems to be always out of range :(

  • Aditi jain's picture
    Aditi jain
    Jun 13, 2017

    My gps receiver sim28m is always out of range. How to bring it into range?

  • ariane's picture
    ariane
    Jul 08, 2017

    How can I display only the longitude and latitude data? I only need the two and Im using sim808 gprs/gsm+gps shield v1.1.
    Thank you in advance.

  • ANup's picture
    ANup
    Jul 28, 2017

    Can u give the Code for this project?

  • ramesh's picture
    ramesh
    Aug 10, 2017

    hello sir., i want to connect gps module connect with arduino . so i need coding sir position a&b

  • subbu's picture
    subbu
    Sep 06, 2017

    sir i used the gps28ml module and i connected it as per your connections but i didn't get any values on my serial monitor.is there any process to test my gps28ml module?
    how much voltage i should give to my gps28ml ? i directly connected 5v from my Arduino.is there any problem?

  • Pranav's picture
    Pranav
    Nov 29, 2017

    I had seen a project 'arduino based automatic vehicle accident detection and reporting system using GSM and GPS. Thatswhy i choose this project as my final year project and i assembled it with the preferred components. But now i cant access the latitude and longitudinal values from the gps module , the execution of the program still remains by showing "getting gps data please wait" . Can u pls help me as possible as earlier. ...

  • Col. Raj Kumar's picture
    Col. Raj Kumar
    Dec 19, 2017

    Abhishek please connect with me. I have a project for you.

  • Abirami's picture
    Abirami
    Feb 18, 2018

    I am. Doing my final year project but I am not getting anything on serial monitor so I need help sir pls help me

  • Jawahar Austin's picture
    Jawahar Austin
    Mar 17, 2018

    i couldn't find the code for gps module to receive latitude and longitude. can anyone send it to me?

  • ramchandra's picture
    ramchandra
    Mar 26, 2018

    where is the code for this

  • Amol chavhan's picture
    Amol chavhan
    May 24, 2018

    Sir.
    I have a question.
    By using which command we get value of location.(long.lati)

Leave a Comment