Arduino Projects

Arduino Neo 6m GPS module Interfacing, Programming, Library

Neo 6m GPS Description:

 

Neo 6m GPS Module is one of the most frequently used GPS modules throughout the world. The Neo-6m GPS module is used for Location Tracking. I have been using the Ublox Neo 6m GPS module in different types of advanced level projects, which you can check out by clicking on the links given below.

Due to a lot of requests from my Subscribers and Followers, I decided to make a very basic tutorial on the Ublox Neo GPS Module explaining each and every detail.


In this tutorial, you will learn how to use the Ublox Neo-6m GPS Module with Arduino and find the Longitude and Latitude values along with the Speed and date-time information. In this

Neo 6m GPS

Tutorial, I have tried to cover the maximum things so that you don’t need to search for any other Article. In this article, I will also explain under what circumstances you don’t get the Longitude and Latitude Values? This is a very common problem which I will discuss in this Tutorial.

The library used in this project is developed by Mikal Hart.

In this tutorial, we will cover

  • Neo 6m GPS Module Pinout
  • soldering
  • Neo-6m GPS Module features
  • Neo-6m GPS Module interfacing with Arduino Uno
  • Neo-6m GPS Module programming and finally
  • Testing



Amazon Links:

Arduino Uno

Arduino Nano

Mega 2560:

NEO 6M GPS module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


What is GPS?

GPS or Global Positioning System is a satellite navigation system that furnishes location and time information in all climate conditions to the user. GPS is used for navigation in planes, ships, cars, and so on. GPS provides continuous real-time, 3-dimensional positioning, navigation, and timing worldwide. The GPS is used to finding the Longitude and Latitude values.

How GPS Determines a Position:

Neo 6m GPS

The working/operation of the Global positioning system is based on the ‘trilateration’ mathematical principle. The position is determined from the distance measurements to satellites. From the figure, the four satellites are used to determine the position of the receiver on the earth. The target location is confirmed by the 4th satellite. And three satellites are used to trace the location place. A fourth satellite is used to confirm the target location of each of those space vehicles. The global positioning system consists of a satellite control station, and a monitor station and receiver. The GPS receiver takes the information from the satellite and uses the method of triangulation to determine a user’s exact position.


About the Neo-6m GPS Module:

Neo 6m GPS

This is the Ublox Neo 6M GPS module that I am going to use in this Tutorial.


Neo 6m GPS

This GPS module can be interfaced with the Arduino using VCC, RX, TX, and GDND. In order to interface this module with Arduino, we will need to solder 4 wires. Usually, the Ublox NEO GPS modules come with the male headers, and using Male to Female type jumper wires this module can be easily interfaced with the Arduino. But if this GPS module does not have any Male headers then you can solder 4 wires.



Neo 6m GPS

For the easy Soldering, first of all, apply solder to all the wires that you want to solder with the GPS module, it will save a lot of time. So after applying solder to the 4 wires then I started attaching the wires with the VCC, RX, TX, and Ground.

Neo 6m GPS

After I was done with the Soldering then I started checking the short circuit using a Digital Multimeter. To avoid any damage always check the short circuit before you power up any circuit. To check the short circuit set the multimeter on the Beep or continuity.


Neo 6m GPS

As you can see there is a short circuit. You can practically see how beneficial this can be. So always check the short circuit and continuity before powering up the circuit.

Neo 6m GPS

I removed the solder bridge and I tested again the short circuit and this time everything was just fine. Now this GPS module is ready and can be interfaced with the Arduino Uno or Mega.


Neo 6M GPS Module Features as per the Datasheet:

Neo 6m GPS

This GPS module can be powered up using 3 to 5v. I will be using 5v. Its default baud rate is 9600 which we will be using in the programming.

Neo 6m GPS

Dimensions help in calculating the size of the final product. We can use this information to make a plastic enclosure in SolidWorks or any other software.



Neo GPS Arduino wiring:

Neo 6m GPS

The Neo-6M GPS module interfacing with Arduino is very simple. The VCC of the GPD module is connected with 5v, RX will be connected with pin3 of the Arduino, TX will be connected with pin2 of the Arduino and Ground will be connected with the Arduino’s GND.

Neo 6m GPS

I followed the same exact connections and now this GPS module is ready for the programming.
Before you start the Programming, first of all, make sure that you download the TinyGPSPlus library. While you don’t need to download the SoftwareSerial library, this is already available in the Arduino IDE, all you need is only include this in the programming.


Download TinyGPS: TinyGPSPlus

