WithTracker1

If you have an outdoor cat or dog, you’ve probably wondered where it goes during the day. Do they just hang around outside the house, or do they go on long adventures exploring the neighborhood? To snoop on my cat Conley, I made a GPS cat-tracking collar that would log his location during the day, then let me download the data to a computer when he gets back home.

At the core of this collar is a TinyDuino microcontroller and a few of the expansion TinyShields that are available for this platform. The TinyDuino works just like the Arduino Uno and can run the exact same sketches, yet it’s only the size of a quarter. You can easily add capabilities just by plugging TinyShields into it — I used the GPS TinyShield to get the position data and the microSD Card TinyShield to log the data.

GPS_Cat_Tracker_Wiring_Diagram

To power the system, you need a small and light battery with the capacity to run the system long enough to get useful data. The GPS and SD card writes are fairly power-hungry, so I use a small lithium-ion rechargeable battery that provides up to 6 hours of logging capability. A larger battery can also be used to get much longer logging times.

To make the electronics box for the collar, I used a Tic Tac container cut down to the exact size, with a small slot cut in it to let the cat collar slide through. This lets the GPS module sit on the back of Conley’s neck during his adventures strolling around, and provides the best GPS antenna reception.

The software used to program the system is very simple: an Arduino sketch runs on the TinyDuino, which captures the raw data from the GPS module and writes it to a text file on the microSD card. Pop out the microSD, put it in your computer, and you can open up the file in a program like Google Earth and see exactly where your cat was during the day, complete with timestamps.

Steps

Step #1: Assemble the electronics.

PrevNext
GPS Cat TrackerGPS Cat TrackerGPS Cat TrackerGPS Cat Tracker
  • To make it easy to connect and disconnect the battery, we'll hack a battery extension cable and solder it into the TinyDuino. Cut the extension cable to be about 1" long, with the female version of the connector left on it, and strip about 1/4" off each wire.
  • Solder the red wire of this cable to the “+” hole on the TinyDuino, and solder the black wire to the “–“ hole. Use the wire cutters to cut off any excess wire poking out through the holes.
  • Plug the microSD TinyShield into the TinyDuino. Then plug the GPS TinyShield on top of the microSD TinyShield.
  • Secure the boards together using the mounting screws: place the plastic standoffs between the boards where the screw holes are (tweezers are useful), then put the screws through the holes. Then finger-tighten the nuts onto the screws. You can then also trim the end of the screws since they will stick out a bit.

Step #2: Program and test the electronics.

