Picture of Raspberry Pi Garage Door Opener
Hello Everyone!

This instructable explains how I setup a Raspberry Pi to open my garage door using a smarthphone. While this has been done before, I thought I'd post my solution. This was my first hardware project and instructable ever and I'm sure I made some mistakes. So, when you find one let me know! 

Project Overview:
What we will be doing is turning the Raspberry Pi into a small web server. When you access the webserver from your browser of choice, you will have a big button that triggers the garage door via a relay. We will wire a very basic circuit to the Pi's GPIO pins and upload a website that triggers the circuit. When the relay is triggered, it closes the circuit hooked up to the garage motor and opens the garage.

Why would anyone want to do this?
Well, my garage door opener was broke and this was cheaper than replacing the other system. As an added plus though, you could wire up additional sensors and be able to make sure your garage is closed remotely if your were so inclined.

Shopping List:
I consider myself pretty cheap, and I tried to keep the costs minimal. All of the items are available on prime.

1.) Raspberry Pi - Model A - $32

2.) Wifi Adapter - $10

3.) PSU - $5

4.) 5v Relay - $6

Total: $53.00

You will also need an sdcard >= 2GB and some wires, but I had extra of each.

Remove these adsRemove these ads by Signing Up
1-40 of 122Next »
pber made it!5 days ago
I managed to use this Instrucables and one from PiMyLife to have video on same page as garage door button .
mike56656 days ago

I know this is an old thread - but I am trying to get rid of the Gray button and make it prettier. Anyone have any idea how to do that?

SergeyS41 month ago

Thank you for the instructions. I used them to assemble the device and wrote small customizable service that can be run on the device and controlled remotely via android app.

It is very flexible and you can configure separate relays to act as a switch that turns something on/off or you can make it pulse and use it as garage door opener. All devices are seen on in the app and you can controled individually.

pber SergeyS46 days ago
Can you integrate this
pber made it!6 days ago
I made this, worked the first time.

How would I merge this so video is on the same screen as the Garage button?
paulp2113 days ago

What about muilti function wall buttons that do lights and other stuff?

I saw on another site that said open/close is just shorting the pair. Lights put a Capacitor in series, etc

BrunoB726 days ago
Hi. Can i do this without internet connection Or with a Bluetooth?
ITninja76 made it!1 month ago

Worked like a charm!

I have an IP camera in the garage and added it to the web page, just above the button.

duboisvb1 year ago


i am new to linux and the Pi but I have followed your instructions thru step 4.and all seemed to work but when I go the the page I do not have button just a blank page which is titled "Garage Opener" . I am not sure what to try . Can you advise me?

sorry, I figured it out . on to step 5

Can you advise me on how you got this to work? I am having this issue as well.

ameggs1 month ago

AWESOME INSTRUCTABLE!! thank you . I would like to add an older logitech orbit webcam i have laying around to the webserver. is this possible and where do i start?

Jasperowaale2 months ago

Well, I will share my Index and others files, as I added 2 relay to close door, you still need to make pin work at the start, also I have not yet tested, but trigger's working and returning the 1 and 2

