Introduction: Arduino WiFi Garage Door Opener

Ever come home in the rain to find the door locked and your keys elsewhere? No? Lucky you then! For those who have had such an experience or never wish to, this project will let you open your garage door with nay but a smartphone/tablet/laptop/WiFi-thing and your super secret password! After all, who leaves their smartphone at home nowadays. The very idea!

All it takes is a network capable Arduino, a relay, a long network cable and a few other bits 'n bobs like wire and a soldering iron.

So how does it work? I'm so glad you asked! The Arduino hosts a little web page on your local network which you can access from any other device on the network, such as your smartphone, just like a normal website. When you input your password, the Arduino triggers a relay that acts like a wired garage door remote that you often see next to the internal door. This sets the garage door opening mechanism into motion, letting you through with the a new felt sense of control over your home!

So, shall we get started then?...

Step 1: Needed Things


  • A Freetronics EtherTenor other network capable Arduino board -This is the brains of the operation. It hosts the web page you connect to when you want to open the door and triggers the garage door opener (via the relay) when the correct password is entered.
  • A Relay Board to activate the opener - This acts like a wall switch or button but the EtherTen 'pushes' it instead of you. In this case it will emulate the switch in the wall mounted or portable remote that you currently use to open the garage door. This can work alongside the existing buttons and remotes. Either buy one such as this one from dealextreme that I used in my case or make your own with: a relay, a transistor (any small signal one such as a 2N2222 or 2N3904 should do) to turn the relay on and off, and a flyback diode to protect the transistor and EtherTen from the voltage spike generated by the inductive load of the relay coil when it is turned off (such as a 1N4001).
  • A Case -For those with access to a 3D printer or who feel like giving a 3D printing service such as Ponoko, i.materialise, Sculpteo or Shapeways a try, you can make the "EtherTen Enclosure" used in this project. This is available on this projects GitHub repository will house both the Freetronics EtherTen and dealextreme relay board nicely. Just hit the "Download ZIP" button on the bottom right to download it and other necessary project files. You will need to print off a top, a base and 4 clips. To mount things together you will need 12, M3 sized, 6 mm long (shaft length) screws and an M3 tap or 12 self-tapping screws of the similar size. Sometimes I've gotten away with using 'normal' (machine) screws instead of self -tapping but it depends on how soft the plastic is. The reason four of the screws that can be seen in the image above are plastic is so that the colour matches the case and looks nice.
  • A Connector andDual Conductor cable to go between the relay board and the opener or remote you wire it to - I used a 3.5 mm jack and plug usually used for audio equipment and some thicker than needed wire. The length of wire required depends on the distance between the opener or remote you will wire into, as informed by the next step, and the nearest convenient spot to place the box containing the relay board and EtherTen. If you are truly averse to soldering you could omit this and instead open the box up and unscrew the terminals each time you wish to disconnect it.
  • Three Male to Female Jumper Wires to connect the relay board to the EtherTen with.
  • Network Access - This can be a long Ethernet cable as in my case or an old wireless access point or router.
  • A Power Supply to power the EtherTen. This needs to be around 6-9 V DC (7.5 V ideally) and at least 300 mA for the EtherTen to be happy. See Appendix A (Step 10) for how to check if any old wall plug packs that might be lying around will do the job. Advanced makers may be able to get some Power over Ethernet (PoE) thing to work instead but that is beyond my knowledge.

Tools that will be needed are:

  • A multimeter
  • Flat head and philips screw drivers
  • A ruler

Tools that will be useful are:

  • A pair of pliers
  • A wire stripper
  • A soldering iron

Step 2: Check Your Opener

Before getting started you should find the best way to connect to your garage door opener.

Option 1, terminals on the opener: Take a look at the garage door opener its self. This is the box that houses the motor and usually makes a loud hum when operating. On this there is usually several terminals for connecting other bits and pieces. Find the ones used for a wired remote. In my case they are labeled P B (likely short for "push button") and GND (short for ground) but are most easily identified by the wires connecting them and the remote. If your opener doesn't have these, your only choice is option 3. To test these terminals for suitability grab a multimeter and measure the voltage across the two terminals. If you get a nice low value like the 3.66 V I obtained, it should be safe to connect the relay to these terminals. Any voltage in the 100-240 V region is far too high. If you don't already have a wired wall remote, use this as your connection point and go to the next step. Otherwise go to option 2.

