This is a raspberry pi project that enables you to open your garage/gate with any kind of web browser!
Step 1: Gather those supplies.
- Raspberry Pi – 35$
- Relay Board – 5$
- Your Gate Opener – (You will be sacrificing the gate opener)
Great. Now that you have those, moving on!
Step 2: Wire up that remote.
Crack open your gate opener and find where the button leads are. Solder two wires to the leads. When you touch these wires together, your gate should toggle. At the time of making this I didn’t know much about circuitry so i went a head and soldered the button, so that when power was supplied to the remote, the gate toggled. YOU DO NOT NEED TO DO THIS. Just solder the two wires to the button leads. And then solder those wires to the relay.
Step 3: Wire up that relay.
Find the pins on the relay that are labeled GND and VCC. Connect the VCC to the raspberry pi’s 5v pin. You can find a mapping of the pins here: http://elinux.org/RPi_Low-level_peripherals. And wire the IN1 to one of the Pi;s GPIO pins. Your choice of which pin. Check out that link above to see which ones are ok for this. (make sure you’re using relay 1 if you’re relay board has more than relay channel.)
Step 4: Get that library.
SSH into your pi or get the CLI somehow so we can install some things.
First install RPi.GPIO. Just search google for it and download it to your pi. It’s a very easy install of the python library. If you have any problems, try running as root through the entirety of the installation.
Step 5: Write that code.
In this tutorial I will include the very first version that I created. I have expanded on this by a ton so if you want my code, just comment. Mine includes access codes that expire and a full web application that secures the gate web interface and remembers your password for next time. But here we go with the simple version. Install apache web server on your Pi. It is very easy! Look for tons of tutorials on google for this! After you’ve done that, here is the php code:
Create a file called index.php and put this in it. make sure the file permissions are set correctly after this…chmod 777.
Step 6: Write more of that code.
Ok, now the python code. Put this in the same directory as Index.php. On my pi that is /var/www/. Here is the python code:
import RPi.GPIO as GPIO
from time import sleep
For more detail: Raspberry Pi Gate Opener