Alexa Controlled Garage Door With Arduino Esp8266

Introduction: Alexa Controlled Garage Door With Arduino Esp8266

The idea for this project came to me from an old project I had worked on a while ago. I had wired up a simple push button circuit that would turn on an LED when a button was pressed by the garage door. This method proved unreliable and not as useful as, say, a device that would open and close your garage through Alexa AND let you know when the garage was open. So I began looking into Wi-Fi enabled garage door openers. At the time some existed, but could cost anywhere from 50 to 250 dollars, which was way to pricy, especially considering I was able to do it for around 10 dollars. So I then looked into some kind of Arduino controlled garage door, which resulted in pretty much nothing. When I thought all was lost I discovered Sinric Pro, which allows you to create a wide variety of smart home devices with the Arduino IDE. However, there weren't already any tutorials of how to use Sinric Pro to make a garage door opener, you were just left with the garage door sample code and a couple of hints on what it did. There are a few tutorials now use different methods, but this is a lot easier as it uses the garage door remote. So, you don't have to do anything with the actual door opener itself. Eventually, I figured out how the sample code worked and was able to turn it into a functional garage door opener/indicator, which I will show you how to do yourself in the instructions below.

Step 1: Parts List

One unit costs about 10 dollars, but you have to buy a lot of the parts in multipacks so the total cost will be higher, this can be offset if you use the leftover parts for other projects or if you already have them laying around)

  1. ESP8266 dev board (I used this)
  2. A solderless breadboard (this will work)
  3. Breadboard jumper wires (short ones like this and if you want to solder less often then get these as well)
  4. 12 volt power supply with a barrel jack or some way to connect it to a breadboard. (there's a good chance you'll have a spare one laying around somewhere, or you could get something like this)
  5. 12 to 5 volt regulator, I used a 5v linear regulator with a bunch of heat sinks, it might be cheaper to just get a buck converter if you don't already have a 5v regulator and some heat sinks on hand. Alternatively you could just use a separate 5 and 12 volt supply for the remote and the breadboard circuit. (rewiring something like this might be the easiest)
  6. 3 1.2kΩ resistors
  7. 2 LEDs
  8. 1 optocoupler (these)
  9. 1 proximity detector (these)
  10. 1 remote that works with your garage
  11. lots of wire
  12. General electrical equipment (electrical tape, wire strippers/cutters, solder)
  13. Heat sinks and thermal glue if you are using a 5v regulator, as it will get hot. I also put a heat sink on the ESP8266, but this is completely unnecessary and optional.

Step 2: Set Up the Garage Door Remote

To make trouble shooting easier, make sure whatever remote you will use for this project will open your garage before taking it apart. This way if anything doesn't work later on you will know that the remote not being paired isn't the issue. Once you have that done, check the battery voltage of the remote. Most will be 12 volts, if yours is a different voltage, you will need to modify this project a bit. If its a lower voltage you will need to figure out how to supply that voltage as well as 5 volts to the ESP8266. If it is a 3 volt watch battery you might be able to get away with using a 5v mains supply and a 3.3v regulator for the remote. If the remote uses a 12v battery then you can follow these instructions like normal.

  1. Open the remote and remove all the housing until you have the bare PCB. Remove the battery.
  2. Find the contacts for the push button, these should be on the opposite side of the button, and there will likely be 4 of them. Using a multimeter, find out which contacts are connected and which are connected and disconnected by pushing a button. If you have find the correct pair of contacts the resistance should change as you press the button.

  3. Once you have found the correct contacts for the push button, solder a wire to each contact, these should be wires where you can plug the other end into the breadboard. Put the battery in the remote, and touch the 2 wires together. If you have set it up correctly, the garage should now open/close. Remove the battery after you have confirmed it worked.

  4. Solder wires(that you can plug the other end into a breadboard) onto the positive and negative battery terminals of the remote. These will be used to power the remote. Label or remember which wire is positive and which is ground/negative.

  5. Connect the battery to the wires you soldered on and test if the door still opens, just to make sure you've done everything correctly so far.

Step 3: Assemble the Breadboard

Follow the schematic on paper and build up the breadboard circuit. Use the button jumper wires you attached to the remote earlier and connect them to the optocoupler as shown in the schematic. IMPORTANT Make sure that you know that the labels on the ESP8266 itself are not the same as the code in the Arduino. There is a diagram on this wiki page. You will also likely have to have extension wires for the proximity detector. Once you have this completed, you will need to make the power supply. There are multiple ways to do this depending on your garage remote, I will be providing instructions for use with a 12 volt remote.

  1. plug the 12 volt power supply somewhere into the breadboard, this will provide a 12 volt rail
  2. use a 5 volt regulator (with LOTS of heatsinks) or a 5 volt buck converter and make a 5 volt rail. This will be wired to the main power rails on the breadboard, which will then, obviously, be used to power the ESP8266.
  3. Wire the ground up to the ESP8266 ground and the 5 volt to the ESP8266 Vin.