Option 2, the wired remote: If you do have a wired wall mounted remote, usually found on the wall by the internal door of the garage, it may be a more convenient connection point. Carefully pop off the cover and see if the points where the wires from the opener terminate are easily accessible as in image above. If so then connecting the relay here should function just the same if you were to connect it to the terminals on the opener its self but will save having to run another pair of wires to the opener. This is where I chose to connect to in my case. If this will work for you then choose it as your connection point and go to the next step. Otherwise use the terminals on the opener or as a last resort the method described in option 3.

Option 3, the wireless remote (advanced): If your opener lacks wired remote capability or it's tricky to connect the relay to the opener or wired remote, a wireless remote is the remaining, more advanced, option. These differ significantly by manufacturer but as long as it has a button you can push to open the door, it should work. Open it up and see if you can get at the legs of said button. Soldering one of the wires from the relay to each side of this should do the job. If it has four legs things get more complicated. Use the continuity function of your multimeter to find the pairs of legs are electrically on the same side of the button. These are connected to the other pair of legs only when the switch is pressed. Solder one of the relay wires to each pair, so that the pairs are connected either when the button is pressed or when the relay triggers (closes).

Once you have chosen a place to connect our device to, find a convenient spot to put it. Every situation is different. The device needs a network connection, power, and of course, a connection to the opener or remote. Choose a spot that you can route these things to with the least difficulty. In my case I used a wired wall remote that was handily near a mains power socket, so I put the device on the bench that was under them.

Now we know how we will connect to the opener, it's time to do some soldering!

Step 3: Soldering

Time to solder up our relay-to-opener connector. If this is a three leg 3.5 mm female connector like the one I'm using, the third leg is usually used to detect whether anything is plugged into it or not, something we have no interest in.

First we need to figure out which two legs to use. To do this take the plastic back off the male connector and stick the remainder in the female one. Use the continuity function of your multimeter to find out which legs on the female connector connect to the two legs of the male connector. If the male connector has more than two legs, use any two that connect to legs on the female side. Take note of which legs connect through so we can solder to them.

Second, we solder some wire to the female connector to go to the relay. To do this, cut a section of wire to go between the female connector and the relay board from the stuff to be used to connect to the opener/remote. For the 3D printed case that goes with this project I recommend 140 mm. Solder this onto the useful legs of the female connector. The recommended method is to separate the conductors, strip the insulation back about 5 mm, 'tin' the connector legs and wire ends by melting some solder onto them separately, then solder each wire to its corresponding leg.

Finally, we solder the wires that will connect to the opener or remote to the legs of the male connector. This is much the same as for the female connector but you may have to cut one wire shorter than the other if, like me, you're not using coaxial cable. Remember to clamp the metal fins around the cable if you have them as it will take any strain put on the cable instead of the solder joints.

Now that we've done the messy stuff, it's time to bring things together!

Step 4: Mounting the Parts in the Case

The below instructions apply to the 3D printed case designed for this project. If you intend to use/make your own case or mounting medium skip to the next step.

Unscrew the panel mounting ring from the front of the female connector we just soldered up and push it through the round hole in the top half of the case until you can get the mounting ring back on from the outside. Tighten this up and the connector should be securely mounted.

In my case the hole was too small so I put the case in a vice with some cardboard and drilled the hole bigger. The hole has since been made bigger in the 3D model available so this should no longer be a problem.

If you're using a tap and machine screws, thread the four free standing and the taller of the pairs of internal mounting pillars. Pop the relay board on the four free standing ones and screw it down. For the EtherTen you need to line it up on the lower of the pairs of pillars and then insert the four 3D printed mounting pins. The pin part goes through the EtherTen mounting holes and into the lower pillars. The hole part goes over the taller pillars which you then screw down as seen above.

Now the components are mechanically connected, our next task is the electrical connections and closing the case!

Step 5: Wiring It Up

First connect the relay board to the EtherTen using jumper wires. The S (signal) pin on the relay board connects to the Digital I/O socket 7 on the EtherTen, the + pin to a +5V socket and the - pin to a GND socket.

Next connect the wires from the case mounted relay-opener connector to the two screw terminals on relay board that are either side of the "NO" (normally open) text. Which wire goes in which doesn't matter, what does is that only when the relay is activated that they will be connected.

