Daily Archives: May 18, 2015

Raspberry Pi Can Open Your Garage Door from Anywhere

Using a Raspberry Pi, you can have a garage door that opens with a command from your smartphone. Additionally, if you are away from home, no matter how far, you can always keep a tab on whether your garage door is shut. The tiny, credit card sized single board computer, the Raspberry Pi or RBPi is used here as a small web server. The page served by this web server will give you a big red button when you access it via your favorite browser.

Pressing the red button will trigger the garage door via a relay. That needs a very simple circuit to be connected to the GPIO pins of the RBPi. The uploaded website will trigger this circuit, which in turn will trigger the relay. The relay contacts will close the circuit to turn the garage motor on and the motor will open the garage door. Another press on the red button will again trigger the connected circuits so that the garage door now closes.

You can use whatever RBPi model available. Additionally, you will need a Wi-Fi adapter, a power supply unit, a 5V relay, a 2GB SD card and some wires. On the SD card, install and optimize the OS Raspbian. This can be the shrunk version of Debian Wheezy – get the image here and follow the installation instructions. Just a tip – use gparted on any Linux computer such as Ubuntu, for format the SD Card to fat32, then dd to write the image on it.

Once the image is installed, plug the SD card in, connect the USB keyboard and hook up the RBPi to a suitable monitor. The first-boot of Wheezy will take you automatically to rasp-config. This tool allows you to stretch the partition and enable ssh. In case you do not want the GUI, use the apt-get command to purge x11-common and autoremove the rest – this will free up some space on the SD card.

Next, use the command line to set up the Wi-Fi so that you will be able to control the RBPi remotely via ssh – use this guide for Wheezy. If you are using the Mode A of RBPi, it has only one USB port. Therefore, for setting up the configuration, you will need your keyboard plugged in. Once the configuration is done, shutdown the RBPi, unplug the keyboard, then plug in the Wi-Fi dongle and reboot the RBPi.

If everything has been done perfectly, the Wi-Fi will be set up and the router will assign your RBPi with an IP address. This will be evident in the boot log of your RBPi if you have a monitor connected to it. Alternately, login to your router and look up the DHCP table. Login to your RBPi through ssh on your Linux PC – type ssh pi@[IP address of your RBPi], with default password as raspberry.

You will need to login, download, compile and install WiringPi – use this guide. This allows complete control of the GPIO pins on the RBPi. Follow the instructions here to control the relay using the RBPi.