Home Automation for Beginners: DIY Smart Garage Door
July 15, 2020Today on the hookup I’m going to walk you through every step of a simple DIY home automation project. As we convert a standard garage door into a smart one for less than $25 I’m going to do my best to explain any and all terminology I use with this pop up video style bubbles, making this the perfect video for a beginner DIY automator.
In my house tour I mentioned that my smart garage door was my first DIY automation project, and that for the money, it is one of my most used smart home features. When I was just starting out, every YouTube video and tutorial that I watched was full of terminology that I didn’t understand, and as a result I fumbled around with a bunch of failed protocols before finally figuring out what I was doing. This is the video I wish existed when I was just starting out.
To do this project I’m going to use 4 different things, I’ll explain more about what they are and why we need them later, but here they are: a Shelly1 WiFi Smart Relay, a Reed Switch and magnet, a 12 volt AC adapter, and some thin wire. I want to definitely make clear that there are purpose built smart garage door solutions available from companies like moes and zemismart for not too much more than this project will cost, but the purpose of this video is to get familiar with some of the concepts of DIY smart home projects, so you can get the gears turning in your head.
Using a garage door for your first project is nice because they are fairly standardized meaning no matter the brand, you’ll likely be able to find the same parts on your garage door opener. It’s also nice that the opener circuits generally run on low voltage, meaning there is a significantly lower electrocution risk, but we’ll still take proper precautions.
On your garage door motor unit you should be able to find some terminals on the back with wires attached to them, the most important thing for this project is to be able to determine which terminals cause your garage door to open when connected. You can determine this by reading the manual of your garage door opener, or by using a small length of wire to connect terminals together until the garage door opens. Once you’ve figured that out, you just need a way to connect those terminals using a command over the internet.
That’s where the Shelly1 comes in: Inside the shelly1 is a small wifi chip and microcontroller called an ESP8266 connected to a relay. The microcontroller is the brains of the device and runs a program called firmware that is installed by shelly to be able to connect to their app and control the relay.
A relay is essentially a remote controlled switch. Inside a relay is an electromagnet that when activated connects the two terminals. A very important feature of the shelly1 is that its relay has something called a dry contacts, which means even though you can power a shelly1 with mains AC current like the stuff that comes out of your wall outlets, or low voltage DC, the input and output on the relay are only connected to each other and not to the main device power. That means in this case that activating the relay will connect the two wires on the garage door opener, but won’t supply additional voltage which could cause damage to the garage door until.
As I mentioned before, a Shelly1 can be powered in a bunch of different ways, but since this is a beginner video, we’ll use the safest possible power source for the shelly, 12 volts DC. To use the Shelly1 with 12V you’re going to need to change the position of the jumper switch. A jumper is just a small piece of metal that connects specific pins on a circuit board to select different options. In the case of the shelly 1, placing the jumper on the top two pins will activate 12 volt mode, while the bottom two pins are used for all other voltage types. This is probably the most difficult part of the project, a good pair of tweezers will make easy work of it, but in a pinch it can also be done with an uncoiled paperclip.
When powering the shelly1 with DC current, the positive wire from the adapter goes to the terminal labeled N on the shelly and the negative wire goes to the terminal labeled L. Go ahead and power up the shelly, download the shelly app for your phone, and create an account. Select add device, and then click on the picture of the shelly 1. Once you input your wifi information the shelly will join your network and you will be able to rename it and add it to a room in the shelly app.
In the shelly app you’ll notice that pressing the power button next to your new device will result in a nice “click” sound on the shelly relay. That sound is the electromagnet turning the switch on and off and connecting the circuit between the I and O terminals on the relay. If you were turning the power on to a lightbulb or outlet this would be all you need, but since we’re simulating a button press, we want to turn the relay on for a short time, and then turn it back off. Luckily, the shelly has that functionality built in to the app. Click on “timer” and then set “Auto Off” to 1 second, which means that when you press the button, the relay will turn on for one second and then back off, perfectly simulating a real momentary button press.
The other thing we want to do with our smart garage is monitor the open/close state of the door. We’re going to do this with something called a reed switch. Inside a reed switch is a really tiny wire that can be pulled with a magnet to complete the circuit inside. Reed switches come in two varieties, called normally open or NO and normally closed or NC. A normally open switch connects its two terminals together only when a magnet is close by, and an normally close switch doesn’t connect its two terminals together when a magnet is nearby.
For our application we’ll mount the reed switch in a fixed position near the garage door opener and mount the magnet to the garage door chain, so that it triggers our reed switch when the garage is open, and not when the garage is closed.
To connect the reed switch to the shelly, just connect one wire to the SW terminal, and one to the L terminal, which is where we plugged in the negative wire on from the power supply. Then, to be able to monitor the state of the switch in the shelly app we need to change two settings. The first one is under settings -> button type, where we’ll set the type to detached. This means that changing the state of the switch won’t cause the relay to change states, which would be really bad since it would cause the garage door to immediately close every time it was opened.
And Second, in application settings click on input state and check the box that says “add input state identifier to the power button”. Now, when the magnet is close to the reed switch, like it would be when the garage is open, the shelly app has a nice blue icon on the top portion of the power button, and when the garage closes, the reed switch no longer completes the circuit and the power button on the shelly app loses its blue coloration.
Now that we’ve got everything working in theory, it’s time to install it and test it out. Just to be safe, it’s a good idea to unplug your garage door from mains power while you work on it. First, attach some small lengths of wire between the “I” terminal on the shelly and the first screw terminal for your garage door opener switch, and then attach the other garage door opener terminal to the O terminal on the shelly.
Then, Install the wired side of your reed switch in a fixed position on your garage door track, and then attach the magnet to an unused link on your garage door chain. You want this magnet to be right next to your reed switch when your garage door is open, so that when you close it the circuit is broken and you will be able to see that feedback in the shelly app. After your wires are all connected, plug in both your garage door opener, and your 12 volt adapter.
If all goes well you should be able to see the state of the garage door as indicated by the blue coloration of the power button on the shelly app, and you should be able to trigger your garage door to open and close using the power button, which causes the relay to fire for 1 second, and then turn back off.
The shelly app now allows you to control and monitor your garage door from anywhere in the world where you have internet. It does this by connecting to a computer server called the “shelly cloud”. Normally devices from outside your home network, like a cell phone on a cellular connection, cannot communicate with devices in your network. So instead, both devices talk to a remote server instead of talking directly to each other.
If you want to break free of the cloud, you need a device called a hub in your house that will act as an intermediate between all your smart devices and the outside world. In some cases your hub uses a cloud of its own to pass your commands over the internet, while other hubs require you to set up your firewall to allow internet traffic to get through to your hub.
Another huge advantage of a hub is the ability to make all of your smart devices work together. I personally use home assistant, but hubitat and smartthings are also popular solutions depending on your desire to tinker. The great part about the shelly, and the reason that I suggested it for this project, is that no matter what direction you decide to go after this, the shelly can fit into all your plans by supporting smartthings, MQTT and CoAP right out of the box. As always, if you need help with this project, or any of my projects leave a comment or better yet, come visit the hook up home automation group on facebook to get help not just from me, but thousands of other automaters who have seen it all.
Short video this week since I’ve been working on my patio renovation project. Phase 1 is complete and phase 2 is on a boat in two very large crates on its way to me from china, stay tuned for at least one video about that project. Thank you to my awesome patrons over at patreon for your continue support of my channel, if you’re interested in supporting my channel, please check out the links in the description. If you enjoyed this video please hit that thumbs up button and consider subscribing, and as always thanks for watching the hook up.