Introduction: Garage Door Opener With Feedback Using Esp8266 As Web Server.
Hi,
I'll show you how to make a simple way to do a garage door opener.
-ESP8266 is coded as web server, door can be open everywhere in the world
-With feedback, you will know is the door is open or close in real time
-Simple, only one shortcut to make in your phone.
-Password protected
-Cheap, under 10$
-No Dominicz to setup.
-Without activating the door when power is lost and come back
I searched on internet and found some code but not exactly what i was looking for, So i modified some other code and idea + my personal experience + thanks to my son, he really help me on this one. The real time part is from him.
So let's begin!
Step 1: Buy the Hardware
You will need an esp8266 board and a relay board.
On ebay do a search: NodeMCU ESP8266 and relay module board
Relay module can be simple or double but we are using only one relay.
It's all you need!
Step 2: Install Arduino Software and Program the Esp8266
Here is a very good way to install arduino ide. You can do step 1 to 12
https://www.instructables.com/id/Programming-the-E...
Unzip the file and program your esp8266 with the code Garage_door_yt.ino
You will have some variable to change in the ino file.
-SSID and router password to connect in your web server.
-Also, you can change the port as you wish. exemple: WiFiServer server(54195)
-The password: Find and replace Passw0rd to your password as you wish in the .ino file.
-Added a closing time. Each day at exact time the door will close if it is open. (GarageDoor2.rar)
Start the serial monitor in arduino. Tool, Serial Monitor. You will see more detail and also the web server local ip address. You need the local ip address to enter this in a web browser.
For exemple, if your web server ip adress is 192.168.2.53 enter this:
Local:
http://192.168.2.53:54195/Passw0rd
Remotely:
http://ip-address:port/Password (router ip adresse)
In the code you can change everything as you wish.
I suggest to reserve this ip address in your router. This way, your phone shortcut will always be working. If not, router bail is often 30 days and ip address will change.
----------------------------------------------------------------------------------------------------------------------------------------------
This shortcut is working on your intranet only. If you want to open your garage door remotely on internet, worldwide, this is how to do it:
1- You must know your public ip address. Enter what's my ip in google and you will know this.
2-You must do a port forwarding in your router. In our case the port is 54195. So in my router i forward port 54195 to my server ip address 192.168.2.53. You can google for port forwarding for more details.
3-For exemple. If my public ip address is 70.52.46.219. I must enter 70.52.46.219:54195/Passw0rd to see the web page.
-----------------------------------------------------------------------------------------------------------------------------------------------
Access the web server without know your public address:
Most of service provider are given you an ip address just for a while. And this address change over time.
You can subscribe to no-ip for free and have a public address always working everywhere.
Just to go to https://www.noip.com/ and sign up
Exemple: http://My_garage_door.ddns.net:54195/Passw0rd
Important: If you are at home with wifi enabled, your internet shortcut will not works. So, on my phone i have 2 shortcuts. An intranet and an internet shortcut. I have both. If I am on my lan, I use the intranet and if I'm outside on lte(4g) I'm using the internet shortcut.
Step 3: Install the Boards
Here i'm using a double side tape to fix my boards.
Step 4: Wiring Diagram, Very Simple.
For Power supply, you can use an android telephone charger. It's cheap and perfert.
You must connect the relay board to 5V. Avoid to use 3.3v. Sometime, it can works but the coils sre made for 5v.
The upper red line show where to solder the wire, at the regulator input.
D1 is the output. This pin must goes into the relay board input. This pin is always HIGH (3.3v). When activate, this one go LOW (0v) for 0,5 second to activate the coil.
D2 is the input to sense the door. If LOW (0v) the door is closed. If not, it's open.
Be aware, this input (D2) is an input of 3,3v. The internal pull up is activate.
On my side, my garage motor input give me 5v. His internal pull-up are probably also activate. I connected together anyway and i dont have any problem. Just make sure, not enter higher than 5v on this pin. Use your multi-meter to check the input of your garage door. If this one is too higher than 5v, you will have 2 choices:
1-make a circuit divider with 2 resistors
2-install a separate magnet switch
*************************
ALSO ATTENTION to the polarity when connecting the relay board to the garage opener. ALWAYS put the esp8266 gnd to the garage motor operner gnd or common.
*************************
Step 5: Some More Pictures
This is my garage opener. Old but yet working :)
As you can see, i connected the relay board to the garage door push button and D2 input to Close limit.
Check on your garage opener, you will find something similar.
21 Comments
Question 1 day ago on Step 2
Hi'
Nice projekt! and thanks for sharing! :D I have som serious trouble understanding the web server part... where do i find the port i need? wich ip-addres? Maybe someone could just give some hints how to configure the web server. i would be very thankful :D
Answer 1 day ago
The esp8266 is the web server. Program it (wifi and password updated) and turn it on. This one is dhcp so the esp8266 will ask for an adresse and your router will provide it. Now you can go in your router to know what is your adresse or more simple is to look the arduino com display. did you read: quote:
Start the serial monitor in arduino. Tool, Serial Monitor. You will see more detail and also the web server local ip address. You need the local ip address to enter this in a web browser.
The port part, you choose it yourself. You must add the port in the code source i provide just before to program the esp8266. quote:
Unzip the file and program your esp8266 with the code Garage_door_yt.ino
You will have some variables to change in the ino file.
-SSID and router password to connect in your web server.
-Also, you can change the port as you wish. exemple: WiFiServer server(54195)
-The password: Find and replace Passw0rd to your password as you wish in the .ino file.
Hope this help.
Reply 1 day ago
Thanks Yannick this was very helpful i succeed and my old garageport is now hightec :D
Reply 1 day ago
Your welcome :)
Question 3 months ago
Thank you for this it is simple and works great. I have a couple questions;
I have the "Garage_door_yt.zip" working fine but wouldn't mind having it check to make sure the door is closed so am interested in the "GarageDoor2.rar" is this a sketch that replaces original or is it added to it in some way?
My setup has been working for a couple weeks, yesterday it quit working and I had to reboot the board to get it operational again, of course doing this caused the door to open.
Is there a way to force the NodeMCU to reboot say once a day or once a week without it changing the state of the relay output, so it reconnects to the network and leaves the door closed while it does?
Answer 2 months ago
Sometime the esp8266 need to be reboot. I think this is more hardware related.
To install garageDoor2 it's the same hardware. Just program the esp8266 with this.
On my side when i reboot the the think, the door isn't opening.
Try the garageDoor2. it's closing the door at 10pm each day if this is open. Maybe this can help.
6 months ago
Would be great if the Door will be closed every Day at 10 PM, because often i forgot to close at night. How about adding get NTP time? If state of door at 10:00 PM is OPEN, wait 10 Minutes, if its still open, close automatically. The 10 Minute Delay is for security if i just drive in or out at 10 PM.
Reply 6 months ago
Done... check GarageDoor2.rar You will see closingTime = String("02:00") Just put your time to close in UTC format. It's very basic and you must reprogram the device. But each day at same time it will check the door and closi it if it is open.
Reply 6 months ago
Hahaha it happen to me this morning. All night with door wide open :) It's a good idea. I'll check what i can do for that.
8 months ago
Yannick,
Thank you for this tutorial. Your instructions were clear and your code works perfectly. I have a 34 year old garage door (remotes lost a long time ago) and since purchasing our house 2.5 years ago have not been able to find an inexpensive solution to allow for remote access to our garage. Due to the age of the opener I haven't been able to find any universal remotes that were compatible and didn't want to spend the money in replacing the entire assembly. Even if I replaced my current opener with a modern variety, it would most like not have remote access from anywhere with a wireless signal the way this method does.
I have seen other solutions to this problem but yours seems to be the simplest. It also cost less than 10 USD so it beats anything else I've seen commercially by 4-5 times the price. Thank you again!
Shane
Reply 8 months ago
Your Welcome. Glad you enjoy! Yannick
Question 10 months ago on Step 6
Yannick,
another nice project thank you very much it works great. I need help changing the font size for Garage door is open / close. No matter what HTML code I put the font doesn’t change, I’m using a iPhone 6s and Safari browser. I need to make the sentence bigger I can barely read it. Tap the picture under my name to see a screen shot.
thanks
Greg Johnson
Answer 10 months ago
You need to this with safari itself: I'm working at 300% on iphone 8plus. And your phone will remember the size for this shortcut.
Launch the app and navigate to a website, then tap the "aA" icon in the upper left corner of the screen. The text zoom options appear at the top of the Web View dropdown menu – tap the smaller A to reduce the zoom percentage and the bigger A to increase it. It's that simple.
Reply 10 months ago
Ok great, I didn’t think about doing that. I thought size and stuff was coming from code. Thanks Yannick!
kind regards
Greg Johnson
11 months ago
I signed up on https://www.noip.com/ and created an account and domainname.
Port on the router is open, but I cannot acces the nodemcu.
Access the nodemcu over LAN is no problem.
Reply 11 months ago
Router port is open you mean you did a port forwarding to the garage door ip adresse ? Also, if you are using your phone at home, you must disable the wifi to test the LTE (4g)
Question 1 year ago on Introduction
How can this be made secure? Anyone can eventually find the url to your server and control your garage.
Answer 1 year ago
No, even if you have the right url, you must enter the password at the end of the url. Exemple: http://My_garage_door.ddns.net:54195/Passw0rd
Just edit the .ino file and replace Passw0rd by any password of your choice.
Reply 1 year ago
Thank you...
1 year ago on Step 6
It works fine !!!