Now the internals are done, put the lid and the base together and secure the lid on by screwing the remaining four screws into the holes on the sides of the case.

Now that the hardware is ready, it's time to setup the software.

Step 6: Downloads and Arduino Program Explanation

If you haven't already, head over to the Arduino website and download the latest version of the Arduino IDE. At the time of writing this is version 1.0.5. While that's downloading head over to the EtherTen drivers page and follow the install instructions including doing the board and port selection part under the "Eleven, EtherTen, USBDroid" heading once the Arduino IDE has installed. The standard Arduino drivers also seem to work fine for our purposes but the Freetronics instructions are good.

(An alternative to the Arduino IDE for the adventurous is the experimental Visual Studio Arduino build tool detailed here)

Head here to download and install the trial of MegunoLink Pro, a useful piece of software we will use a few steps ahead to communicate with the program we will upload to the EtherTen.

The source code for the Arduino program and the MegunoLink interface file is on the project GitHub. If you have not already, click on the "Download ZIP" button in the bottom right to download all the files. Extract them when the download finishes. If you are just interested in getting the thing going and not what each part of the code is, skip to the next step, otherwise read on.

The Arduino program for this project consists of several parts:

  • Program.cpp: This has the setup and loop functions which call functions from other files to run the serial command processing and the web server.
  • Webserver.h/Webserver.cpp: This handles the web server stuff such as supplying the form where we will enter our password and checking the entered password is correct.
  • CommandProcessing.h/CommandProcessing.cpp: This handles the processing of incoming serial commands, triggering the required function(s) to make the right things things happen.
  • PasswordManager.h/PasswordManager.cpp: This saves and loads the passwords from the EtherTen's EEPROM (storage memory). It also impediments the grace period that gives us time to shut the door after us without having to re-enter our password.
  • AccessControl.h/AccessControl.cpp: This handles the triggering of the relay.
  • WebPages.h/WebPages.cpp: This provides the web page bits needed by the web server to make the interface we see when we log in.
  • HardwareConfiguration.h: This is an important one for us. It contains the MAC and IP addresses the EtherTen will use to connect to the network (which we will likely have to change) and the pin the relay is attached to.

These files are all tied together by GarageDoorOpener.ino.

CommandProcessing.h/CommandProcessing.cpp is the useful serial command library created by Steven Cogswell. The program uses this to decode the incoming serial commands and to send replies back.

Now we have the program bits downloaded and partially understood, its time to get it running!

Step 7: Arduino Program Compiling and Configuration

Time to get the program ready to be put on the EtherTen. Launch the Arduino IDE and go File>Open... then navigate to the extracted files from the project GitHub and look in the GarageDoorOpener folder for the file GarageDoorOpener.ino. Once opened, click on the tab selection button (square with down arrow) in the top right and select HardwareConfiguration.h. Scroll down until you see the line:

#define LOCAL_IP_ADDRESS { 192, 168, 15, 22};

