This last example will be different from all the other sensor projects so far. I’ve been kicking around this dog tracker idea for a while. Recently, there was an “Internet of Things Hack Day” competition held by the local Arduino group here in the Twin Cities (Minnesota, USA). I took this opportunity to form a team to work on this dog tracker idea. This is what my teammates (Wolf Loescher, Russ Terrell, and Patrick Delaney) and I managed to make on competition day.
I’m presenting this idea mainly to highlight how flexible Arduino and DIY automation can be. You can make your own niche sensor. The prototype we made is fully functional, but the electronics needs to be shrunk down in order for it to be worn on the dog. I hope to keep working on it when I have more time. For now, I’ll just post the code and video demo without the fancy wiring diagram found in previous steps. You can pretty much figure out the wiring diagram from the Arduino sketch, so I hope that’s ok.
Lots of people let their dog out to poop in the morning. It’s tempting to just let them out the yard by themselves and give them time to sniff around while you stay warm and cozy inside and finish your coffee. But there’s two problems with that.
- The dog might run away (if you don’t have a fenced yard).
- You don’t know if they poop, or where they poop, and end up spending more time looking for the poop. Neglecting to pick up the poop is NOT an option!
This dog wearables project aims to solve these problems. As seen in the diagram, the idea is to have a dog wear a collar box. The collar box contains a GPS module, tilt switch, and a RFM69 transceiver.
Dog Escape Alarm and Tracking
The GPS location is constantly being sent from the dog unit to the OpenHAB Raspberry Pi at home, via the same gateway previously detailed. The moment the GPS signal strays beyond a virtual boundary defined in OpenHAB, the Raspberry Pi speakers play an audible alarm to alert the dog owner they need to go out and fetch the dog. The owner can look at the OpenHAB screen to see a google map of where their dog currently is (or at least the last GPS signal received). Armed with the initial direction the dog went, he can then use a handheld unit to locate the dog outside. With the great range of the RFM69, the system should be able to locate the dog more than 900 feet away with the hand-held unit, or 700 feet with building obstruction. The range is good enough to be very helpful when locating a lost dog, even if you have no clue where it might have gone. You can drive around waiting for a ping from the handheld unit.
Actually, even without the Arduino hand-held unit, as long as your dog isn’t hell bent on running away, you’ll probably be able to find him just from the google map shown on the OpenHAB screen. You can use your smart phone OpenHAB app, connected to the home OpenHAB server, and see in real time where your dog is wondering off to as you go after him. With such good range, you’re likely to catch him before he goes too far.
Dog Poop Tracking
The system also tells you when your dog poops, and shows a google map of where the poop is. We use the tilt switch signal to tell us when the dog is holding the “poop” position for several seconds. When this happens, the dog Arduino flags a GPS location. The OpenHAB Raspberry Pi plays an audio alert to let you know that the dog has done its business. You then check the map to see where to pick up the poop. The timestamp is there to tell other family members later in the day whether the poop location is current or from the morning bathroom break, in case they miss the audio alert. Family members can use the alarm “OFF” button to clear the alarm and indicate to other family members that this morning’s poop has been picked up.
We’re also using the built-in temperature sensor in the RFM69 to get the ambient temperature of the dog unit. We can send audio alerts if the environment gets too hot or cold. For all of these audio alerts, it’s trivial to also add in email alerts, as seen in the other project examples.
The following demo video is taken in front of my house. Here’s what to look for in the video and screen shots. I wanted to demonstrate the accuracy of the GPS unit. It seems to be good to within 5 feet. I’m able to set the unit at the end of my driveway, right on the grass line. The GPS map shows that location almost exactly. I purposely chose the light post as the poop location to give a sense of how accurate the GPS module is. Pretty impressive for a $15 device.
This is the dog unit placed at the end of the driveway, right on the grass line.
GPS track of me walking around the yard.
We originally planned on putting a magnetometer in both the dog unit and the person unit. Unfortunately, the magnetometer library we wanted to use didn’t play nice with the RFM library. So we had to just skip that functionality. It would’ve been cool to get that working. The OpenHAB was setup to record and chart the direction the dog was facing each time it poops, so that we can determine whether or not dogs really face North when they go.