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.

1-40 of 126Next »
MatM312 days ago
I have a question i'm doing a university project and need just a door lock to open and close via smart phone more like an web app open, close nothing to fancy, but i only want it open close via battery so do i need a relay and how can i by pass it ?

jc95664 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 jc95663 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.

pber mrcranky17 days ago
I having a Chamberlain multi LCD wall button with motion sensor. It also tells if power has been restored or battery backup is charging. Does time and temp and lights.

I went directly to the ceiling unit. I think the wall button LCD doesn't like being shorted. I sometimes get a message on the LCD saying something is miss wired. So I may need to add leads to actual button or solder leads on a wireless remote.

Anyone have any thoughts?
sshlyk21 days ago

If you do not like to control your device via web interface, you can try Android app


Keep original setup but skip web-server part.

jaloysius23 days ago
Great instructable!
I have been using my Raspberr Pi controlled garage door for months without any issues.
I am now trying to understand the code but I am struggling. I deleted the original images uploaded to /var/www and uploaded my owm image but I still get the gray button. So I am confused what it's doing.

Would some one be kind enough to give me a line by line rundown of the code in index.php so that I can understand and learn how everything fits together.

Many thanks in advance.

pber made it!1 month ago
I managed to use this Instrucables and one from PiMyLife to have video on same page as garage door button .

mike56651 month 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?

sshlyk2 months 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 sshlyk1 month ago
Can you integrate this http://pimylifeup.com/raspberry-pi-webcam-server/
pber made it!1 month ago
I made this, worked the first time.

How would I merge this so video is on the same screen as the Garage button? http://pimylifeup.com/raspberry-pi-webcam-server/
paulp211 month 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

BrunoB71 month ago
Hi. Can i do this without internet connection Or with a Bluetooth?
ITninja76 made it!2 months 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

MattG14 duboisvb2 months ago

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

ameggs2 months 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?

Jasperowaale3 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) {


Panais958 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 Panais957 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

Jasperowaale3 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

Jasperowaale3 months ago
Jasperowaale3 months ago

Im a bit late to this, but like to make it, but I look not to be able to download the http://raspberry.mythic-beasts.com/raspberry/images/raspbian/ I did find the noobs image but it need a lot bigger SD card than the 2GB anybody have the Image or advice ?

mrcranky made it!3 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!4 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.

MathewS24 months ago

How would you create a password to protect the website?

MathewS24 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?

MathewS24 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?

MobileGenius5 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: Garageleft.py and Garageright.py?

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 Thanear4 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?

1-40 of 126Next »