The next thing to do is to find and input a valid and unique, static local IP address on your network that we can put in these brackets so we can connect to the EtherTen and always know where to find it on the network. To find such an address (assuming you don't know a valid IP address for your network off the top of your head) we can use a computer connected to the same hub/switch/router/'network thing' as the EtherTen will be. On a Windows machine (for others try "find local ip {your operating system}"), hit {windows key}+ R to open the run menu, type in "cmd" (no quotes) and hit OK to open the command prompt (Another way of doing this is to search from the start menu/screen for "cmd"). Once in the command prompt, type "ipconfig" followed by Enter.In the following data look for the IPv4 Address of the network adaptor your connected to the hub with. There are two parts of this address as far as we are concerned. The first part is the first three numbers (as underlined in blue in the above image) which varies between hubs. This part we copy directly into the brackets only with ,'s instead of .'s. The second part consists of the last number of the address (as underlined in yellow) and varies between devices connected to the same hub. This part we must change in order that we don't screw up the connection of another device that was 'legitimately' assigned its IP address. My recommendation is to take the number and add 100 to it, as long as the result is under 255, or just pick a random number between 1 and 255. In my case I couldn't be bothered changing it from 22 so I ended up with the address below:

#define LOCAL_IP_ADDRESS { 192, 168, 0, 22};

In the remote chance you use two EtherTen's running this program on the same network you should change this and the MAC address to make it local network unique.

Assuming the EtherTen is connected over USB and you have selected the correct board and port as in the EtherTen driver instructions, you should now be ready to upload the program. Hit the Save button (down arrow with "..." underneath in a square) followed by Upload (right pointing arrow in a circle). If this is successful, well done! If not, try putting the resulting error message through the search engine of your choice.

Before moving on, check your IP address setting works by opening up a web browser and typing in the IP address you entered in HardwareConfiguration.h like you would for a normal website except without any "www." business. If it works you should see a page like in the image above, fantastic! If not:

  • Check the lights on the EtherTen network connector are on, if not you may have a bad connection to the hub or there is not enough power being supplied (such as if running off USB) to run that part of the EtherTen
  • Try a different IP address in HardwareConfiguration.h
  • Check your hub settings

At this point you may want to make a bookmark or a note of this IP address on your smartphone so you don't have to remember it.

We have a working EtherTen, great! Now we need to establish communications and input some super secret passwords!

Step 8: Connecting to the EtherTen

To talk to the program on the EtherTen instead of uploading a new one, we need a different piece of software. The software recommended for this is MegunoLink Pro as one of its best features is how it allows us to easily create a user interface with which we can interact with programs over serial communications, which I have done already.

Assuming MegunoLink Pro has been installed, launch "Garage door opener config interface.mlx", the project file containing the configuration interface, from the top level of the project files we downloaded from the project GitHub repository earier. As per the instructions contained in it, connect to the EtherTen, initialise the EEPROM, store a password and check it saved by listing the stored passwords. Once a password has been stored, load the program's web page using the IP address again and try the password. If successful, you should hear a satisfactory click from the relay and see the above page!

Now we have the controller ready to roll, all we have to do is plug it in!

Additional for the technically minded:

For those who would rather do things without the handy MegunoLink interface, the commands for the EtherTen program are as follows:

  • init-pwd\r This initialises the EEPROM for storing passwords, overwriting any that were previously stored.
  • list-pwd\r This will trigger a list of the currently stored passwords to be sent back over the serial connection.
  • set-pwd {NewPasswordSlot} {NewPassword}\r This stores the password specified to the slot specified (1-10).

Step 9: Installation

Time to hook it up! Run a long network cable from your hub to your spot for the EtherTen. Connect the wires from the male relay-opener connector to the control point of the opener system chosen in Step 2. As mentioned before, it makes no difference which of the two wires goes to a specific terminal as all the relay does is connect both ends to each other.

Finally, place the case housing the EtherTen and relay board in the chosen position and plug in it's opener connection, network connection and power supply.

And there you have it! You should now be able to open your garage door with your smartphone!

Step 10: Appendix A: Finding a Suitable Power Supply

The EtherTen needs a 6-9 V, DC, 300 mA or higher power supply with a 5.5 mm OD (outer diameter), 2.5 mm ID (inner diameter), positive center hole barrel connector. To those without much electrical knowledge the previous sentence would have made as much sense as a horse wearing a floral dress flying first class on a transatlantic flight. Luckily we don't need to understand it all to find a suitable power supply, we just have to match some numbers and a symbol.

If your looking around in a box of old power supplies, first collect all the ones which have connectors that will fit. Next look to the "Output:" line on each. These usually follow the format of: {voltage value}V {current type} {current value}mA. The EtherTen requires a voltage value of between 6 to 9 V (volts), 7.5 V being ideal, current type "DC" (direct current), and a current value of at least 300 mA (0.3 amps). DC is frequently represented by a solid line over a dashed line. AC, the current type we don't want as the output, is frequently represented by a squiggly line (~).

The final thing to check is that the center hole of the connector is the positive terminal. This is usually represented by a symbol of a dot inside 3/4ths of a circle, each with a line leading to either a positive or negative sign. The EtherTen needs one where the center dot is connected to the positive sign. If no such symbol is present but everything else is suitable, the EtherTen should come to no harm by you plugging it in to test. Those with confidence could always cut the cable and wire it back up reversed but it is not the ideal solution.

The above images give examples of four unsuitable power supplies and one that should work nicely (the first one). Things underlined in red make the power supply unsuitable. All the underlined output properties must be suitable (green) for the power supply to be suitable.

Arduino Contest

Participated in the
Arduino Contest