Arduino Cat Tracker

August 18, 2017


In the past I have played around with Raspberry Pi and some of the modules, so I knew there existed mini processors were you can build projects around.
This little project started when my cat regularly went away for a few days.
I wanted to know where she had bin all those nights.
Off-course the Pi is to large for this project and turned to Google for smaller processors and modules. I then came across Arduino and TinyDuino boards.
This was what I was looking for. After some more research I found someone had build the thing I wanted, The CAT Tracker.
I’m writing my own version because the tutorial on the original page is not that clear to me.
The Project begins.


What this will do:

When all is finished, this Cat Tracker stores GPS data on a micro SD card. Afterwards you can download this data and view at it in Google Earth.
This will NOT live stream the GPS data. There fore you need to add, or replace the Micro SD module with a SMS module.


Things you will need:

1x TinyDuino Processor
1x Tinyshield GPS module
1x Tinyshield usb module
1x Tinyshield micro sd module
1x Micro sd
1x Lithium battery
1x USB Lilon/LiPoly Charger


Lets prepare the stuff:

First we need to solder a battery connector to the processor. if you buy the lithium battery, the connectors are included.
Very important is to solder the black wire to the Grnd and the red to the positive. “Update:” I see the processors are a bit different now. The connector is now on the processor so you don’t have to solder anything on it. For reference here an older and a newer picture.

When this is done we can start stacking all the components.
First the processor on top of that you mount the micro SD module (with the micro SD inserted), and on top of that the GPS module.
The USB module is just for configuring the processor. So when we want to upload our code we must mount this on top of the GPS unit.

As a final preparation we have to charge our battery with the battery charger. Just connect the USB port to your computer, and the battery to the charger module.


Prepare the Code Lab:

Preparing the code environment and setting the correct settings was the most difficult and time consuming of this whole project.
That’s why I’m going to write a detailed description how you set up your lab and witch settings to be used for these boards.

Get the latest Arduino IDE from the site, and install it. Just click Next until it is installed. It will also install some USB drivers for connecting to the processor boards.
When finished, open the Arduino IDE. You can see under “File > Examples” there are allot of example code that can be used.
If you finished your code (described below) you can upload it to the processor. important to know: You can select the board under “Tools > Board”. Here you select the “Arduino Pro or Pro Mini” the first time I uploaded my code I got all wrong data. This was because I selected the wrong board. After some reading and searching I finally fount the correct settings and got correct readings.


The Master Code:

Here some code that logs the GPS data to the SD card. Modify as you like, or if you have some tips to improve it just let me know. Original from another site.


// The Arduino pins used by the GPS module
static const int GPS_ONOFFPin = A3;
static const int GPS_SYSONPin = A2;
static const int GPS_RXPin = A1;
static const int GPS_TXPin = A0;
static const int GPSBaud = 9600;
static const int chipSelect = 10;

// The GPS connection is attached with a software serial port
SoftwareSerial Gps_serial(GPS_RXPin, GPS_TXPin);

void setup()
  // Init the GPS Module to wake mode
  pinMode(GPS_SYSONPin, INPUT);
  pinMode(GPS_ONOFFPin, OUTPUT);
  digitalWrite( GPS_ONOFFPin, LOW );   
  if( digitalRead( GPS_SYSONPin ) == LOW )
     // Need to wake the module
    digitalWrite( GPS_ONOFFPin, HIGH ); 
    digitalWrite( GPS_ONOFFPin, LOW );      
  Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(10, OUTPUT);
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
  Serial.println("card initialized.");   

int inByte = 0;         // incoming serial byte
byte pbyGpsBuffer[100];
int byBufferIndex = 0;

void loop()
  byte byDataByte;
  if (Gps_serial.available())
     byDataByte =;
     pbyGpsBuffer[ byBufferIndex++ ] = byDataByte;
     if( byBufferIndex >= 100 )
       byBufferIndex = 0;       
       File dataFile ="gps.txt", FILE_WRITE);
       // if the file is available, write to it:
       if (dataFile) {
        dataFile.write(pbyGpsBuffer, 100);
      // if the file isn't open, pop up an error:
      else {
        Serial.println("error opening gps.txt");


Uploading the code:

Open your IDE and create a new sketch.
go to:
“Tools > Board” and set it to “Arduino Pro or Pro Mini”
“Tools > Processor” and set it to “ATmega328 (3.3V, 8 Mhz)”
“Tools > COM” Select your COM port

Connect the processor to the USB, paste the above code, and set the COM port correct.
Now we have the code in a new sketch window, we save it for later use. Then we click on the compile icon at the top (its a “V”).
If everything is fine we can upload the code to the processor (the > next to the compile icon).

Now the code should be uploaded and running on the processor.


Viewing the Data:

If all goes well, there should be a file on the SD names gps.txt.
Disconnect the USB, and copy the file from the USB to your local computer. You can eject the Micro SD and put it in a Micro SD reader from your computer/Laptop.
If you rename the file to gps.nmea you can read it with Google Earth. So rename the file and open Google Earth.
Go to “Tools > GPS” click “import” and select your file. If it contains GPS data, it will load all the tracks.
You have now the path your GPS has travelled.
If the data is not loaded correctly,  you can use a NMEA to KML converter to view the data correctly.
It is possible that the coordinates are hopping a bit, and plan to do something about this, so if anyone has suggestions, leave a comment.


Making the enclosure:

This comes down to finding or making a small box where everything fits in. If your going to use it for your cat as I am, it may not be that big as it will annoy your cat.
I have a small enclosure that is used for WiFi-tagging devices (it was a dummy so no hardware was inside), perfect for my project.

This even has holes to put the cat bracelet trough it.
After i mount everything inside, i have to connect the battery to our stack, and it will start logging the data.
Then let my cat run around and afterwards she where she had bin.



Well this was a fun project to do, and there are allot of possibility”s here. You can use it in your car, on your children :-), on your wife :-).
If you want to expand, you even can add an SMS module to it and you can make it a stream for real time tracking.
If you are not into this building stuff, you can also buy this, there are plenty of GPS Cat Tracking devices out there.
But what’s the fun in that.