Introduction: Raspberry Pi Gate Opener
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
Make sure that you make it executable. Chmod +x.
Step 7: Putting It All Together.
Ok, so you've got the code in and permissions perfect. Now it's time to start it up. SSH into your pi and run the python script in the background using &. If you are confused by this, google it. This tutorial is meant for people who have at least some experience with CLI.
Great! Now visit you Pi's IP address in a web browser and you're gate should open! (The remote is toggled.)
If you have any questions, I invite you to comment! I hope this tutorial is clear because it was my first instructable. :) Good luck!
DarrenF6 made it!
We have a be nice policy.
Please be positive and constructive.
Hi, I’m doing this system as my final year project at my college. And I’m really new to Raspberry Pi. I was wondering if you can email me your entire code with the secure as well. That will be awesome. Credits will be on you hehe thanks mate
I just realize I didn’t put up my email address ..
Here you go haha thank you