OpenWRT Garage Door Controller

Written by Justin Goetz -

This is a quick tutorial for turning an OpenWRT router into a garage door controller. In this tutorial, I will be using the MT300N from GL-Inet to control my garage door over WiFi.

First, you'll need to SSH into the router. We need to edit the file /etc/rc.local. In this file I will put the following lines before exit 0:

/bin/echo 44 > /sys/class/gpio/export
/bin/echo "out" > /sys/class/gpio/gpio44/direction

The first command enabled GPIO pin 44. The 2nd line sets the GPIO port as "output", what we will use to control the relay. Now reboot the router.

Next, lets wire up the relay to the router. For my MT300N router, I used GPIO port 44 (labeled as LINK4 on the router board). Conect GPIO pin 44 to the "IN" pin on the relay. Now, connect GND to GND on relay, and connect the 3.3v pin on the router to the VCC pin on the relay. Here is a wiring diagram:

Now to test if it works, run the following commands. To turn the relay ON, run:

/bin/echo "1" > /sys/class/gpio/gpio44/value

The green light on the relay module should turn on, and you should hear a click. Now to turn the relay off, run:

/bin/echo "0" > /sys/class/gpio/gpio44/value

and the green light will turn off. If this works, your relay is wired correctly.

Now we need to install PHP to run the commands from a web interface. Run the following commands in order to install PHP to your router.

opkg update
opkg install php5 php5-cgi

Now edit /etc/config/uhttpd to enable PHP. Right below the first block of text, add the following lines:

        option interpreter '.php=/usr/bin/php-cgi'
        option index_page 'index.php index.html'

And now restart uhttpd.

/etc/init.d/uhttpd restart

Now lets create a quick script to turn the relay on, wait 1 second, then turn the relay off again. This simulates someone pressing a button to make the garage door open. I wrote this quick and dirty bash script to do just that. I saved this file to /root/

/bin/echo "0" > /sys/class/gpio/gpio44/value
sleep 1;
/bin/echo "1" > /sys/class/gpio/gpio44/value

And lastly, lets create the quick PHP page to run this shell script. I put this file in /www/garage.php. Here is a link to the script:

Lastly, we need to wire the relay to the garage door opener itself. This process in concept is simple, you just need to find the two screw terminals on your garage door opener that connect to the garage door button, and wire them to the NO and COM ports on your relay.

Now, when I navigate to http://router-ip-here/garage.php, I can activate the relay, opening my garage door.

A picture of the final setup:



Written by etanayewa - - <a href=""></a>
Written by efuwojac - - <a href=""></a>
Written by obehihaz - - <a href=""></a>
Written by uzagusipuh - - <a href=""></a>
Written by unuqimicima - - <a href=""></a>
Written by omnohajaodura - - <a href=""></a>
Written by auxmiqcap - - <a href=""></a>
Written by AenligeRance -

This condition is pretty limited by the reproductive system and could have several causes for example a response to injury or abnormal the circulation of blood inside testicles. He is content, along with the complete opposite of our thoughts later years has in store for us. <a href=""></a>
Written by kamagra gold -

kamagra 100mg reviews <a href="">kamagra oral jelly 100mg sildenafil citrate</a> kamagra oral jelly kaufen wien <a href="">buy kamagra online</a> kamagra 100mg tablets usa kamagra oral jelly buy online
Written by VigianRaf -

real online casino <a href=>online casino games</a> casino movie online <a href="">casino online</a> casino online