Introduction: Control Your Garage From Your Cell Phone
This Tutorial will show you how to build a WiFi enabled Garage Door Controller that can be controlled from anywhere you have internet service (both inside and outside your local network). This same general idea can be incorporated into really any kind of internet controlled device that you can dream up (wall outlets controlled by your phone, etc...). Using the free BLYNK app allows you to receive data too (Garage Closed, etc...)
- ESP8266 Wifi Module ($5)
- FTDI for Programming ($5.50)
- Relay ($4)
- 3.3V Power Supply ($4)
- Jumper Wires ($2)
- Computer with Arduino IDE
- NPN Transistor (I used BC337-25) (100pcs for $4.50)
- 10k Ohm Resistor (5 pack for $1.50)
- 1k Ohm Resistor (5 pack for $1.50)
- “BLYNK” App for Iphone or Android (free)
- Old Garage Door Remote or Hardwire into Wall Switch
A little prior knowledge of Arduino related electronics (priceless)
If you would like feedback for "Garage Closed", you will need the following in addition to the items above:
- 1M ohm resistor (5 pack for $1.50)
- 100 ohm resistor(5 pack for $1.50)
- LED of any color (100pcs for $4.50)
- Normally Open Magnetically Actuated Reed Switch (10pcs for $2.50)
- Neodymium Magnet (10pcs for $3)
Step 1: Install Arduino IDE Libraries
- If you are not familiar with Arduino IDE please start here --> https://www.arduino.cc/en/Guide/HomePage
- Go to “ https://github.com/esp8266/arduino ” to install Arduino IDE libraries and examples. All you have to do is follow the “Installing With Boards Manager” instructions on the github page.
- Download and install the BLYNK app to your phone and libraries to you're PC for Arduino IDE. Just follow this getting started guide - http://www.blynk.cc/getting-started/
Step 2: Hook Up FTDI to ESP8266
Hook your ESP8266 to the FTDI with the following pinout. (keep in mind that the FTDI can not provide enough current to run the ESP, you will need a separate 3.3V power supply for the ESP). I just used a value breadboard power supply that was selectable between 3.3 & 5 volts (I actually burned up the first wifi module I used because I failed to switch the power supply to 3.3v).
Step 3: Set-up IDE and Program
- In IDE, go to [ File - Example - blynk - BoardsAndSheilds - ESP8266_standalone ]
- Open Blynk app - Add project - Name Project - Pick “ESP8266” for board - email yourself the “auth key”
- In IDE, Copy and Paste the “auth key” from your e-mail to the place in the sketch that states “YourAuthToken”
- In the sketch, fill in your wifi “SSID” and “Password” in the appropriate places.
- In IDE, go to tools - boards - ‘esp8266 generic’. Keep all of the default options that are picked.
- Plug FTDI into computer.
- Pick your COM port in IDE software.
- Load sketch to your ESP8266.
I attached an image of my final sketch (program) to one of the later steps in this ible', I just took the standard "ESP8266 standalone" example and added some code for my feedback "Door Closed" switch.
Step 4: Place ESP8266 Into Standalone Mode & Test Phone Control
After upload is complete, you can unplug the FTDI from the computer and the ESP. All you need plugged into the ESP now is VCC, ground, ch_pd, and your gpio pins to whatever you're running. See image for wiring example.
At this point you can wire up an LED to the GPIO 0 or GPIO 2 port and see if you can control it with the BLYNK App.
Again, if you need some help with learning the BLYNK app see the following page --> http://www.blynk.cc/getting-started/
You can also surf around on YouTube and find some examples.
Here's one that I found helpful thanks to "tronixstuff" for shooting this video:
Step 5: Wire Into Garage Door Circuit
You'll need to use an NPN transistor to switch the relay with because the relay coil operates when supplying ground which causes a problem with the Blynk app (It can only go from low to high not high to low).
You'll also need to use two resistors, one to reduce the switching current for the transistor (10k Ohm) and one to reduce the current on the switching wire to the relay board (1k Ohm)
The board will fire output for small amount of time upon power-up but using the 1kOhm resistor mentioned above prevents relay from switching during this time. (This may not have been the best fix for this problem but it sure did work well)
See Image for resistors and transistor wiring. Also, there is a spec sheet that shows what type of transistor that is shown in the diagram (so you can understand which legs are Base, Emitter , & Collector). (Resistor on left is the 1k Ohm and the one on the right is the 10k Ohm)
I ended up adding in a feedback circuit to detect "Door Closed" by wiring up a magnetic reed switch, LED, 100 ohm resistor, & a 1M ohm resistor. with a magnet placed on one of the chain links which actuates the reed switch. All of this is shown in one of the attached wiring schematics. This ended up working really well. see video of this working here:
Step 6: My Initial Wiring & Prototype
I mach’ed all of this up on a solderless breadboard which is shown in the image. (neither the RedBoard or the big relay module that is in the picture was used for this project)
I also made a video of this working which you can find here https://youtu.be/xf5B1RerCYw
Step 7: My Final Product
After I used it and saw that it worked without problems for a few days, I built it up on a permanent breadboard. (See Images)
Thanks and Have Fun Creating!
Sources and Credit (Thanks to all of the Following For My Successful Project):
IDE with ESP8266 https://www.youtube.com/watch?v=-aZU8YqHlHw
We have a be nice policy.
Please be positive and constructive.