I recently got my hands on a Raspberry Pi with the goal of writing an article on how suitable the platform is for an education program like BlueStamp Engineering. However once I got rolling, I simply had to make something of my own. I’m not very experienced with Linux, Apache, or Python so I thought a simple project would be a great way to get the ball rolling on all three.
My wife and I recently adopted Penny, a wonderful dog from the Denver Dumb Friends League shelter. She’s been a dream in terms of behavior and disposition, however as dads everywhere say, “A dog is a huge responsibility.” I often have meetings and need to leave her in her kennel while I’m gone. My wife may want to know how quickly she has to come home to prevent Penny from being locked in her kennel for too long, and sometimes I turn my phone off for meetings. The solution? An automated web page that records the status of the kennel, and if closed, when the door was closed.
- Use the Raspberry Pi running the ‘Raspian’ OS to automatically sense a switch on the dog kennel door.
- Use a Python script to read the switch and write the status to an HTML file.
- Run an Apacahe Server on the Pi to make the HTML file.
- Setup port forwarding on my home router to allow other networks to see the html file.
- Use the simplest method to get something running quickly.
The project went really well! I am lucky enough to me a member of Denver’s hackerspace, Denhac, where I tinkered with things and learned from some experienced folks on the weekly Tuesday night hangout. I had some problems with the IP address of the system, but after a restart the issue seemed to go away.
Here is the python script and some notes I took along the way to help anyone looking to recreate my work: raspberrypidogdoorprogram
I took the server down for a few reasons: First, I don’t understand network security enough, and I’ve read that the setup I used isn’t very secure when forwarding ports from the outside world. And second, I get curious occasionally and prefer to have the system on my desk for more tinkering. Finally, the wife seemed to think that this is like taking a sledge hammer solution to a thumb tack problem, which is probably true. But it’s still cool that it works!