Neo 6m GPS Arduino Programming:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
/*
   This sample sketch demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

// connect tx pin of the gps module with rx pin of arduino
// connect rx pin of the gps module with tx pin of the arduino
// vcc with 5v 
// gnd with ground of arduino


static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("DeviceExample.ino"));
  Serial.println(F("A simple demonstration of TinyGPS++ with an attached GPS module"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
}

void loop()
{
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0)
    if (gps.encode(ss.read()))
      displayInfo();

  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
    while(true);
  }
}

void displayInfo()
{
  Serial.print(F("Location: ")); 
  if (gps.location.isValid())
  {
    Serial.print(gps.location.lat(), 6);
    Serial.print(F(","));
    Serial.print(gps.location.lng(), 6);
    Serial.print(" ");
    Serial.print(F("Speed:"));
    Serial.print(gps.speed.kmph());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F("  Date/Time: "));
  if (gps.date.isValid())
  {
    Serial.print(gps.date.month());
    Serial.print(F("/"));
    Serial.print(gps.date.day());
    Serial.print(F("/"));
    Serial.print(gps.date.year());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.print(F(" "));
  if (gps.time.isValid())
  {
    if (gps.time.hour() < 10) Serial.print(F("0"));
    Serial.print(gps.time.hour());
    Serial.print(F(":"));
    if (gps.time.minute() < 10) Serial.print(F("0"));
    Serial.print(gps.time.minute());
    Serial.print(F(":"));
    if (gps.time.second() < 10) Serial.print(F("0"));
    Serial.print(gps.time.second());
    Serial.print(F("."));
    if (gps.time.centisecond() < 10) Serial.print(F("0"));
    Serial.print(gps.time.centisecond());
  }
  else
  {
    Serial.print(F("INVALID"));
  }

  Serial.println();
}

/*
Commands that we can try also
Serial.println(gps.location.lat()); // Latitude in degrees (double) 
Serial.println(gps.location.lng()); // Longitude in degrees (double) 
Serial.print(gps.location.rawLat().negative ? "-" : "+"); 
Serial.println(gps.location.rawLat().deg); // Raw latitude in whole degrees 
Serial.println(gps.location.rawLat().billionths);// ... and billionths (u16/u32) 
Serial.print(gps.location.rawLng().negative ? "-" : "+"); 
Serial.println(gps.location.rawLng().deg); // Raw longitude in whole degrees 
Serial.println(gps.location.rawLng().billionths);// ... and billionths (u16/u32) 
Serial.println(gps.date.value()); // Raw date in DDMMYY format (u32) S
erial.println(gps.date.year()); // Year (2000+) (u16) 
Serial.println(gps.date.month()); // Month (1-12) (u8) 
Serial.println(gps.date.day()); // Day (1-31) (u8) 
Serial.println(gps.time.value()); // Raw time in HHMMSSCC format (u32) 
Serial.println(gps.time.hour()); // Hour (0-23) (u8) 
Serial.println(gps.time.minute()); // Minute (0-59) (u8) 
Serial.println(gps.time.second()); // Second (0-59) (u8) 
Serial.println(gps.time.centisecond()); // 100ths of a second (0-99) (u8) 
Serial.println(gps.speed.value()); // Raw speed in 100ths of a knot (i32) 
Serial.println(gps.speed.knots()); // Speed in knots (double) 
Serial.println(gps.speed.mph()); // Speed in miles per hour (double) 
Serial.println(gps.speed.mps()); // Speed in meters per second (double) 
Serial.println(gps.speed.kmph()); // Speed in kilometers per hour (double) 
Serial.println(gps.course.value()); // Raw course in 100ths of a degree (i32) 
Serial.println(gps.course.deg()); // Course in degrees (double) 
Serial.println(gps.altitude.value()); // Raw altitude in centimeters (i32) 
Serial.println(gps.altitude.meters()); // Altitude in meters (double) 
Serial.println(gps.altitude.miles()); // Altitude in miles (double) 
Serial.println(gps.altitude.kilometers()); // Altitude in kilometers (double)
Serial.println(gps.altitude.feet()); // Altitude in feet (double) 
Serial.println(gps.satellites.value()); // Number of satellites in use (u32) 
Serial.println(gps.hdop.value()); // Horizontal Dim. of Precision (100ths-i32)
Chat Conversation End
*/

For the complete program explanation and Practical testing, you can watch a video tutorial given at the end.

Neo 6m GPS module connection Problem and how to fix it:

There are situations when you don’t get the longitude and latitude values, the same thing has happened to me and maybe you will also face the same problem. If you are using the same program and connections and still unable to receive the longitude and latitude values then I am sure you might be inside a Building or in the Basement.


To solve this problem, don’t use this GPS module in the Basement or in a building, because this way the GPS module will take a lot of time in connecting with the Satellites or it will never connect. So try to use this in an open space. I am telling you this from my personal experience as I have been using this GPS module for years.

Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

Leave a Reply

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

Back to top button