Project tutorial
How to Interface GPS Module (NEO-6m) with Arduino

How to Interface GPS Module (NEO-6m) with Arduino © GPL3+

In this project, I have shown how to interface a GPS module with Arduino UNO. The data for longitude and latitude is displayed on the LCD.

  • 133,466 views
  • 131 comments
  • 58 respects

Components and supplies

About this project

1. Information about GPS

What is GPS

The Global Positioning System (GPS) is a satellite-based navigation system made up of at least 24 satellites. GPS works in any weather conditions, anywhere in the world, 24 hours a day, with no subscription fees or setup charges.

How GPS works

GPS satellites circle the Earth twice a day in a precise orbit. Each satellite transmits a unique signal and orbital parameters that allow GPS devices to decode and compute the precise location of the satellite. GPS receivers use this information and trilateration to calculate a user's exact location. Essentially, the GPS receiver measures the distance to each satellite by the amount of time it takes to receive a transmitted signal. With distance measurements from a few more satellites, the receiver can determine a user's position and display it.

To calculate your 2-D position (latitude and longitude) and track movement, a GPS receiver must be locked on to the signal of at least 3 satellites. With 4 or more satellites in view, the receiver can determine your 3-D position (latitude, longitude and altitude). Generally, a GPS receiver will track 8 or more satellites, but that depends on the time of day and where you are on the earth.

Once your position has been determined, the GPS unit can calculate other information, such as:

  • Speed
  • Bearing
  • Track
  • Trip dist
  • Distance to destination

What's the signal?

GPS satellites transmit at least 2 low-power radio signals. The signals travel by line of sight, meaning they will pass through clouds, glass and plastic but will not go through most solid objects, such as buildings and mountains. However, modern receivers are more sensitive and can usually track through houses.

A GPS signal contains 3 different types of information:

  • Pseudorandom code is an I.D. code that identifies which satellite is transmitting information. You can see which satellites you are getting signals from on your device's satellite page.
  • Ephemeris data is needed to determine a satellite's position and gives important information about the health of a satellite, current date and time.
  • Almanac data tells the GPS receiver where each GPS satellite should be at any time throughout the day and shows the orbital information for that satellite and every other satellite in the system.

2. Download and install required libraries for GPS to work in Arduino IDE

3. NEO-6M GPS module and Arduino UNO

4. Connection of Arduino UNO and GPS module

Connect the four pins from UBLOX to an Arduino as follows:

  • Ublox - Arduino
  • GND - GND
  • TX - Digital pin (D3)
  • RX - Digital pin (D4)
  • Vcc - 3.3 V

Here, I suggest you to use external power supply to power the GPS module because minimum power requirement for GPS module to work is 3.3 V and Arduino is not capable of providing that much voltage.

To provide voltage use prolific USB TTL.

One more thing I have found while working with GPS antenna comes with module is its not receiving signal inside the house so I used this antenna - it's much better.

For connecting this antenna, you have to use connector:

5. Connection of Arduino UNO and JHD162a LCD

LCD ======= Arduino

  • VSS ======= GND
  • VCC ======= 5V
  • VEE ======= 10K Resistor
  • RS ======= A0 (Analog pin)
  • R/W ======== GND
  • E ======== A1
  • D4 ======== A2
  • D5 ======== A3
  • D6 ======== A4
  • D7 ======== A5
  • LED+ ======= VCC
  • LED- ======= GND

Programming

Arduino IDE

