GPS receiver using arduino interface and working

This project describes the method to display the NMEA format GPS data on the PC monitor.

GPS module sim28ml

Here a SIMCom SIM28ML GPS Module is using to receive the GPS data. Using the module the received data can be displayed directly on any serial terminals. Hyper terminal, putty, Arduino serial monitor, etc. can be used to display the data.

To connect the module to the PC, it has to be interfaced via a USB port. The interface option available for the module would be either Rs232 or TTL or both. Use a suitable converter such as Rs232-USB or TTL-USB converter for connecting to the PC (How to use Arduino Uno as TTL to USB converter). The module can power with a 12V DC input through a DC jack socket. Also, a +5V  or +3.3V supply can use directly with the board.

gps interfacing with arduino uno arduino gps module interface

Select the port connection of the device, which has listed such as COM1, COM2…COMX. Set the baud rate exactly as specified for the GPS module. The baud rate may be different for various module devices. So, it should be ensured that both serial terminal and module has same baud rate. Commonly the module has a baud rate of 9600bps.

After the Power On, the module takes few minutes to receive the signal. After modem establishes a connection with the GPS, the TIMEMARK LED begins to blinks once in a second. Once the signal has received, the serial monitor display’s the GPS data in NMEA (National Marine Electronics Association standard) sentence. NMEA is a specification for communication between various marine electronic equipment.

GPS NMEA data format

nmea output text, gps nmea data

NMEA output sentence on Arduino serial monitor.

$GPRMC,062652.000,A,1005.2307,N,07626.0931,E,0.06,163.36,151216,,,A*60

$GPGGA,062653.000,1005.2304,N,07626.0930,E,1,4,5.63,24.3,M,-93.5,M,,*45

$GPGSA,A,3,21,24,32,20,,,,,,,,,5.70,5.63,0.93*0C

$GPGSV,3,1,09,21,68,066,44,32,60,271,33,18,35,016,19,39,30,261,24*76

$GPGSV,3,2,09,24,24,060,43,20,07,074,34,193,,,39,14,,,27*40

$GPGSV,3,3,09,25,,,33*77

hyperterminal gps dataNMEA format data on hyperterminal

A direct interface to the serial monitor gives the output data in a set of lines of information, including longitude, latitude, time, date, etc.

Considering the value of latitude and longitude only.

$GPRMC,062652.000,A,1005.2307,N,07626.0931,E,0.06,163.36,151216,,,A*60

     RMC        Recommended Minimum sentence

$GPGGA,062653.000,1005.2304,N,07626.0930,E,1,4,5.63,24.3,M,-93.5,M,,*45

     GGA         Global Positioning System Fix Data

1005.230, N  – Latitude is in DDMM.MMMMM format,  Latitude 10 deg 05.230’N

     07626.093, E  – Longitude is in DDDMM.MMMMM format, Longitude 76 deg 26.093′ E

N, E, W, S represents North, East, West and South respectively.

Get Your GPS Latitude and Longitude on screen

A direct interface to the serial monitor gives the output in the form of standard NMEA sentence, which includes many data as bulk content of lines. But, here we are extracting the Latitude and Longitude coordinate values from the NMEA standard sentence.  So, this program will be more useful for those who are looking to get only the latitude and longitude from the long NMEA text.

arduino gps latitude longitude

For the Arduino coding, we are using a library function called TinyGPS. In the code, the variable “slat” and “slon” hold the coordinate values of the latitude and longitude respectively. The GPS module is interfaced with Arduino using software serial; pin 5 is defined as Receiver (RX) and pin6 as Transmitter (TX).

GPS Interfacing with Arduino Uno

Arduino pin GPS Module pin
TX (pin 6) RX
Rx (pin 5) TX
GND GND

Arduino GPS module code

#include <SoftwareSerial.h>
#include <TinyGPS.h>

TinyGPS gps;
SoftwareSerial sgps(5, 6);

void setup()
{
  Serial.begin(9600);
  sgps.begin(9600);
}

void loop()
{
  while (sgps.available())
  {
    int c = sgps.read();
    if (gps.encode(c))
    {
float slat,slon;
      gps.f_get_position(&slat, &slon);
      Serial.print("Latitude :");
      Serial.println(slat, 6);
      Serial.print("Longitude:");
      Serial.println(slon, 6);
    }
  }
}
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

19 Responses

  1. Anand Yadav says:

    Could you please put a working circuit diagram of the above connection. I am same GPS receiver that is SIM28ML, and arduino board. I am not getting any value in serial monitor.
    I need help!! Please . Or can you suggest me where should I look for?

    • admin says:

      The interface of sim28ml with arduino is just a TTL interface.
      Rx->Txpin6
      Tx->Rxpin5
      3.3v->3.3v
      GND->GND

      First of all make sure that your gps module is receiving data(green TMRK led flashes when GPS is fixed). Try directly to a hyper terminal or serial monitor, and check whether the module is receiving NMEA sentence data. While using with arduino, make sure that your arduino IDE has a gpstiny library function.

  2. Nagamallasaiteja says:

    Bro same problem that I received that the gps doest works after twrk blinks

    • admin says:

      If the TIMEMARK LED blinks every second, it means the GPS is receiving the signal. So, you should check the communication between the GPS and the Arduino or Hyperterminal.

  3. aajkiya mukesh says:

    i work GPS program run success but location is not found so plzzz help me

  4. Pramod says:

    tmrk isnt blinkig at all , need help.

    • admin says:

      Timemark LED takes some time to start blinking. In indoors or under any roofing it doesn’t work fine. So try placing the antenna at different locations, mainly at outdoors and Wait for at least 3 or 5 minutes at each spot.

  5. Ankit tripathi says:

    Thanks it works perfect! But I want latitude and longitude to be shown once on Serial Monitor… tell.me the changes on code

    • admin says:

      Replace the code inside the void loop with below code. Also intialize the int “value” at the begining as ‘0’. Here once the gps is availabe the variable “value” set to ‘1’ and afterwards the if condition always returns false, hence the latitude and longitude can print only once.

      if (sgps.available() && value == 0 )
      {
        value = 1;
        int c = sgps.read();
        if (gps.encode(c))
        {
          float slat, slon;
          gps.f_get_position(&slat, &slon);
          Serial.print("Latitude :");
          Serial.println(slat, 6);
          Serial.print("Longitude:");
          Serial.println(slon, 6);
        }
      }
      
      • Nsaiteja says:

        Sir I need to store the GPS latitude and longitude to a variable how can I do this by changing the code

        • admin says:

          “slat” & “slon” itself a float variable stores the latitude and longitude values respectively. Just use those variables or pass the values to another variables.

  6. Akanksha Singh says:

    why have you taken 6 for both the slat n slon? what does it mean?

    • admin says:

      It is the number of decimal places to use. That is the number of digits to be displayed after the decimal point; here it is 6 digits.

  7. Sarthak Tanwani says:

    Hello Sir, Thanks for the tutorial

    However in my case the GPS module is not transmitting any value.
    The TMRK LED is blinking correctly at 1 Hz. But when I upload code and use it withe my arduino mega, I get nothing on my serial monitor.
    Could you help?
    Thanks

    • admin says:

      Did you try connecting directly to the serial monitor, HyperTerminal, putty, etc (via TTL to USB or RS232 to USB)? Can you able to receive the data as NMEA Text?

  8. velraj says:

    how to connect 16*2 lcd display with this circuit

Leave a Reply

Your email address will not be published. Required fields are marked *