Interfacing GPS module with Arduino: GPS coordinates on Lcd (original) (raw)

Interfacing GPS module with Arduino: Today’s tutorial is about the interfacing of GPS module with Arduino. We will learn what is GPS module? How it is used? How it is interfaced with Arduino to locate position? Today’s tutorial will comprise of following section:

Introduction to GPS:

The Global Positioning System (GPS) is a satellite-based navigation system that consists of 24 orbiting satellites, each of which makes two circuits around the Earth every 24 hours. These satellites transmit three bits of information – the satellite’s number, its position in space, and the time the information is sent. These signals are picked up by the GPS receiver, which uses this information to calculate the distance between it and the GPS satellites. With signals from three or more satellites, a GPS receiver can triangulate its location on the ground (i.e., longitude and latitude) from the known position of the satellites. With four or more satellites, a GPS receiver can determine a 3D position (i.e., latitude, longitude, and elevation). In addition, a GPS receiver can provide data on your speed and direction of travel. Anyone with a GPS receiver can access the system. Because GPS provides real-time, three-dimensional positioning, navigation, and timing 24 hours a day, 7 days a week, all over the world, it is used in numerous applications, including GIS data collection, surveying, and mapping.

Let’s assume that the receiver determines that it is 20,000km from a particular satellite. This means that the receiver could be anywhere on an imaginary sphere with the satellite as its center. If it also determines that it is 25,000km from a second satellite this narrows its location down even further. The only location in space where it can be both 20,000km from the first satellite and 25,000km from the second is where these two spheres intersect. That intersection is a circle of points. A third measurement adds another sphere which intersects the circle formed by the first two. This intersection occurs at two points, and so, with these three measurements, the GPS receiver has narrowed down its location to just two points in the entire universe.

A fourth measurement will intersect exactly with one of the two points. In practice, however, you may not need this fourth measurement as one of the two points will normally be located thousands of kilometers out into space, and therefore is unlikely to be your position! However a fourth measurement is used to calculate altitude. It also ensures that the receiver’s clock is truly synchronized with universal time.

Although this example demonstrates the use of four satellites, many receivers are capable of tracking more than four satellites at a time. In some cases this improves the positional accuracy of the receiver.

Components Required

Following is the list of components required for this project.

Pin out of GPS module

GPS module has 4 pins provided out of module for connections.

  1. Tx Data Transmitting Pin
  2. Rx Data Receiving Pin
  3. Vcc 5V power Supply
  4. GND Power supply ground

Key Features:

GPS module interfacing with Arduino

Connect the circuit as follows

These are the connection which will be used in program. For rest of the LCD connection see tutorial on LCD interfacing with Arduino.

Note:

The problem with this connection is that, while programming Arduino uses serial ports to load program from the Arduino IDE. If these pins are used in wiring, the program will not be loaded successfully to Arduino. So you have to disconnect wiring in Rx and Tx each time you burn the program to Arduino. Once the program is loaded successfully, you can reconnect these pins and have the system working.

Video Interfacing GPS module with Arduino

Arduino Code of Interfacing GPS module with Arduino

// Creating a Simple GPS Receiver

#include <TinyGPS.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd( 4, 5, 6, 7, 8, 9 );

// Create an instance of the TinyGPS object

TinyGPS gps;

void getgps(TinyGPS &gps);

void setup()

{

Serial.begin(4800);

lcd.begin(16, 2);

}

void getgps(TinyGPS &gps)

// The getgps function will display the required data on the LCD

{

float latitude, longitude;

//decode and display position data

gps.f_get_position(&latitude, &longitude);

lcd.setCursor(0,0);

lcd.print("Lat:");

lcd.print(latitude,5);

lcd.print(" ");

lcd.setCursor(0,1);

lcd.print("Long:");

lcd.print(longitude,5);

lcd.print(" ");

delay(3000); // wait for 3 seconds

lcd.clear();

}

void loop()

{

byte a;

if ( Serial.available() > 0 ) // if there is data coming into the serial line

{

a = Serial.read(); // get the byte of data

if(gps.encode(a)) // if there is valid GPS data...

{

getgps(gps); // grab the data and display it on the LCD

}

}

}

Result:

While programming Arduino uses serial ports to load program from the Arduino IDE. If these pins are used in wiring, the program will not be loaded successfully to Arduino. So you have to disconnect wiring in Rx and Tx each time you burn the program to Arduino. Once the program is loaded successfully, you can reconnect these pins and have the system working.

After successfully uploading the program the LCD shows the longitude and latitude of your current position. Write these positions in Google map search bar such that first is latitude and second is longitude separated by a comma and space. Now Google map will display your current position

Applications:

Arduino Components Amazon Links
Arduino Starter Kit Buy Now
Arduino Development Kit Buy Now
Arduino Smart Robot Car Kit V4 Buy Now
Arduino Sensors Kit Buy Now