Nicky Lai
Published

TailTag (A Pet Tracker)

A hefty device that track pets via satellite signals (Adafruit MiniGPS) and a MicroSD breakout board.

BeginnerShowcase (no instructions)31
TailTag (A Pet Tracker)

Things used in this project

Hardware components

Nano V3 (Type-C USB)
×1
Adafruit Mini GPS PA1010D
×1
Adafruit MicroSD Breakout Board+
×1
Inland Power Bank
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
**Aswell as a Thermal Wire Stripper
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Tracker Container

OnShape

Tracker Container Cap

Schematics

Circuit Diagram

Code

Code!

C/C++
#include <Adafruit_GPS.h>
#include <SPI.h>
#include <SD.h>

Adafruit_GPS GPS(&Wire); //this connects the gps to the i2c (a5 and a4)

int chipSelect = 4; //cs pin for microsd breakout

void setup() {
  Serial.begin(115200); //baud rate is 115200
  
  if(!GPS.begin(0x10)){
    Serial.println("GPS not found");
    while(1);
  }
  
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); //update rate is 1hz

  delay(1000);

  SD.begin(chipSelect);
}

void loop() {
  for (int i = 0; i < 1000; i++){
    GPS.read();
    if (GPS.newNMEAreceived()){ //checks if nmea sentnce is received
      GPS.parse(GPS.lastNMEA()); //doublechecks the data received 
  }
  delay(1);
  }

  if (GPS.fix){
    Serial.print("Location:  ");
    Serial.print(GPS.latitudeDegrees, 5);
    Serial.print(", ");
    Serial.println(GPS.longitudeDegrees, 5);
    Serial.print("Satellites: ");
    Serial.println((int)GPS.satellites);

    File myFile = SD.open("log.txt", FILE_WRITE);

    if(myFile) {
      myFile.print("Location:  ");
      myFile.print(GPS.latitudeDegrees, 5);
      myFile.print(", ");
      myFile.println(GPS.longitudeDegrees, 5);
      myFile.print("Satellites: ");
      myFile.println((int)GPS.satellites);
      myFile.close();
  }
  
  } else{
    Serial.println("Waiting for Fix...");
  }

  delay(1000);
}

Credits

Nicky Lai
1 project • 0 followers

Comments