Electorials Electronics
Published © GPL3+

Project 012: Arduino Ublox Neo-7N GPS Module Project

An excellent project for location tracking involving a Ublox sensor and an Arduino, which can be used for many portable devices.

BeginnerProtip12 minutes9,682
Project 012: Arduino Ublox Neo-7N GPS Module Project

Things used in this project

Hardware components

u-blox Ublox NEO-7N GPS Module
×1
Arduino UNO
Arduino UNO
You could use any other Arduino board as well. The Seeeduino v4.2 is used in this example.
×1
Jumper wires (generic)
Jumper wires (generic)
4 Male to Female Jumper Wires.
×4
USB-A to B Cable
USB-A to B Cable
Depends on the Arduino.
×1
ICStation Female SMA Antenna
Optional if needed.
×1
NextPCB
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Schematics

Code

​Arduino Ublox Neo-7N GPS Module Project Code

C/C++
#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();
}

Credits

Electorials Electronics
85 projects • 66 followers
I'm an electronic hobbyist interested in anything, from Arduino to drones. I plan to educate people with the content on my website.
Contact

Comments

Please log in or sign up to comment.