What is GPS and how can you make your own GPS tracker?

  • Global Positioning System (GPS) is a satellite based system that uses satellites and ground stations to measure and compute its position on earth.
  • GPS receiver needs to receive data from at least four satellites for accuracy purpose. GPS receiver does not transmit any information to the satellites.
Image :- 01. GPS system

MAKING YOUR OWN GPS USING ARDUINO

All you need to make your own GPS tracker is an Arduino board and GPS
module (NEO 6m U Blox).

Image :- 02. Arduino

Connect the Rx pin of the GPS to the pin 11 of Arduino and Tx pin to the pin 10
of Arduino .Connect the Vcc to 5V of Arduino and GND to ground of Arduino.
Here’s a circuit diagram of GPS system given below :

Image :- 03. Circuit Diagram

Now burn the following code to the Arduino board and switch to the serial
monitor on the Arduino IDE to obtain the Latitude , Longitude andAltitude
along with Date and time(wait for some time for the GPS to fixate to it’s
satellites until it’s LED blinks at a definite rate).
Here’s a snip of the code given below :-

Arduino Code

include <TinyGPS++.h>
include <SoftwareSerial.h>
// Choose two Arduino pins to use for software serial
int RXPin = 10;
int TXPin = 11;
int GPSBaud = 9600;
// Create a TinyGPS++ object
TinyGPSPlus gps;
// Create a software serial port called “gpsSerial”
SoftwareSerial gpsSerial(RXPin, TXPin);

void setup()
{
// Start the Arduino hardware serial port at 9600 baud
Serial.begin(9600);
// Start the software serial port at the GPS’s default baud
gpsSerial.begin(GPSBaud);
}

void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (gpsSerial.available() > 0)
if (gps.encode(gpsSerial.read()))
displayInfo();
// If 5000 milliseconds pass and there are no characters coming in
// over the software serial port, show a “No GPS detected” error
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(“No GPS detected”);
while(true);
}
}

void displayInfo()
{
if (gps.location.isValid())
{
Serial.print(“Latitude: “);
Serial.println(gps.location.lat(), 6);
Serial.print(“Longitude: “);
Serial.println(gps.location.lng(), 6);
Serial.print(“Altitude: “);
Serial.println(gps.altitude.meters());
}
else
{
Serial.println(“Location: Not Available”);
}

Serial.print(“Date: “);
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(“/”);
Serial.print(gps.date.day());
Serial.print(“/”);
Serial.println(gps.date.year());
}
else
{
Serial.println(“Not Available”);
}
Serial.print(“Time: “);
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F(“0”));
Serial.print(gps.time.hour());
Serial.print(“:”);
if (gps.time.minute() < 10) Serial.print(F(“0”));
Serial.print(gps.time.minute());
Serial.print(“:”);
if (gps.time.second() < 10) Serial.print(F(“0”));
Serial.print(gps.time.second());
Serial.print(“.”);
if (gps.time.centisecond() < 10) Serial.print(F(“0”));
Serial.println(gps.time.centisecond());
}
else
{
Serial.println(“Not Available”);
}

Serial.println();
Serial.println();
delay(1000);
}

Leave a Reply

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