#include <LiquidCrystal.h> 
#include <SoftwareSerial.h> 
#include <TinyGPS.h> 
float lat = 28.5458,lon = 77.1703; // create variable for latitude and longitude object  
SoftwareSerial gpsSerial(3,4);//rx,tx 
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5); 
TinyGPS gps; // create gps object 
void setup(){ 
Serial.begin(9600); // connect serial 
//Serial.println("The GPS Received Signal:"); 
gpsSerial.begin(9600); // connect gps sensor 
lcd.begin(16,2); 
} 
void loop(){ 
  while(gpsSerial.available()){ // check for gps data 
  if(gps.encode(gpsSerial.read()))// encode gps data 
  {  
  gps.f_get_position(&lat,&lon); // get latitude and longitude 
  // display position 
  lcd.clear(); 
  lcd.setCursor(1,0); 
  lcd.print("GPS Signal"); 
  //Serial.print("Position: "); 
  //Serial.print("Latitude:"); 
  //Serial.print(lat,6); 
  //Serial.print(";"); 
  //Serial.print("Longitude:"); 
  //Serial.println(lon,6);  
  lcd.setCursor(1,0); 
  lcd.print("LAT:"); 
  lcd.setCursor(5,0); 
  lcd.print(lat); 
  //Serial.print(lat); 
  //Serial.print(" "); 
  lcd.setCursor(0,1); 
  lcd.print(",LON:"); 
  lcd.setCursor(5,1); 
  lcd.print(lon); 
 } 
} 
String latitude = String(lat,6); 
  String longitude = String(lon,6); 
Serial.println(latitude+";"+longitude); 
delay(1000); 
} 

In Visual Studio, I have made an application in which current GPS location can be find.Its only work when it is connected serially with PC or laptop.

If you want to make some changes in application, you can do it by opening sln file in Visual Studio (2012 and above) or you can directly install setup and use it.

Result

If anyone wants the code for GSM as well, message me.

Code

Arduino codeArduino
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
//long   lat,lon; // create variable for latitude and longitude object
float lat = 28.5458,lon = 77.1703; // create variable for latitude and longitude object 
SoftwareSerial gpsSerial(3,4);//rx,tx
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
TinyGPS gps; // create gps object
void setup(){
Serial.begin(9600); // connect serial
//Serial.println("The GPS Received Signal:");
gpsSerial.begin(9600); // connect gps sensor
lcd.begin(16,2);
}
 
void loop(){
    while(gpsSerial.available()){ // check for gps data
    if(gps.encode(gpsSerial.read()))// encode gps data
    { 
    gps.f_get_position(&lat,&lon); // get latitude and longitude
    // display position
    lcd.clear();
    lcd.setCursor(1,0);
    lcd.print("GPS Signal");
    //Serial.print("Position: ");
    //Serial.print("Latitude:");
    //Serial.print(lat,6);
    //Serial.print(";");
    //Serial.print("Longitude:");
    //Serial.println(lon,6); 
    lcd.setCursor(1,0);
    lcd.print("LAT:");
    lcd.setCursor(5,0);
    lcd.print(lat);
    //Serial.print(lat);
    //Serial.print(" ");
    
    lcd.setCursor(0,1);
    lcd.print(",LON:");
    lcd.setCursor(5,1);
    lcd.print(lon);
    
   }
  }
  
  String latitude = String(lat,6);
    String longitude = String(lon,6);
  Serial.println(latitude+";"+longitude);
  delay(1000);
  
}

Schematics

Arduino_GPS
Uno gps 819chwdaoi
Arduino_GPS_GSM
Prefer to give 12 V supply to the GSM
Arduino gps gsm epvquaz4aw

Comments

Similar projects you might like

GPS Location Display With GPS And TFT Display Shields

Project tutorial by Boian Mitov

  • 10,185 views
  • 5 comments
  • 27 respects

u-blox LEA-6H 02 GPS Module with Arduino and Python

Project tutorial by Harshgosar

  • 1,792 views
  • 7 comments
  • 8 respects

LCD with DS3231 Real Time Clock Module

Project showcase by Tan See Youu

  • 39,445 views
  • 0 comments
  • 30 respects

GPS Datalogger, Spatial Analysis, and Azure IoT Hub.

Project tutorial by Shawn Cruise

  • 17,839 views
  • 4 comments
  • 66 respects

GPS Tracking Using Helium, Azure IoT Hub, and Power BI

Project tutorial by Team Helium

  • 11,749 views
  • 17 comments
  • 34 respects
Add projectSign up / Login