if(isset($_GET['trigger']) && $_GET['trigger'] == 1) {
exec('gpio write 7 0');
exec('gpio write 7 1');
else if(isset($_GET['trigger']) && $_GET['trigger'] == 2) {
exec('gpio write 2 0');
exec('gpio write 2 1');

<!DOCTYPE html>
<title>Garage Opener</title>
<link rel="apple-touch-icon" href="apple-touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-iphone-retina-display.png" />
<link rel="stylesheet" href="/css/style.css" type="text/css">
<meta name="apple-mobile-web-app-capable" content="yes">
<script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/js/script.js"></script>

<div class='awrap'>
<a href='/?trigger=1'>
<a href='/?trigger=2'>

$(document).ready(function() {
$('a').click(function(e) {
$('a').click(function(e) {


Panais957 months ago
Please help me. My garage khas two buttons one to open and one to close and I can only open it. How to add another button to use the other relay???
JohnJ6 Panais956 months ago

Mine too but i got it worked out. you still need help?

Yes I kind like to know, I have in fact 3 , open close and stop, guessing Im able to relay 2 for close ? and 1 for open

Jasperowaale2 months ago

I know I'm a bit late, but links to Image looks not to work, and the ones I found just make a 56Mb drive out of my 2GB SD card anybody have the right files ? and like to share

Jasperowaale2 months ago
Jasperowaale2 months ago

Im a bit late to this, but like to make it, but I look not to be able to download the I did find the noobs image but it need a lot bigger SD card than the 2GB anybody have the Image or advice ?

jc95663 months ago

Would this interfere with a multi-button Wall Panel where you can not only open and close the garage door, but also turn on light, or place your unit in lock mode? If i had a single button opener on my wall this would be straight forward. Please advise if you have any more insights here. thanks and great job! this is pretty darn cool.

mrcranky jc95662 months ago

If you have a multi-button wall opener, it probably connects by two wires to the garage door opener. You can connect your relay to the same two terminals on the garage door opener. It seems like when you press a button on the wall opener, it sends pulses to the garage door opener, but if you just short those terminals by closing your relay for a second or so, it makes the door open or close. The wall opener will still work normally, including the light switch.

mrcranky made it!2 months ago

I made this and connected it to my Chamberlain garage door opener today. It works great.

I used an old internal CD-ROM audio cable to connect the Pi to the relay. I took off one end and used its crimped-on female pin connectors to attach it to the GPIO header on the Pi. The original four pin header connector on the other end fit perfectly on the relay.

Next I'd like to add a sensor to tell me if the garage door is open or not. I'm thinking a cheapo magnetic sensor you use to detect open windows and doors in a home security setup, or even just a simple switch attached to a GPIO input. It could show as a green/red indicator on the garage door opener web button.

2015-05-21 15.53.27-2.jpg2015-05-19 23.08.31.jpg
Hey, I made it too! Thanks for the instructions. I have one issue. I noticed after a few minutes of stand by and I try to return to the page, it times out. I'm wondering if something is going into stand by or something else may be wrong. It takes me a couple tries before I can get back on. Any thoughts?
One thing that just occurred to me is I had it booting to the GUI. Seems to be doing good now after changing it.
The wireless adapter was going on stand by and the following fixed it. BTW, my adapter is a EDIMAX EW-7811Un

Create the new file
$ sudo nano /etc/modprob.d/8192cu.conf

Add the following
options 8192cu rtw_power_mgnt=0


Looks like it's working
Correction: /etc/modprobe.d
jbarrychristian made it!3 months ago

I just finished the garage door opener portion last night. Thanks for a well done instructable! Today, I am adding motioneye to use the camera as a way to see if the door is open or not. Still working on that last part.

MathewS23 months ago

How would you create a password to protect the website?

MathewS23 months ago

Do you atttach new wires from the terminals on the garage motor to the pi or do you use the ones coming from the opener on the wall?

MathewS23 months ago

Which wires do you attach to the relay, the ones on the garage door motor or the opener on the wall?Also, do you need more wires to connect the pi to the garage door motor again since you are going between the connection of the door opener on the wall to the motor?

MobileGenius4 months ago
Has anyone written a .php and code for the ability to control both relays? As in dual garage buttons?

I also would like to have this possibility. The .php and java script are written in comments somewhere below. The last and only problem I have is changing the start up script to initialize the additional pins. I was working on that four hours with no luck. I have two buttons on my web site and both working only on first relay.

Can anyone post changed script to work with second relay?

Are you using your buttons to execute a python script IE: and

I am using only one script which starts automatically on start up. I believe one script is enough. I just didn't changed as I should to work with second relay and I have no idea how to do it.

Thanear Thanear3 months ago

I just found out that I've done mistake in .php. Now everything works fine and thanks to comments below adding new relays is very easy. Thanks!

Great! Did you add a line to set the GPIO pin that was on the second relay to high, then low to get everything going?

I just added lines

/usr/local/bin/gpio write 2 1
/usr/local/bin/gpio mode 2 out

in start up script. You also have to change .php and java script file. Srungi posted them in comments.

koritsi4 months ago

Can you please give some more details on the web page? can you upload the code for the web page? I am using html css and javascript to create the web page but still I'm unsure how to control it.

lbingham koritsi4 months ago

All of the webpage information (including the zip file with the entire web page contents) are in step 4.

MobileGenius made it!5 months ago

Very nice write up, can confirm all above steps work in order on the Pi2. I have simple (and reusable) prototyping boxes, panels, plates, lids, etc so when it came down to installing this feature to our home automation suite this instructable was a blessing!

This will eventually become fully enclosed and built within a housing. All the components you see are mounted on the bottom of the lid of the enclosure, I'll be building everything into the base as well as adding controls for the second door.

I have seen many different options for reading the status of the door itself. Everything from linear codes reading shapes to full blown live cameras. I'm planning to use a simple distance sensor ($8 for two) facing down from the opener itself. It will relay the distance to either the ground or the door (when it's opened) to the server homepage. This data will be set as a variable and will simply show "Open" or "Closed" using < > codes, with the accuracy of these sensors it should prove reliable.

Happy to see so many people have made sucessful projects and a big thank you to quartarian for the write up!

1-40 of 122Next »