Arduino Controlled Garage Door – Part 1

Robotics and automation is a lot of fun as a hobby, however it can also be a great tool to solve common problems. Being fairly new to Aurdino and robotics, one area that seems within reach as a beginner’s project is home automation. I recognize that I’m not going to wake up one morning and be ready to deploy a system like SARAH from Eureka, but taking baby steps towards that goal seems like the best way to gain valuable experience and learn the challenges associated with such a system. The ice breaker project I’ve decided to use as a kickoff is a control mechanism for my 2 garage doors.

Current setup

The current setup I have in my garage is 2 Craftsman garage door openers. They are controlled through a set of wireless remote controls as well as a button wired directly to the units that allows the doors to be opened and closed from inside the garage.

garage door openergarage door buttongarage door remote

I want to leave the wireless modules alone, so I’ll be connecting to the wired connection for this project. On some initial testing I discovered that the 2 wire cable connected to the button on the wall is a 25v/2mA powered connection. When the button is pressed it connects the 2 contacts and the door opens, closes or stops. The relays I have are capable of handling 30v at 3A so this was a great fit.

Adding functionality

The main purpose of this project is to develop a system to detect if the garage doors are opened or closed (a problem my wife and I often encounter after leaving the house – did we remember to close the door?) and to be able to open or close the doors from anywhere, perhaps through an app on our smart phones.

This is really a 3 part problem

  1. Create a module that can open and close the doors
  2. Setup Arduino Ethernet to control the module remotely
  3. Develop a way to detect if a garage door is open or closed

Garage Door Control Module

With that in mind my first step is to build a permanent version of the I2C relay circuit from the Relay over I2C article. This modified version will need connect the door opener button circuit. The existing button will stay in place as a manual override (just in case the Arduino based system is not working).

The materials I used are:

Here is what the module looks like:

Relay Control Module - TopRelay Control Module - Botton

As a side note this is the last time I’ll try to solder a board like this, I’m going to have to test out the laser printer method to create a PCB next time.

This is a modified version of the code used in the relay article. When the module received a “1” or “2” over I2C it will switch on the appropriate relay then turn it off.  This essentially simulates a button press.

// Garage Door Control Module
// Fork Robotics 2012
//

#include "TinyWireS.h"                  // wrapper class for I2C slave routines

#define I2C_SLAVE_ADDR  0x26            // i2c slave address
#define RELAY1_PIN         3
#define RELAY2_PIN         4

void setup(){
  pinMode(RELAY1_PIN,OUTPUT);
  pinMode(RELAY2_PIN,OUTPUT);
  TinyWireS.begin(I2C_SLAVE_ADDR);      // init I2C Slave mode
}

void loop(){
  byte byteRcvd = 0;
  if (TinyWireS.available()){           // got I2C input!
    byteRcvd = TinyWireS.receive();     // get the byte from master
      switch (byteRcvd) {
        case 0x01:
          Press(RELAY1_PIN,500);
        break;
        case 0x02:
          Press(RELAY2_PIN,500);
        break;
      }
  }
}

void Press(int RELAY,int ontime){ // poor man's display
    digitalWrite(RELAY,HIGH);
    delay (ontime);
    digitalWrite(RELAY,LOW);
    delay (ontime);
}

The code for the Arduino is the same as the one used in the Relay Control over I2C article.

Here is a video of the initial testing:

Next steps

At this point this module is still a very manual proposition. The module needs to be attached to an Arduino that in turn needs to be connected to a computer. The next step will be to create a web based interface to control this (and others in the future) module.

2 thoughts on “Arduino Controlled Garage Door – Part 1

  1. That’s really cool! I’m wondering though… why not code in a timer on the arduino so it will automatically close after being open for 10, 20, or 30 minutes? That way it really doesn’t matter if you forgot to close the door. Unless you want to build all of the cool features through your phone. I’m all for that too.

    Also, a friend of mine has used http://dorkbotpdx.org/wiki/pcb_order for getting professional quality PCBs. That would be really slick to make the system clean.

    • At this point the module I built is really just a dumb endpoint that takes commands from the Arduino. The next step is to use an Ethernet Shield to make it easy to control. If I were to do a timer I would probably implement it at that level. It’s a pretty good idea as an optional function.
      That place to order PCBs looks pretty good. For those prices it might not be worth leaning the etching method.

Leave a Reply