Monday, 10 October 2011
GPS feline tracker.
Ash is my Russian Blue cat, and loves his neighbourhood adventures. Regularly off for hours on end, he could end up in who knows what garden, possibly halfway down the street. After endless such adventures, I figured it was time to find out where he really was going.
GPS is of course the way to go, so I looked around for a tracker I could attach to him. Turns out that all the ones commercially available are far too large. A common one available on ebay is about the size of a matchbox - too large for a cat. All other pet trackers are made for dogs, it seems.
So it was time to roll my own.
A tracker has pretty much only one way to attach to a cat - on the collar. That means small and light is essential - Ash needs to be able to ignore the collar and its attachments. So I needed to find the smallest stuff I could get.
The most important part of tracking is the GPS to actually get location. Nowadays there are a lot of GPS modules around. I ended up picking the MiniMod from Sparkfun - at only 4x1.5cm, it's a super tiny module, not much wider that a cat collar, and not overly long. With a built in (tiny!) antenna and serial output, it has everything I need.
Next, the signal from the GPS needs to be sent somewhere. Live transmission was out of the question - there arent any GSM modules small enough, and no other radio would have the range I needed, even at that size. So local logging was the way to go. After thinking up a few ideas about small microcontrollers and flash chips, I discovered the Openlog. At under 2cm long, and 1.5cm wide, this tiny module consists of not much more than an AVR and a micro sd slot. It works by simply logging whatever serial data is fed to it onto files on the SD card.
All I had to do was connect the GPS serial output into the Openlog, give them both power, and Bingo, a complete tracking solution!
Of course the modules also need power, which must be capable of attaching to the collar. AA's and AAA's were out - way too big. A while back I picked up one of those tiny LCD photo keychains, for something like $7. And inside had exactly what I needed, a small Lithium Polymer battery that was a bit smaller than the GPS module, and gave 3.7 volts.
And that's all it took.
Battery, OpenLog and GPS are all strapped to the collar with cable ties and duct tape, small wire-wrap wire connects them all together, with a small connector for the battery so I can charge it. Attach to the cat, and off he goes prowling the neighbourhood, having his location merrily logged to SD for about 2 hours before the battery dies.
He's not a particularly fussy cat, and he lets me attach the collar to him without a struggle, and it doesn't seem to bother him at all. So far it's also been immune to scratching and other abuse you'd expect. It's not waterproof though, I'll only attach it on a dry day.
Once he comes back, all I have is a load of NMEA data on the SD card. It's not very human parseable, and I'm not good at converting lat/long data into actual houses around here.
So it's Python to the rescue! A quick script converts NMEA data into KML, suitable for Google earth/maps, and up pops a full track of where he is. A link to the (awfully coded) script.
I'm actually quite surprised how far he roams. Rather than just the houses on either side or right across the street, he ends up quite a few houses away, and almost to the next street across. That probably explains why he often won't come when called, he's just too far away. At least he enjoys a wide territory to roam...