Belkin WEMO Garage

18K4119

Intro: Belkin WEMO Garage

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.

STEP 1: What You Need to Buy

  1. WEMO Switch $40-50
  2. Arduino Uno Rev3 Board (or likely any Arduino will do) $25
  3. 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).
  4. Two Magnetic Switches/Sensors $8 each
  5. 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.

  1. Connect the base of the NPN Darlington to Pin 12 on the Arduino.
  2. 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.
  3. 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)
  4. Connect the Blue wire you soldered to the momentary switch on the WEMO to PIN 8 of the WEMO
  5. Connect the Black wire from the WEMO to Ground on the Arduino board
  6. Connect the 5V Red wire from the WEMO to the 5V pin on the Arduino board
  7. Connect the White WEMO status wire to Pin 2 on the Arduino
  8. 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)
  9. 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)
  10. 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:

https://github.com/cdhutzler/wemogarage

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.

19 Comments

I went ahead and did it the Arduino way, with a few notable changes :)

First, my soldering skills leave quite a bit to be desired (I ruined one Switch board trying to connect that one wire to that microscopic connection point), so I took a risk and used a Light Switch instead, and it works! There's also the added bonus of being able to use the switch itself in place of the ugly wall controls that came with the garage door openers.

Second, I went with relays instead of the transistors just because, and limit (leaf) switches instead of the magnetic reed type...

and finally I had to modify a bit of your code, but only swapping the '(GarageDoorToggle, HIGH)' for 'LOW' and vice versa.

Later, once I install it in a gang box and hide it/make everything look nice, I'll integrate the other door and some more logic.

Thanks for giving me the courage to jump in to this stuff with both feet... this is my first Arduino project, but definitely won't be my last :)

@danger355 Could you please post your code somewhere? I really like your solution utilizing the wemo switch. Thank you.

Excellent! I love that you used the light switch board - looks easier to work with. But same/similar wiring so not too hard to figure out I guess. I did open up one of the WEMO Insight Switches but the wiring is much different to I guess allow them to monitor power usage as well as controlled the AC load. I imagine the same wires are in the 8 or 10 wire bundle somewhere, but I did not poke around too much.

Relays are the right approach. Simple and cheap and work with any garage door. Transistors are cheaper and solid state, but require knowing a bit more about the garage door contacts - what voltage they run at and how close to a short they need to acknowledge a trigger. Believe it or not, Genie screw drive is different than Chamberlain.

You changed the code! No! ;-) Yup, if your leaf switches are normally closed (I think) you would need to change that code. Excellent.

BTW, where did you mount the leaf switch that senses door closed? I can see mounting the open one up top and having the door hit it when it is open. But not sure I can imagine the closed one and how it is mounted.

I am glad you had success with your first project! I am actually working on my next garage door opener thing using a Spark Core and trying to find a way to reduce the installation steps and wiring for the sensor switches to get closer to easy for the average joe. So far version 2.0 of the Hutzler Garage Door opener is working well in Alpha but much more to go :-)

Thanks :) The Light Switch is much easier to work with. I found a teardown of the Insight Switch online after I ruined the one board, and saw that it had the larger wire bundle. I made a Sunday trip to Home Depot to get one hoping the Change Status wire was in that bundle, but they didn't have an Insight in stock. But it wasn't a wasted trip - I noticed an open box Light Switch that had been returned and I got it for only $13. Score!

The leaf switches act just like the reed switches - they can be connected to either the NO or NC. The code was changed because (on mine anyway) the initial LOW state was triggering the relay as soon as it was connected or powered on, so the button was always 'being pushed'. (Granted, this still worked, just not the way it should. Swapping the states in the code fixed everything and it works as advertised.) For the record, I haven't actually used my leaf switches yet. The white 'ball switches' in the pics are what I'm using to simulate the door UP and DOWN states for testing.

The door down leaf switch? This one took a little bit of head work. Unfortunately I don't have a picture of it yet, but I'll try and describe it... so with the door down, I mounted a small aluminum plate on the inside of the door (vertically). On the wall inline with this plate, I mounted the leaf switch on a 1"x1"x2" piece of wood. I'm going to use some nuts and bolts attached to the plate to adjust the point in which the door will close the switch. I'll reply later with some pics.

