Time is a miserable thing, or maybe it is just the fact that my past efforts are tracked on this web site..
Just this week as I left for work and found my wife’s garage door open. She had obviously driven off and had either forgotten to push the garage button or was out of range when she did push it.
This got me to thinking about my garage project which I thought I had just been working on last year. This site shows me that it was almost 2 years ago.. ugh! Where does the time go..
This was the original Garage Door thread… https://robin.mulloy.ca/newest-project-control-of-garage-doors/
Oh well, back to the project at hand.. I thought that it would be a great idea to have a little Android application that could ping my home server as I approached my house. My wife and kids are also Android users so that idea really got me thinking about home automation and what could be done with a system like that.
There are products on the market that can control lights and other electric devices based on GPS, so this is nothing new. (Quick shout out to Justin since he supplied me with a device to play around with a year or so ago; thanks!). I think the thing about this is that it would be fun to build it myself, and it fit with the work I had done already related to my garage doors.
In this implementation I went with a relay to control the garage door. I had originally planned to use GPIO and control the garage door opener directly, but using a relay is much easier and also quicker to remove if I decide to use the hardware somewhere else.
Side note: I did find out today about WeMos devices that are based on ESP8266, offering a WIFI connectable device in a very tiny package. Add a relay shield to the device and well, I have several on order from AliExpress… 🙂
For now I am happy with using a Uno to do the work with an Adafruit CC3000 WIFI shield.
For my own reference, here are some updated schematics of the door controller.
The Arduino code is attached.
Step #2 – Android Controller
The plan was to have an Android program that would track GPS locations of my wife or myself. As we approach the house, the system would trigger the appropriate door to open. Similarly as one of us left in the morning, the system would trigger the door so that it would close.
This of course brought up thoughts related to how I would know if the door had already been triggered through the use of the remote or wall mounted switch. I figure that in the future, I will have a Ping sensor mounted on the ceiling that can see if the door is open. The door slides up to the ceiling so it would be trivial to determine if the door were open.
If the Android application were to ping the web server because it was leaving the area, the system could also wait 30 seconds or so to allow the door to close by other means.
So I had some thoughts around all of this but ultimately I just needed something to trigger the door manually for my own testing. The results of that effort are attached, and the video below demonstrates a successful test.
First rev of the Android software is attached.
Step #3 – Web Server and Brain of the Operation
The Android device would need to be able to report its location back to the system or there would be no way to know that it was leaving the area. Granted that a disconnect from the WIFI network might be enough, but I thought that I might also wan the Android application to send other signals, or to take part in a two way protocol. I admit I don’t know exactly how this will evolve but certainly want to leave my options open.
So attached is a simple PHP script that receives an action parameter from the caller (user web access or programmatic Android web access). The “action” received is passed to the Android device on the local LAN, where it is parsed and actioned.
I should mention that I do run a web server on my local network, which is accessible from the outside world. Internally I run Citrix with several VM’s for things like PlexServer, Minecraft, Windows and Linux development and a Transmission server, so the setup of a PHP script was also trivial.
PHP web script is attached.
Step #4 – Putting it All Together
The video below is the best way to show how all the parts came together.
March 21, 2016 at 1:30 pm
I am working on a similar project