Sponsor Link:

UTSource.net Reviews

It is a trustworthy website for ordering electronic components with cheap price and excellent quality.

Mounting the circuit

Since this project doesn't require a breadboard at all, it makes your life even easier with only 4 jumper wires required. Before making a start, make sure your Arduino board or Ublox Neo-7N GPS module isn't externally powered or connected to power in any way, just to prevent safety hazards from occurring. Now, let's move on to the actual wiring of the modules. First, use one jumper wire to connect the VCC pin (+) on your GPS module to the 5v pin (+5 volts) on your Arduino board. Then, use another jumper wire to connect the GND pin (-) on your Ublox module to any of your Arduino's GND pins (-). After that, hook up the TXD pin (Data Transit) pin of your GPS module to D3 (digital pin 3) of your Arduino for data transmitting. Along with that pin, you will have to hook up the RXD pin (Data Receive) on your GPS module to D4 (digital pin 4) on your Arduino board for receiving data. Now, this wraps up all of the hardware setup to this project.

Arduino Ublox Neo-7N GPS Module Project Code

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);
  Serial.println(F("Ublox Neo-7N GPS Module Test"));
}

void loop()
{
  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);
  }
  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();
}

About the code

Utilising one main library, the TinyGPS++ library by Mikal Hart, it helps us massively in using this Ublox GPS module with Arduino. In the first two lines of this sketch, we declare two main libraries for this program to work. Then, we declare the transmit and receive pins which we have hooked up from the GPS module to the Arduino and we also declare the frequency in which the GPS-satellite communication will take place at. Next, on the fourth line, an instance is made, to set up the TinyGPS++ library and state that this library is being utilised. The follow line is an instance for the communication pins (TXD & RXD), which states that we will be using those pins. Now, we move on to the void setup part of this sketch, starting with declaring the baud rate for receiving the data to the computer, it is now set to 115200 bauds but it is changeable to your preference. Right after that line, we start up the GPS module communication. Plus, at the end of the setup section, a message is written to the serial monitor, making sure everything is also ready. Moving on, the void loop section is now present, where while and if functions exists. The first three lines of this section basically means: while this program is running and...

Read more »