Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO GPS Tracker with NEO 6M Module

View and Edit Project In Cirkit DesignerImage of Arduino UNO GPS Tracker with NEO 6M Module

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfaced with a GPS NEO 6M module. The Arduino UNO provides power to the GPS module and communicates with it using serial communication. The purpose of this setup is to read GPS data and display the latitude and longitude coordinates via the Arduino's serial monitor.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. GPS NEO 6M

    • Description: A GPS module used for obtaining location data.
    • Pins: VCC, RX, TX, GND

Wiring Details

Arduino UNO

GPS NEO 6M

Code Documentation

#include <SoftwareSerial.h>
#include <TinyGPS++.h>

// GPS NEO 6M connections
#define GPS_RX 2
#define GPS_TX 3

SoftwareSerial gpsSerial(GPS_RX, GPS_TX);
TinyGPSPlus gps;

void setup() {
  Serial.begin(9600);  // Start serial communication for debugging
  gpsSerial.begin(9600);  // Start GPS communication

  Serial.println("GPS Test Started...");
}

void loop() {
  // Read data from GPS module
  while (gpsSerial.available()) {
    char c = gpsSerial.read();
    Serial.write(c);  // Print raw GPS data to Serial Monitor

    gps.encode(c);  // Feed data to the TinyGPS++ library

    // If a valid GPS fix is available, display the coordinates
    if (gps.location.isUpdated()) {
      displayGPSData();  // Display current GPS data (lat/lng)
    }
  }

  // Optional: Delay to avoid flooding the serial monitor with too many updates
  delay(1000);  
}

void displayGPSData() {
  // Only display if the GPS location is valid
  if (gps.location.isValid()) {
    float latitude = gps.location.lat();
    float longitude = gps.location.lng();
    Serial.print("Latitude: ");
    Serial.print(latitude, 6);  // Print latitude with 6 decimal places
    Serial.print(" Longitude: ");
    Serial.println(longitude, 6);  // Print longitude with 6 decimal places
  } else {
    Serial.println("GPS signal not available.");
  }
}

Code Explanation