PrevNext
GPS Cat Tracker
  • Use your computer to format the microSD card if not yet formatted. Slide the microSD card into the TinyShield microSD adapter.
  • Plug the USB TinyShield from the kit into the top of the stack of boards (on top of the GPS TinyShield). Connect the USB TinyShield to your computer using the USB cable.
  • Upload the TinyDuino GPS Data Logger sketch to the TinyDuino using the Arduino IDE. Then open the Serial Monitor in the Arduino IDE, and you should see a lot of data and weird text start appearing. This is data from the GPS module (in NMEA format) appearing in the window. In the Arduino SoftwareSerial Library (under ArduinolibrariesSoftwareSerial) the SoftwareSerial.h file needs a minor change to allow a larger serial buffer to be used. Replace the Software Serial library files with the ones in this zip file.
  • If you see any messages about problems writing to the SD card, check that it’s installed and formatted properly. The LED on the TinyDuino processor will also be flickering whenever it writes to the SD card, about once per second.
  • Unplug the USB cable from the USB TinyShield. Unplug the USB TinyShield from the top of the stack of boards (it doesn't need to be attached except when you need to connect to your computer).

Step #3: Build the enclosure.

PrevNext
GPS Cat TrackerGPS Cat TrackerGPS Cat TrackerGPS Cat Tracker
  • Empty out your standard-sized box of Tic Tacs. Then use a small hobby knife to cut away the label to free the top white lid, and lift it off.
  • Now cut the box down to the right size: measure 1-1/2" from the bottom of the box, and cut all around the box using the hobby knife.
  • Cut small slots on the sides of the enclosure near the walls so you can feed the collar through, then feed in the collar through both of this slots.

Step #4: Put it all together.

PrevNext
GPS Cat TrackerGPS Cat TrackerGPS Cat Tracker
  • Make sure the battery is fully charged using the lithium-ion charger. Then plug the microSD card into the microSD Adapter TinyShield.
  • Plug the battery into the system. The LED on the TinyDuino processor board should start flickering about every one second (this indicates that the GPS data being written to the microSD card).
  • Fit the electronics and battery into the Tic Tac case and put on the lid — the TinyDuino boards will sit side by side with the battery. The small rectangular component in the upper right of the GPS TinyShield is the antenna; put this on the far side of the battery.

Step #5: Put the collar on kitty!

PrevNext
GPS Cat Tracker

For best results, the enclosure should be on the back of the cat’s neck and the GPS antenna should be pointing up. Also try to keep anything metal away from the antenna, as this will impact the GPS reception. Let kitty roam around for the day, and when he gets back, it’s time to see where he went.

Step #6: View the data.

PrevNext
GPS Cat Tracker
  • When kitty comes back, take the collar off, unplug the battery, and unplug the microSD card. Place the microSD card into your computer, and there should be a file called gps.nmea on it.
  • NOTE: If you don't have a SD card reader on your computer, you can also download an Arduino sketch that will let you retrieve the file over the USB port.
  • There are a number of programs that can read the .nmea file — a great one that is free is Google Earth. To use, open Google Earth on your computer, and select Tools —>GPS. Under the Device, select “Import from File.” Under the import and output sections, make sure all options are selected. Click on Import and select the gps.nmea file. Google Earth will then display the data as a "track," which lets you see where kitty went during the day, along with timestamps.
Ken Burns

Ken Burns

Ken Burns is an engineer, programmer, and longtime electronics hobbyist living in Akron, Ohio. He is the founder and president of TinyCircuits, which develops miniature open source electronic circuits.


Advertisement

  • Peter Favaro

    Getting these errors. Reformatted SD card and updated libraries. Any clues?

    Arduino: 1.5.6-r2 (Mac OS X), Board: “Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)”

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp: In function ‘void spiSend(uint8_t)’:

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp:54: error: ‘SPI’ was not declared in this scope

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp: In function ‘uint8_t spiRec()’:

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp:81: error: ‘SPI’ was not declared in this scope

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp: In member function ‘uint8_t Sd2Card::init(uint8_t, uint8_t, int8_t, int8_t, int8_t)’:

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp:326: error: ‘SPI’ was not declared in this scope

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp: In member function ‘uint8_t Sd2Card::setSckRate(uint8_t)’:

    /Users/pfavaro/Documents/Arduino/libraries/SD/utility/Sd2Card.cpp:585: error: ‘SPI’ was not declared in this scope

    This report would have more information with

    “Show verbose output during compilation”

  • Crystal

    I was wondering if you make them and sell them? To technical for me… lol

  • ian

    Hi i am a 10 year old trying to complete this project for my aunt’s birthday. She is in the foreign service and lives in Tunisia with a cat that she got in Afghanistan. I’m only getting time stamps and nothing else in the $GPGGA sequence. I have left it outside overnight on a clear night and still nothing. Help?

    • disqus_zXLbNfw1Yi

      Make sure The GPS module is on top of the stack and nothing is covering it. Also make sure you don’t have any other metal objects close by. You might also need to download the GPSBabel free software, and use it to strip out any bad data. Download it and then run the file through as input using the NMEA format, and output it to a new file with the same NMEA format. http://www.gpsbabel.org/

  • Matthew Sullivan

    Hi, I am combining this with the tiny accelerometer. The GPS and the accelerometer produce the correct output and separately write to the SD card using your code. I am having trouble stitching the two codings together though. Can you advise? Thank you. (I am 50 years old).

  • JDuc

    For anyone running into an issue uploading the sketch because of the following error:

    avrdude: stk500_recv(): programmer is not responding

    The solution is to go into the Arduino program under Tools… Board, make sure “Arduino Pro or Pro Mini” is selected.
    Then under Tools… Processor, make sure the Processor is set to
    “Atmega328 (3.3V, 8MHz).

    Source: http://forum.tiny-circuits.com/index.php?topic=323.0

    Also, I found that I needed to include SPI.h

    #include

  • JDuc

    on a different note, I can’t seem to get the data to read in Google earth. When I try to import the data, I get an error telling me that there is no data: Loaded no data.

    My file looks as follows (snipped):

    $GLGSV,2,1,07,70,66,289,,85,64,331,,84,59,145,,69,36,027,*64
    $GLGSV,2,2,07,71,24,237,,86,13,329,,83,05,148,*53
    $GNRMC,214458$GPGGA,214459.000,3251.4212,N,09641.3899,W,1,03,5.0,164.1,M,-24.0,M,,0000*6F
    $GNGNS,214459.000,3251.4212,N,09641.3899,W,AN,03,5.0,164.1,-24.0,,0000*54
    $GNGSA,A,2,15,29,20,,,,,,,,,,5.9,5.0,3.2*28
    $GNRMC,214459.000,A,3251.4212,N,09641.3899,W,1.16,306.66,091015,,,A*63
    $GPGGA,214500.000,3251.4191,N,09641.3869,W,1,03,5.0,164.0,M,-24.0,M,,0000*64
    $GNGNS,214500.000,3251.4191,N,09641.3869,W,AN,03,5.0,164.0,-24.0,,0000*5F
    $GNGSA,A,2,15,20,29,,,,,,,,,,5.9,5.0,3.2*28

    Any thoughts?

    • robraux

      Did you figure out this issue? I’m having the exact same issue. Lots of data generated, but nothing which will load into google earth.

      • JDuc

        Unfortunately, no. I haven’t really been able to get very far with it.

        • Gene

          It looks to me like a challenging text parsing problem. My guesses:
          – It’s comma delimited
          – Fields with $ indicate the first field, so rows with two $ indicate incomplete data collection.
          – The first six digits are a time stamp, probably milliseconds.
          – The * field indicates an end of record.
          – The data following the * is in hex
          – The $ fields indicate certain satellites, only some of them will be able to give you valid data, so filter out the rest
          The numbers before N and W are the numbers you want, and they can be converted to lat / long values (you can probably get decent results with a simple a + b *x transformation, but to be more accurate you’d need to know the projection assumptions)
          – The Other things are probably meta data relating to altitude, signal strength, projection assumptions, and maybe some secret listening station data (jk on the listening station part).

          With more data and some info about your actual locations, I could probably create a parser for you.
          I suspect that you’d probably get better results if you could get results less often. I’ve had similar problems capturing very basic temperature data. Some of the records just didn’t get written completely. I never spent the time to figure it out, but I figured that it would take some electricity know-how to tune the signal with capacitors and/or resistors, or maybe better control of the SD writing process.

        • Aaron Lager

          Any luck yet? I just got all my parts for this project and am having the same issue. I used freenmea.net to check the output, and it also says there is no data.

          • Aaron Lager

            Actually, it just needed more time outside, under the sky. I put it on my dash board while I drove to work, and it tracked me just fine.

    • Rick Wilson

      Same here. Its recording to GPS.TXT just fine. I change it to GMS.nmea and follow the above instruction to view it in Google Earth, but I get “Loaded no data”.

    • disqus_zXLbNfw1Yi

      You need to get the free software GPSBabel. Download it and then run the file through as input using the NMEA format, and output it to a new file with the same NMEA format. The program will strip out the bad data and you can feed the new file into Google Earth. It worked perfectly for me. Here’s the link for the software: http://www.gpsbabel.org/

  • Gene

    You don’t need GPS to know what your cat’s doing! It’s just doing it’s part to help curtail biodiversity http://www.bbc.com/news/science-environment-21236690

  • disqus_zXLbNfw1Yi

    I solved the no data problem, but I can’t get it to work with the lithium ion battery. Is the combination GPS module, SD card module and the TinyDuino processor too much for the battery?

  • bbo1946

    The project works fine when using the USB TinyShield for power. However, I cannot run from a Lithium-ion Polymer Battery – 3.7V 270mAh from TinyCircuits. I have the USB TinyShield and the battery both connected, which I think charges the battery when the USB cable is connected to the host PC. The USB TinyShield is used to load the sketch and run, which works fine — the GPS data is logged to the microSD and I can view the data in Coogle Earth after converting the GPS.TXT using GPSBabel as mentioned in the comments. How can I tell if the lithium-ion battery is charged? I suspect it is not. The TinyDuino processor board is from the TinyCircuit Basic Kit and has the lithium-ion connector. Does TinyCircuits have a Lithium-ion battery charger? I saw one from AdaFruit that might work. The AdaFruit charger has a LED that shows if the battery is charged. AdaFruit warned that its charger should only be used with AdaFruit’s lithium-ion battery. Anyone know if the AdaFruit charger would work with the TinyCircuits lithium-ion battery? (Comments I read under the TinyCircuits lithium-ion battery make me think it would, but I am not sure.)
    I really think the project is cool. Just want to make it work with the battery.

  • disqus_zXLbNfw1Yi

    I gave up on this some months ago. I recently went back and I found a software update. It seems to make everything work. After I finish testing it out, I might buy their GPS with the external antenna, since the original module is not very accurate. https://codebender.cc/sketch:60928#TinyShield_GPS_V2.ino

    • disqus_zXLbNfw1Yi

      Also, it takes a long time to connect. I tried it out on a drive to the store, and it didn’t connect until I was almost there. It worked fine on the drive home though. Maybe the module with the antenna will connect faster.