Simple Garage Door Hack

29,452

101

25

About: To learn is to live!

After being accidentally locked out of my house on more than one occasion, I decided that there had to be better way to entering my home that did not involve breaking and entering (and without hiding a key outside somewhere).

On taking a look at my garage door set-up I noticed that the motor to open the garage door could be activated by simply short-circuiting two contacts. On seeing this I realised that a very simply solution would be to connect an esp8266 to a relay that I could then trigger (to open or close the door) by connecting to the esp8266 controller using my mobile phone.

Step 1: Materials, Tools & Software

Materials

Tools

  • Soldering Iron
  • Solder
  • Heat-shrink tubing
  • Wire-strippers
  • Connecting wire
  • 3D Printer
  • Star screwdriver
  • Pliers

Software

Step 2: Coding

The following library was added to the Arduino IDE: https://github.com/Links2004/arduinoWebSockets.git. Also if you have not already added the esp8266 library then this needs to be done as follows:

  • Go to File > Preferences. In the "Additional Boards Manager URLs" field, type (or copy-paste) http://arduino.esp8266.com/stable/package_esp8266... and click ok.
  • Then go to Tools > Board > Board Manager. Type "esp8266"
    in the search field. The entry "esp8266 by ESP8266 Community" should appear. Click that entry and look for the install button on the lower right.

Not much more needs to be added here other than the code I used (GarageDoorHack-Final attached) was taken from https://gist.github.com/bbx10/667e3d4f5f2c0831d00b and modified slightly to accommodate what I needed to do i.e. to briefly trigger a relay when a button was click.

With reference to the code, make sure that you update the following lines to reflect your wireless SSID and PASSWORD:

  • static const char ssid[] = "SSID";
  • static const char password[] = "PASSWORD";

using the serial monitor (once you have uploaded the code) you will be able to see what IP is allocated to the NodeMCU.

One last point that is worth noting is that my NodeMCU board appeared to have the pins assigned differently to what is mentioned online i.e. my GPIO05 was pin 5 where as the the online reference that I was using said that it was 1 (or maybe my GPIO pins where assembled in a different order). Whatever the case, I had to use some trial and error before a could determine which pin was actually GPIO5.

Step 3: Putting It All Together

Steps followed:

  • I clipped off all the NodeMCU pins that I was not using (yes I could have unsoldered them but I found this easier).
  • Soldered connecting wires onto the relevant pins (as be diagrams and photos above), using heat-shrink tubing to insulate the connections.
  • 3D Printed the case (STL files attached; the FCSTD file is the FreeCAD file).
  • Screwed the NodeMCU board down. The screws that I had were too long and so a used pliers to snip them shorter.
  • Pushed the top of the relay into the square holder in the lid which held it firmly in place. The orientation was such that the relay contacts faced the wire exit hole in the lid.
  • Attached the lid and screwed it closed.
  • Connected the relay wires to the garage door motor terminals.
  • Plugged the project into the USB power source.
  • Waited for the NodeMCU to authenticate with the wireless.
  • Browsed to the IP address from my phone.
  • Tested by pressing the button.

The threaded screws that I had worked well but self-tapping ones would have been easier to work with.

Step 4: Final Comments

The following falls outside the scope of this Instructable but are worth discussing:

IP Address

By default your router will issue random IP Addresses meaning that your device might not always have the same IP which would then make it very difficult to find and access from your phone. It is therefore important that you assign it a fixed IP. There are two main ways to do this, each with their own pros and cons. My preference is to allow the router's DHCP server to do this. The general steps to follow when using this method are:

  1. Log onto your router as an admin.
  2. Look at the DHCP logs and record the MAC address associated with the IP address that was issued to your NodeMCU.
  3. Find the menu option that allows you to set IP reservations. Here you will be able to specify a MAC address and the IP that you wish this MAC address to always to get.

I usually do the above as early as possible in my projects.

Creating a shortcut on your phone

  • Make sure that you are connected to the same wireless network as your device.
  • With the IP address now fixed you should be able to browse to it on your phone.
  • Save the IP as a bookmark.
  • Save the bookmark to your phone's home page.

Security

Anyone connected to your wireless network will be able to browse to this IP and trigger the relay. To do this they will then have to know your Wireless SSID and password. For the average user this is probably enough security. If you wanted a higher level of security you could implement some sort of MAC filtering on your router or a standalone server or you could try a two-factor authentication approach. This said, if someone knows how to hack your network then they probably know how to hack all of the above solutions too. Further if they are really that keen to get in they will probably simply break in.

In short if you live in a low risk environment then you probably have nothing to fear. On the other hand if you live in a high risk environment then you probably have more important things to worry about and a garage door hack.

Having said all of this, the following project is more of a proof-of-concept project and not meant as a full-scale production implementation. Anyone implementing this project does so at their own risk.

