I need a web site, accessible from anywhere that will allow me to view, and control a Lego Mindstorm build robotic door that I use to let my cats into and out of my house.
My first thought was to host this site locally on my home PC. This solution is not ideal for several reasons. First, is that I do not have a static IP address. Every time I reboot my PC, or reset my router, the IP address of my web site could change. The second limitation is that it would require that my home PC must remained powered up, shortening the life of my machine, and wasting electricity.
What I need is a web site with a static IP address that I can access from both home and away, with no dependence upon my home PC. This made an Azure website an ideal hosting solution for my application.
My cat is a prolific hunter and loves to bring me wildlife. This includes birds, mice, rats, and possum. To make it even worse, he live to bring them to me alive. Nothing says emergency more than a cat dropping a live rat onto the bedroom floor at 3 am.
I've been fighting this problem for the past year. Over this time I have come up with 4 different solutions. Each improving upon the previous version.
Do not let the cat outside after dark. Rats are nocturnal,, so simply shutting the door at night will solve the problem. This version proved to not be a good long term solution, since the cat decided to wander the house all night long meowing at the top of his lungs until I relent and let him outside.
Let the cat out all night. The problem here is that I live in Michigan, and it gets cold at night. So I would like to be able to let him in when it get cold. So I build a ugly but effective plexiglass box that sits just inside of the pet door in my living room. The cat can enter into the house, but only stay in the cat box until I wake up in the morning to let him out of the box, assuming he is not carrying any wildlife in his jaws.
This would have been good enough, except the cat does not have a great deal of patience, and has now learned that if the box is closed, he can wander back outside and yowl outside my window until I get up out of bed, walk over to the front door, and let him into the house.
But I did not want to get out of bed every night to let him into the house.
How could I let the cat into the house at night, without leaving my bed, and yet ensuring he was not trying to enter the house with a live animal in his mouth?
This is the version where I went full nerd. I installed a web cam with motion detection software that will notify me when the cat is in the cat box. It is configured to send all notifications to my phone. I then created a shortcut on my phone that allows me to view a live feed of the camera. With this configuration, I can see when my cat wants into the house from anywhere, and if he is also rat free.
Yet, I was not done. I also needed the ability to open and close the cat door without having to leave the comfort of my own bed. If the motion alert sounds, I would still need to hop out of bed, wander back to the cat door, and let him in.
What I needed was some sort of robot that I could install that would allow me remote access to open the door. When I think robots, I think.... Lego Mindstorms. Why not increase the cool factor of my cat box by a million by adding a Lego robotic crane that could open and close the cat door.
So I built a Lego robot. A robot that will open and close the cat door. You can see this door in motion by browsing to following video link:
Catdoor Video on Youtube
Photo of the Cat Box with the Lego Robot on top and the Web Cam on the side:
The robot will respond to the press of the button that is mounted on the side of the wall. (You can see my foot press it in the video) It will also open and close if a sensor attached to the top of the web cam is tilted backwards by 30 degrees. What this allows me to do is use the built in pan/tilt functions of the camera to open the door remotely using any web browser.
I was pretty pleased with this solution, because I could now browse to the built in web site that is native to the camera and use the pan/tilt buttons to cause the cat door to open.
Yet, the solution did not pass initial user testing. I found out quickly that I did not enjoy having to browse the camera feed web site, enter my login credentials, view the camera feed, then navigate to the control panel page for the camera, click on the "Tilt Up" button 4 or 5 times, wait for the cat to enter the house, and then tilt the camera back down to the original position.
Not very user friendly.
This leads me to the current version of my cat door. In this version I am trying to develop a custom ASP.NET web page that has the very simple User Interface that shows the current camera display with a big "Open Cat Door" button. I want this solution to bypass the ugly built in web page of the web camera, and bypass the security of the camera, allowing me to open the door without having to enter credentials.
Plus I want to be able to access this web site from anywhere. I could host this web site on my home PC, but since I do not have a static IP address, the web site might not always be accessible. Plus I do not want to be required to keep my PC powered on in order to operate the cat door.
What would be ideal for me is to create this web site and put it up into the Azure cloud. This would allow me to exclude my local PC from the overall solution architecture.
Using the code
Code is still in development as of 5/2/2013. I will be posting code snippets from the web site as they are complete. However, since this solution requires a great deal of independent hardware, I am not sure the complete solution will be of much use to most readers.
What I hope to put here is snippets on how to read the images from the camera, how to send pan/tilt commands to the camera, and how to bypass the camera security.
Points of Interest
Web Cam Details
2013.05.02 Initial Posting