The goal of the project is turn your garage door into an Internet of Things (IoT) controlled device, i.e., be able to open/close the door and check status from your phone (iPhone, Android, etc). While there are many projects for this on the internet and even some commercial devices, this one differs in that it can provide feedback to your phone on the actual status of the door (open or closed) and it also integrates with IFTTT.com which allows for lots of automation possibilities - like using your device's GPS location to automatically open or close the garage door when you leave or arrive at home.
The core of the system is an Arduino (the brains) and the innards of a Belkin WEMO switch (Amazon WEMO Switch). The Arduino runs a small chunk of code to monitor the door state, handle the state of the WEMO, and send commands (toggle the door) to the garage door opener.
The WEMO board is a cheap wifi connected internet of things device with a nice App for your phone, integration with IFTTT and a large following. I have seen other people use other WIFI connected systems but by using the WEMO you get to piggy back on their ecosystem of Apps and 3rd party integrations.
In addition to the Arduino and WEMO switch, you will need a Darlington Transistor (or a relay) which allows the Arduino to control the higher voltage garage door contacts (typically a momentary close on the contacts triggers the door to change states). And you will also need two Magnetic Switches which can sense the door state (whether it is open or close) and transmit that to the Arduino. You can also use other ways to sense the state of the door like Hall Effect sensors, tilt sensors, light beams, and more.
PS: You may notice a round speaker looking thing in one image. This is actually a 5V buzzer. I thought it was a good idea to beep the buzzer a few times when the garage door was about to move to give people a heads-up. This buzzer gives a short delay (5 seconds) and a beeping sound only when the garage door is being controlled by the Internet (iPhone, Android, IFTTT automation, etc). Just seemed safer this way.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What You Need to Buy
- WEMO Switch $40-50
- Arduino Uno Rev3 Board (or likely any Arduino will do) $25
- Darlington NPN Transistor $1.50 or a Relay $2-$5 - I like the Darlington as it is cheaper and solid state and easier to wire up but depending on your specific garage door, a relay may be a better solution (Genie Garage doors have a lower contact voltage and a Darlington can not bring it close enough to ground to to the diode drops).
- Two Magnetic Switches/Sensors $8 each
- 9V 750mA to 1000mA wall wart power supply with barrel connector $6 or maybe you have one laying around
Total cost of parts around $70-80.
Step 2: Disassemble the WEMO Device
First step is to open up the WEMO switch. There are three screws on the back under a sticker. Once the device is open, separate the high voltage board (the one with the AC power prongs on it) from the low voltage board - there is a small white connector that should come apart easily. (The green board pictured is the WEMO low voltage board)
I chose to snip the leads from the high voltage board so I could re-use the white connector/wires (red/black/white). I think this makes hook up easier when it comes time to connect to the Arduino.
Step 3: Solder Wire to Momentary Switch on the WEMO Low Voltage Board
The WEMO Switch has a physical button that normally is used for a person to switch the WEMO on to off (instead of using your smart phone to do it over WIFI). We will use this button so that the Arduino can tell the WEMO to change states electronically.
Why do we need this anyway?
We will need a way for the Arduino to control the WEMO state. This so that the Arduino can keep the WEMO state (on or off) in sync with the garage door state (open or closed). Since the garage door can be open or closed by existing wall switches or car remotes, the Arduino will need to keep the WEMO state in sync with the door in the case that something other than your iPhone tells the door to open or close. This way the WEMO can actually report the garage door's status via the WEMO App properly. To do this, we need a way to electronically change the WEMO's state which the Arduino can do by changing the blue wire voltage from 0V to 5V and back which essentially simulates a button press.
In addition, to properly sync, we will also need a way for the Arduino to "see" which state the WEMO is in. The WEMO provides this via the "white wire" coming from the low voltage board which would normally be used to control the high voltage board in a normal (non-hacked) WEMO switch. In our case this will just be fed to the Arduino so it can see the WEMO's state on one of the Arduino's GPIO pins.
So, now that you have your WEMO low voltage board out, the next step is to very carefully solder a wire to the small push button switch. In the picture, I have soldered a blue wire. This wire will eventually need to run to pin 8 on the Arduino board but for now, just get a good solder connection to the very small contact on the lower left of the switch in the picture.
Note that with a little work, you can route the blue wire to the bulk head connector on the WEMO board as there is an extra, unused pin on the board. This is optional and you are more than fine running it directly to the Arduino 8 pin which is what I did the first time I built mine.
Step 4: WEMO Board Connector/Wires Explained
The WEMO board has three contacts via the plastic connector:
- Black Wire - Ground
- Red Wire - 5V Power
- White Wire - 0V (off) or 3.3V (on) which is the state of the WEMO
If you are using the plastic connector and the wires that used to go to the high voltage portion of the WEMO, now is a good time to strip the ends and tin the ends with solder.
Note: My pictures shows a second black wire at the bottom of the connector in the picture - this is actually connected to the blue wire from the momentary switch. As I mentioned earlier, the bulk head on the WEMO board had an extra pin available so I used that extra connector pin for the blue wire soldered to the WEMO momentary switch. This is optional...as you can simply run the blue wire directly to the Arduino board if you like.
Step 5: Arduino and WEMO Connections
Now its time to make all the connections between the Arduino and WEMO device according to the wiring diagram.
Note: The 350 ohm pull up resistors in the wiring diagram are really just internal to the Arduino as the Arduino board has pull up resistors we can enable via software. So just run those wires straight to the 5V power supply instead of through 350 ohm pull ups pictured in the diagram - the pull ups are still needed but we just use the ones internal to the Arduino instead of external ones.
- Connect the base of the NPN Darlington to Pin 12 on the Arduino.
- Connect the collector of the NPN Darlington to a wire that you connect to one of the two terminals of your garage door motor trigger. Connect the other garage door terminal to ground on the Arduino board.
- Connect the emmiter of the NPN Darlington to Ground (there is a ground pin right next to Pin 13 on the Arduino if you like)
- Connect the Blue wire you soldered to the momentary switch on the WEMO to PIN 8 of the WEMO
- Connect the Black wire from the WEMO to Ground on the Arduino board
- Connect the 5V Red wire from the WEMO to the 5V pin on the Arduino board
- Connect the White WEMO status wire to Pin 2 on the Arduino
- Connect up a pair of long wires for the first magnetic switch - one wire to Arduino Pin 6 for the CLOSED sensor and the other to Arduino ground. The opposite end of these long wires will connect to the magnetic switch terminals (the normally open)
- Connect up a second pair of long wires for the second magnetic switch - one wire to Arduino Pin 4 for the OPEN sensor and the other to Arduino ground. The opposite end of these long wires will connect to the magnetic switch terminals (the normally open)
- Find a good 9V ~1AMP "wall wart" power supply with a barrel connector (negative on the outside) and connect that to the Arduino to make sure it fits. We will power it all on later.
Step 6: Magnetic Switchs
Mount one magnetic switch such that it will trigger when the door is Open. I mount the magnet part to the door and the sensor with the terminals to a stationary part of the frame. Make sure they are aligned closely when the door is open. You can hear the switch trigger if you are quiet enough. Or measure with an Ohm meter. Wire the OPEN switch wires coming from the Arduino to this switch such that the switch is closed, the wires are shorted when the door is open (use the NO - Normally Open contacts for wiring)
For the CLOSED switch, do exactly the opposite. Mount the sensor so the magnet you used in the first part of this step will trigger the CLOSED switch when the garage is closed. (you do not necessarily need the second magnet that comes with the second switch as you can position the sensor side to make use of the same magnet for both open and closed). Wire up the wires coming from the Arduino for the CLOSED switch so that these wires are shorted when the door is closed. (use the NO - Normally Open contacts for wiring)
Note: I added a small 100nF capacitor across the switch terminals as I think I was picking up some stray RFI at times from the garage door motor which loved the really long wires (antennas) to/from the magnetic switches. This may be a good addition for your implementation if you have issues with the Arduino "hanging".
Step 7: Software: Arduino Code
The code for the Arduino is in a github repository and available here:
I tried to do a nice job coding the system as a Finite State Machine (FSM) with lots of comments so you can see what everything is doing and why. Hopefully this makes modification easier for you if you need to make a tweak. I first coded this with lots of if then statements, but it was a mess and did not work well all the time. The FSM is much cleaner and easier to follow and troubleshoot.
If you have not already, go to the Arduino home page and grab the IDE. Load up the code and then upload it to the Arduino.
Power up the Arduino which should power on the WEMO low voltage board. Load the WEMO App on your iPhone/Droid and get the WEMO board configured for your WIFI.
Mount the Arduino and WEMO somewhere in your garage. Connect it up to the garage door contacts if you have not already and also to the magnetic switches. I use a bulk head connector for mine to make hooking and unhooking easy.
Make sure all the wires are hooked up and start some testing.
If everything is working, then connect up your WEMO to IFTTT.com to allow for some serious automation.