Garage Door Opener

DoorshotGetting stuck out in the rain without keys was the motivation for this project. It lets you trigger a garage door opener through a website hosted by an Arduino. With the Arduino connected to a wireless network, you can use your smart phone to connect to the webserver, enter a password, activate the garage door and get inside before getting drenched in the downpour. A MegunoLink Pro interface panel is used to configure the program: setting up to 10 passwords, which are stored in the device’s EEPROM.

For a step-by-step guide to building your own internet enabled garage door opener, check out our instructables article!

Hardware

The hardware is pretty simple: Dooropener

  • An Arduino Etherten – Fully compatible with the the Arduino Uno, the Etherten includes an ethernet module based on the Wiznet chip used in the official Arduino shield. You could also use an Arduino Uno + Ethernet shield or the Arduino Ethernet board for this project.
  • A relay to activate the garage door opener. Most garage door motors have a low-voltage switch near the internal door to the garage. The relay works in parallel with this switch so the Arduino can activate the door without disrupting normal operation. Make sure the switch is low-voltage and safe before wiring anything up.
  • A transistor turns the relay on and off. Any small signal transistor should do the job, such as the 2N2222 or 2N3904.
  • A diode across the relay protects the transistor when the relay turns off. The 1N4001 will do the job nicely.
  • A box to keep everything tidy. We designed a custom case in Blender, printing it on an Up! Plus2 printer. You can download the design and print files from our Arduino boxes page.

Here’s the circuit diagram if you’d like to build your own. You might like to use the relay board from Deal Extreme, instead of building up the circuit. The box we build fits this handy little board.

Arduino garage door opener schematic

The garage door opener uses a relay to activate the door motor.

Arduino Code

All the source code is available on GitHub. Copies of required libraries are in the “Libraries” folder. The project is setup to build using our Visual Studio Arduino build tool, and it will work in the Arduino IDE as well.

The Arduino (INO) file contains just a few includes; the rest of the program is spread across a few files:

MegunoLink Pro user interface for Arduino program

The interface panel created in MegunoLink Pro for the garage door opener. The buttons send the appropriate commands to the Arduino.

  • Program.cpp is the heart of the program. This is where you’ll find the setup and loop functions which initialize serial command processing and the webserver.
  • Webserver.h/Webserver.cpp handles the web server, returning the page requested by the user. It supplies a form requesting the password and checks the submitted password against stored passwords. We use the reliable Webduino library to create the web server itself.
  • CommandProcessing.h/CommandProcessing.cpp looks after processing of serial commands. The commands supported are:
    • init-pwd\r: initializes the eeprom ready to store passwords. Any saved passwords are cleared.
    • list-pwd\r: lists the passwords stored in the eeprom.
    • set-pwd [Password Slot] [Password]\r: saves a new password in the eeprom. Here [Password Slot], a number from 1 to 10, sets the slot where the password is stored and [Password] is the password to be stored

    We use the very nice serial command library created by Steven Cogswell to decode commands and a MegunoLink Pro interface panel to send them.

  • PasswordManager.h/PasswordManager.cpp takes care of storing passwords in the EEPROM and checking the password supplied is okay. The password manager implements a grace period so that you can open and close the door for a few minutes without having to enter the password again.
  • AccessControl.h/AccessControl.cpp is responsible for activating the relay to open or close the garage door.
  • WebPages.h/WebPages.cpp provides the page content for the website.
  • HardwareConfiguration.h contains definitions such as the MAC address and IP address for the website along with the pin the relay is attached to.

Configuration Interface

We used the Interface Panel and Serial Monitor visualizers in MegunoLink Pro to make a simple interface to configure the garage door opener through the Arduino serial port. By setting up controls in the Interface Panel, I don’t need to remember the serial commands any more. So push buttons were created to initialize the EEPROM and list the stored passwords. A number control was used to select the password slot and a text control used to enter the password. The configuration for each is given in the table below.

Control Name
Label
Send Command
Range
PswdInitInitializeinit-pwd\r
PswdListList Passlist-pwd\r
NewPasswordSlotNew Password Slot1–10
NewPasswordNew Passwordset-pwd {NewPasswordSlot} {NewPassword}\r
Control configuration for the garage door opener Interface Panel.
Artduino program control panel.

MegunoLink Pro Interface Panel and Serial Monitor visualizers were used to build a simple configuration interface for the garage door opener

Web Interface

The web interface is used to activate the garage door. It is accessed with any web browser using the Arduino’s IP address. The IP address is set in HardwareConfiguration.h and defaults to 192.168.15.21. All of the pages are generated by code in WebPages.cpp.

Entry Page

The first page users see when visiting the Arduino webserver is the index page where they are prompted for a password.

Login

Password Validation

The login form directs the user to a second page LetMeIn.html. In generating this page, the web server checks the users password and activates the garage door if a valid password is supplied. A grace period allows you to activate the door for a few minutes so it can be closed again without re-entering the password.

Controller (1)

The program also sends Door activated message out the serial port whenever the garage door is triggered. A simple access log can be created in MegunoLink Pro either with the Monitor or Log to File visualizers. By turning on the time-stamp, we can see when people are coming or going.

MegunoLink Pro access log with timestamp.

MegunoLink Pro used to record access to the garage with the Monitor visualizer. Time-stamping is turned on in the serial monitor adding the date and time to each line of the log.

Downloads mentioned in this article…

Why not download the resources mentioned in this article for your own projects?


Posted in Articles
22 comments on “Garage Door Opener
  1. pablo says:

    Nice Job. Works Fine. Now Tunning the HTML interface to make it colorfull, but cant use a background image on rserver :(

12 Pings/Trackbacks for "Garage Door Opener"
  1. […] Soon you are creating fascinating projects straight out of MAKE magazine such as the Raspberry Pi-powered weather balloon carrying a toy bear into the stratosphere or the Arduino-powered smart-phone enabled garage door opener. […]

Leave a Reply