Skip to content

ajmath/garage-door-controller

 
 

Repository files navigation

Monitor and control your garage doors from the web via a Raspberry Pi.

Screenshot from the controller app   Screenshot from the controller app

Overview:

This project provides software and hardware installation instructions for monitoring and controlling your garage doors remotely (via the web or a smart phone). The software is designed to run on a Raspberry Pi, which is an inexpensive ARM-based computer, and supports:

  • Monitoring of the state of the garage doors (indicating whether they are open, closed, opening, or closing)
  • Remote control of the garage doors
  • Timestamp of last state change for each door
  • Logging of all garage door activity

Requirements:

Hardware

Software

  • Raspbian
  • Python >2.7 (installed with Raspbian)
  • Raspberry Pi GPIO Python libs (installed with Raspbian)
  • Python Twisted web module

Hardware Setup:

Step 1: Install the magnetic contact switches:

The contact switches are the sensors that the raspberry pi will use to recognize whether the garage doors are open or shut. You need to install one on each door so that the switch is closed when the garage doors are closed. Attach the end without wire hookups to the door itself, and the other end (the one that wires get attached to) to the frame of the door in such a way that they are next to each other when the garage door is shut. There can be some space between them, but they should be close and aligned properly, like this:

Sample closed contact switch

Step 2: Install the relays:

The relays are used to mimic a push button being pressed which will in turn cause your garage doors to open and shut. Each relay channel is wired to the garage door opener identically to and in parallel with the existing push button wiring. You'll want to consult your model's manual, or experiment with paper clips, but it should be wired somewhere around here:

![Wiring the garage door opener]

Step 3: Wiring it all together

The following diagram illustrates how to wire up a two-door controller. The program can accommodate fewer or additional garage doors (available GPIO pins permitting).

enter image description here

Software Installation:

  1. Install Raspbian onto your Raspberry Pi

    1. Tutorial
    2. Another tutorial
    3. And a video!
  2. Configure your WiFi adapter (if necessary).

    From here, you'll need to be logged into your RPi (e.g., via SSH).

  3. Install the python twisted module (used to stand up the web server):

    sudo apt-get install python-twisted

  4. Install the controller application

    I just install it to ~/pi/garage-door-controller. You can install it anywhere you want but make sure to adapt these instructions accordingly. You can obtain the code via SVN by executing the following:

    sudo apt-get install subversion

    svn co https://github.com/andrewshilliday/garage-door-controller/trunk ~pi/garage-door-controller

    That's it; you don't need to build anything.

  5. Edit config.json

    You'll need one configuration entry for each garage door. The settings are fairly obvious, but are defined as follows:

    • name: The name for the garage door as it will appear on the controller app.
    • relay_pin: The GPIO pin connecting the RPi to the relay for that door.
    • state_pin: The GPIO pin conneting to the contact switch.
    • approx_time_to_close: How long the garage door typically takes to close.
    • approx_time_to_open: How long the garage door typically takes to open.

    The approx_time_to_XXX options are not particularly crucial. They tell the program when to shift from the opening or closing state to the "open" or "closed" state. You don't need to be out there with a stopwatch and you wont break anything if they are off. In the worst case, you may end up with a slightly odd behavior when closing the garage door whereby it goes from "closing" to "open" (briefly) and then to "closed" when the sensor detects that the door is actually closed.

  6. Set to launch at startup

    Simply add the following line to your /etc/rc.local file, just above the call to exit 0:

    (cd ~pi/garage-door-controller; python controller.py)&

  7. Using the Controller Web Service The garage door controller application runs directly from the Raspberry Pi as a web service running on port 8080. It can be used by directing a web browser (on a PC or mobile device) to http://[hostname-or-ip-address]:8080/. If you want to connect to the raspberry pi from outside your home network, you will need to establish port forwarding in your cable modem.


When the app is open in your web browser, it should display one entry for each garage door configured in your `config.json` file, along with the current status and timestamp from the time the status was last changed. Click on any entry to open or close the door (each click will behave as if you pressed the garage button once).

TODO:

This section contains the features I would like to add to the application, but do not currently have time for. If someone would like to contribute changes or patches, I would be all to happy to incorporate them.

  • Security: Impose a configurable password on the web service. Would need to discuss the best strategy (i.e., should we require the pw every time, or can the session persist on any given device which has authenticated).
  • New Feature: Add a "close all" button to the bottom of the page to close all doors that have a state other than "closed" or "closing"
  • Configuration: Make the port number a configuration option
  • Occupancy sensors: Add proximity sensors to check if car port is in use
  • IFTTT Integration: make a smooth secure way to call the door and get information online

About

Software to monitor and control garage doors via a raspberry pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 54.5%
  • Groovy 25.9%
  • JavaScript 16.7%
  • HTML 2.9%