I spent a little bit yesterday assembling most everything in a 4-gang outlet box, and it's coming along nicely. Just have to figure out a way/place to put the outlet and wall wart to power this beast. Good luck with v2.0, I'm sure it'll be great :)

I figured that might be roughly how you would mount the door closed switch. Cool.

BTW, very nice job with the mounting of the arduino, hook up blocks, etc. Professional! Makes me want to do mine again! :-)

Thanks man, I appreciate it, and I appreciate the code, too :)

I'm trying to have everything in the wall, so all you see is the panel with the WeMo's and a couple other buttons (The original wall controllers have a light button and an on/off switch to disable the controller). So now I've got two gang boxes: the 4- that you see above and a 3- that I'm putting an outlet in (I mounted the outlet on the top outside and drilled a hole so the plug itself is inside of the box.) along with the wall wart. I'm taking the boards out of the original wall controllers and using those contact points instead of going all the way to the motor. I'll also use these to wire up the extra buttons mentioned above.

The 3-gang box will be on the opposite side of the wall from the 4- in the laundry room - didn't want two huge panels next to each other. This box will also have a keystone USB port with the other end permanently plugged into the Arduino for flashing the code.

So here are the two leaf switches...

Love the USB keystone idea! You are building a model for everyone else. :-)

So I think the maker might do it all without the Arduino. If you can make due with just one sensor. And if the relay in the maker can be controlled to toggle your door switch contacts appropriately. It may all work and be simpler. But I think for two doors you would want two makers so you can see the state of each door separately, right?

cdhutzler, if you have time, could create a new instructables for using the wemo maker on a one garage door setup? Sounds a little easier. I have a liftmaster with their MyQ but they are not interested in improving their functionality or supporting IFTTT or Amazon Echo so I'm looking for alternatives.

I have not used the WEMO Maker but I have one and know how it works. There are many people on the 'net that have used them for garage doors. A Google search for "WeMo Maker Garage Door" will provide a lot of info like this one: http://community.wemothat.com/t5/WEMO-Maker/Wemo-Maker-Garage-Opener-and-Sensor/td-p/2040

It does require you to understand electronics a bit but it is not hard.

If you do not understand electronics, I would suggest looking at a device like the https://garageio.com which does support IFTTT.

Nice project - I'm going to try this out myself soon on a 2-garage door setup.

Sounds good. Let me know if you have any questions.

I saw that you mentioned the WeMo Maker in your hackaday post, any thoughts using that instead?

My immediate thoughts about using the Maker...

Pros: Simpler to use, essentially plug-and-play after a bit of setup.

Cons: I'd have to buy two because of 2 garage doors (~$200); may not be able to monitor door status;

On using this setup...

Pros: Cleaner - only one box instead of two (could be hidden, too).

Cons: After adding additional WeMo Switch, etc, price will likely be comparable to the Maker route; will need to modify code for second door.

I think the main issue with the Maker might be that there is no way (I am aware of) to electrically change the Maker's state from ON to OFF or the other way. So unless the Maker is the ONLY thing controlling the garage door, you will have issues. For example, what if someone opens the garage using a normal button or keypad? Then the Maker will be out of sync with the door....my adruino code does a lot to keep them in sync. Maybe you can create enough rules in the Maker to allow it to sense the door state change and update the device so it reflects the new door state, but I think you might have issues "stepping" on yourself where the script for the WEMO is not sophisticated enough to know when it changed the door vs someone else. Tough to explain in this comment, but hopefully that makes sense (?)

Yep, it makes complete sense... That was one of my biggest questions as well and one of the reasons I decided against using the Maker.

Here you can see the side of the WeMo Light Switch where the larger (aka normal sized) connection points for the toggle are. Worked rather well. Both end connections on the toggle seemed to change the state correctly when triggered, so I just choose one. Note that the Power, Ground and Status wires are there too, but in a different order.

A nice little bonus for using the Light Switch: it seems to have a (relatively) better antenna which could help if your access point is far away from your garage.

Cool project! Hope to see you at the Maker Faire in Reston this Sunday!

You bet. See you there :-)

Very impressive project!