Attached is the sketch you need to run on your arduino. However there are a couple caveats…1.
You must plug in an IP adress that is within range on your router (if you are going through a router). To find this follow the more specific commented instructions in the code but basically comment out the manual IP setup code and comment in the DHCP code. This will print an automatically configured IP into the serial. If you don’t know your range you can use that dynamically assigned IP by typing it into the manual IP setup area as you can be sure that is within your router’s range.2.
To control the garage door take your now static IP address and type it into your web browser. Following the IP with either /?C, /?O or /?R will either close, open or give the state of your garage door. The /?C and /?O really do the same thing just with a different HTML reply. For /?R to be accurate you must configure the switch, more on that later.3.
IF YOUR ARDUINO IS CONNECTED TO A ROUTER READ THIS. If your ethernet shield is going through a router the IP address given is a local IP and therefore the closing/opening in browser maneuver will only work from a device that is also connected to that router. To circumnavigate this you need to forward port 80 to the arduino. This is very different for each router but http://portforward.com/
is a great help when trying to figure this out. After you have completed the port forwarding you can control the arduino by using your global IP instead of the arduino’s local IP. Keep the local IP in the sketch but find your global IP by going to http://www.whatismyip.com/
with any computer connected to your router. You can now type this IP into the browser of any device (on your network or otherwise) and use the same commands to control the arduino. Keep in mind your global IP may not be static and may change as your DHCP lease expires. Google how to assign a static global IP for your router or just keep up to date with the changes if this is the case. This part can be a little confusing if you’re new to this stuff but I am happy to try to help if you have any questions.
Step 4: Final Thoughts
At home this summer I had a need for way to control my garage door from greater distances than just a couple hundred feet. This was the most beautifully simple solution I could come up with and it has worked much better than I expected! With that said there is certainly room for some improvement. The hardware and software to detect the status (open/close) of the door was never fully implemented but in theory it should all work fine. Also you could certainly use a relay in place of the transistor if that is more your taste. I’m happy to hear about any improvements you make to the hardware and sketch so please comment with your ideas and revisions. If you need any help with my version, please comment and I’ll get back as quick as I can!
Here is a video of the project in action! Sorry for the hasty production of it.