Closing comments

Sometimes the connection to the NodeMCU appears to get lost. When this happens you just need to refresh the webpage and it should reconnect successfully.

And lastly, instead of connecting the controller directly onto the door motor, I could have wired it in parallel with the manual switch in the garage. While this would have enabled me to hide the circuitry in the wall, I would have then had to make another plan with respect to powering the device. The power issue would have been relatively easy to solve but for the time being I did not feel that the effort would be worthwhile.

All in all this is a simple and cheap project that I enjoyed completing.

Share

    Recommendations

    • Fandom Contest

      Fandom Contest
    • Beauty Tips Contest

      Beauty Tips Contest
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    25 Discussions

    6
    None
    TomC162

    2 months ago

    I've run a pair of wires from the inside button (again a simple switch) to an outside wall where I drove two nails thru the wall with the wires connected to them. One can then go to this "secret" location on the outside and complete the circuit with a coin. Easy/Peazy!

    1 reply
    0
    None
    Bonez3

    2 months ago

    Last I was aware openers came with remotes ( optional keychain remote) , a keypad and automatic phone connection. Hmmm

    2 replies
    0
    None
    abaselBonez3

    Reply 2 months ago

    Ours only has two remote that I don't want to have to carry around. It's an old system hence no phone connection or keypad. My solution gives anyone in my family/friends group the possibility of entering without needing remotes or numeric codes. This said yip there are flashier solutions out there but maybe not at my price point :)

    0
    None
    abaselBonez3

    Reply 2 months ago

    Yes you are 100% correct. I have two of them but I don't carry them; just makes my keys too bulky. I do always have my phone though :)

    0
    None
    Jimmymm

    Question 3 months ago on Introduction

    Great project. Thanks for sharing!

    One question, when triggering the relay to open/close the door, do you simply toggle the relay, or does it require both an open and close to trigger the door?

    2 answers
    0
    None
    abaselJimmymm

    Reply 2 months ago

    Simply toggle the relay :)

    0
    None
    abaselJimmymm

    Answer 3 months ago

    Glad that you enjoyed the project.

    I am not sure if all garage door motors work the same but mine works as follows: A single press and the motor engages. If the Door is closed it starts opening, if it is opening it stops, if it is half open then it starts going again in the opposite direction to what it was going. If open fully then the motor will start the close action. In short all that is needed is a single quick short. This is why I only activate the relay for half a second and the button is labelled "Open/Close".

    0
    None
    ardu11

    2 months ago

    Modern garage door openers do not operate with a single contact, they are much more intelligent and anyway, they include a wireless connection using a smart phone application. This works only for old systems. They also are sold with a keypad.

    1 reply
    0
    None
    onetruegodardu11

    Reply 2 months ago

    No, my new garage door has 2 contacts on the main board with are for "test" and simply shorting them operates the door. So this instructable is quite valid. Well done Abasel!

    0
    None
    merlinmb

    Tip 2 months ago on Step 4

    Great project. I had built something similar with a MQTT subscription, which then allows you to run mosquitto and Homebridge on a Paspberry Pi for iOS & Siri door open & close.
    One other suggestion: I successfully added a reed switch to the door and wired that into the ESP to show if the door is open or closed: handy if you forget to close it when you go to sleep and couldn't remember if you left the door open.
    On you're losing connection - make sure to check your wifi connection status every 30 seconds in loop() and and force a reconnection.

    2 replies
    0
    None
    neptuno555merlinmb

    Reply 2 months ago

    Nice project, but it relies on WIFI being always active in the home. A more elegant project would make use of Photon or other phone conection method, and connect directly to the GSM network at both ends.

    0
    None
    abaselmerlinmb

    Reply 2 months ago

    Cool; also thanks for the connection suggestion.

    0
    None
    abaselJeffM15

    Reply 2 months ago

    Yeah that would be even better; thanks for sharing :)

    0
    None
    JonW75

    2 months ago

    The clever suggestions as to why you should not even have done this project aside, I thought it was a very nicely done step by step project for showing how to use the NodeMCU. Great Work!

    1
    None
    ggallen103

    2 months ago on Step 4

    assuming you have your phone!

    Another interesting method - would be to put a microphone type sensor onto one of the door panels, and then program a custom knock code - number of knocks, spacing between knocks. This way random noises wouldn't trigger your garage - and wouldn't have your current sensor depend on the internet / home network - and still be fairly cheap

    2 replies
    0
    None
    abaselggallen103

    Reply 2 months ago

    I like the idea :) Although you would then need to run a cable to the door. You would also need to knock quietly so that the neighbors don't hear (well that is if you live in a high density area). But as a concept; I think I will think more about this one :) Thanks

    0
    None
    Betaforce

    3 months ago

    Isn't it simpler to hook up a keypad outside the door?