Step 4: Mounting the Proximity Sensor and Garage Open LED Indicator

The proximity sensor must be mounted in a way that it will trigger when the garage is open. In my case I was able to screw it to a wood beam near the point where the garage door would stop when fully opened. Before mounting it, open your garage and use a 5 or 3.3v supply to power the proximity sensor. Its built in led will turn on and off letting you know when it detects something. Position it how you want it and make sure that works. You can use a screw driver with the built in potentiometer to change the sensitivity. Once you have the sensitivity dialed in for where you will position the sensor, you can double check that every thing is working correctly and try opening and closing your garage a few times. Finally, mount it into place securely. (Important side note, I had some 3 pin battery balance connectors that happened to be the right size laying around, so I used one of those to connect the proximity sensor, you can just use some of the female to male breadboard jumpers) Now for the indicator led.

The indicator LED is completely optional and will be vastly different depending on your house layout. Just use some really long wires and run them from the garage to wherever you want the indicator LED. Either crimp the LED onto the wires or solder it. The wire doesn't need to be big, I used some 22 gauge wire that I had laying around, and ran that through my attic.

Step 5: Program the ESP8266

This part is pretty basic, I wont elaborate too much since you can find millions of videos online for how to do most of this step.

  1. Download and install the Arduino IDE, the drivers for the ESP8266, and the Arduino libraries for the ESP8266. All of this is covered on the wiki page for the ES8266 dev board used in this tutorial.
  2. Sign up for a account with sinric pro, don't worry, you get 5 devices for free. You can pay to get more devices if you like.
  3. Install the Sinric pro Arduino library. If you need help there are plenty of online tutorials on installing Arduino libraries.
  4. Register a new device with Sinric pro. Once you log into your account, you will be taken to your dashboard. From there, click on rooms in the left hand menu. Then click add room, and make a room called garage. Then click on devices in the left hand menu. Click add device, and fill in the information like in the picture. Click next, and check what notifications you want to receive, next again, and then click save. Now in your dashboard under devices you will have a garage.

Once you have everything installed, you are ready to actually program the ESP8266. The code can be found on GitHub here. You will have to edit some basic parts of the code in order to register your device.

#define WIFI_SSID         "Wifi name"                      
#define WIFI_PASS         "Wifi password"
#define APP_KEY           "get from  https://sinric.pro"      
#define APP_SECRET        "get from  https://sinric.pro"    
#define GARAGEDOOR_ID     "get from  https://sinric.pro"  

This is the only code you should need to edit. Simply put your Wi-Fi SSID into the quotes, then do the same for the password. The garage door ID will be on the devices page under the name of the device, in this case "garage", it will be labeled ID:. They app key and app secret can be found on your Sinric pro dashboard under credentials. Keep all of these a secret because they are what registers your device to your account. Once you have all of your credentials copied and pasted into the code, your done. Upload your sketch to your Arduino (look for tutorials on uploading code to an Arduino if you need help on this) and get ready for testing.

Step 6: Assemble Everything and Finish

Now that your ESP8266 is programmed and your breadboard is built, plug everything into the right place and hopefully it should work, with a bit of troubleshooting and testing that your wire connections are correct. Once everything is plugged in and powered on, you should be able to open up your Sinric pro dashboard and see that your device is connected. If its not try clicking open or close anyway and see if that refreshes it. If not, refresh the page, and if that doesn't work. Go back to troubleshooting. Make sure that wherever you are gets a good Wi-Fi signal that the ESP8266 will be able to pick up. Once you have gotten the garage door to open up with the website, you can now connect it to Alexa. At the time of writing this it does not work with google home or IFTTT but it will in the future. Use the Alexa app to enable the Sinric Pro Alexa skill. The process is standard and the same as enabling any other smart home skill with Alexa. Finally, you have to set a pin to open the door with. Unfortunately, there is no way around this, unless Amazon decides to change it. The pin is only required to open the garage, so you can close it without having to remember a pin. You should now have your very own DIY smart garage door with an indicator light. I hope this guide is helpful for many people.

Be the First to Share

    Recommendations

    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Robots Contest

      Robots Contest

    Comments