Goal to create a web based garage door opener that should retrofit to most standard openers. Tested with circa 1990s Chamberlain 1/2 hp opener. Once competed your garage door could be opened from your cellphone or computer.
Raspberry PI - Raspbian (Rev B used for these instructions but should adapt to other versions)
1 5v Relay (GS-SH-205T depicted)
1 Transistor (2N-2222-A338)
Bell Wire (or similar)
and of-course a garage door opener
Raspberry Pi has a power source
Raspberry Pi is on your home network either via Wireless Adapter or Wired
Step 1: The Circuit
We are going use one of the 5v pins to charge the relay. To do this on demand we use a transistor to switch the 5v circuit on and off using one of the GPIOs.
The diode is used to allow the relay coil to discharge slowly preventing undue stress on the Pi circuitry.
Here is a reference to the Pi Pin layout as it relates to these instructions and to WiringPi the software used to control the GPIO which we will discuss later.
The 2 leads wire to the Garage door opener in the same way a wired switch is wired to the opener.
Note: Be sure to check your transistors pins so you don't blow up your Pi. In this example the 5v circuit is attached to the Transistors Collector, the GPIO pin is attached to the Transistors Base and the Pi's Ground is connected to the Transistors Emitter.
Step 2: PI Software
Step 3: The Button (Garage.html)
<form action="Garage.php" method="get">
<input type="submit" value="Open Garage" style="width:500px; height:100px;font-size:80px;border-radius: 25px;
background-color: 2DA3A7;" >
Step 4: The Working Code (Garage.php)
1)Puts the GPIO pin into Out Mode
2)Turns the pin on
3)Waits 2 Seconds to ensure the Opener gets the signal
4)Turns the pin off
5)Puts the pin back in IN mode as a measure of safety (Out pins are easy to fry In pins are more difficult)
6)Returns us to the button (Garage.html)
$on = 'gpio mode 0 out';
$off = 'gipo mode 0 in';
$command = 'gpio write 0 1';
$command2 = 'gpio write 0 0';
header ("Location: Garage.html");
Step 5: Using Your New WebPage
While on the same network as your raspberry Pi you can access the WebPage by typing in your Pi's IP address.
Should look something like this where 192.168.1.30 would be replaced with your Pi's IP address
Press the Button and your Garage door will open or close.
Step 6: Making Your Button Available From Anywhere in the World!
To make your webPage available over the internet you will have to pass HTTP traffic to your Pi's IP address. You should look up the instructions for your own router but for mine it is quite simple. Log into the router's admin page in the advanced settings select port forwarding. Select HTTP as the service and enter the IP Address of your Pi. Now your webPage is available from anywhere in the world.
To get to it from outside your home network you will need the IP address your ISP assigned to you. This IP address is easy to find just go to http://whatismyipaddress.com/ and the page will show your IP address below the text "Your IP Address Is:" Now simply plug that in as the address we used earlier and voila you can now open your Garage door from anywhere in the world.