Steve: Fist of all thank you for writing this up great project !. I worked through the instructions, but I used a single opto isolated relay, which wound up causing some issues. After a lot of trouble shooting it turns out the single relay did not like having Vcc= 5V in the trigger voltage = 3.3V. As the program pulls in GPIO pins high and triggers on low, in the quiescent state I think that there is 1.7 v across the opto coupler. It would trigger but not release. The problem was solved when I fed the relays 3.3 V Vcc from pin 1 vs pin 2 in your circuit. I think that this makes sense In the quiescent state there would be zero volt drop across the opto coupler if the Vcc = 3.3V. With Vcc = 5 V on the relay, my garage door opener did not like it at all. I think the relay was in an undefined state. Perhpas this will help some other weekend warriors.
Steve, you've done a stellar job with this project - thanks for all the great information. It's motivated me to start on my garage door system right away. Cheers!!
This gives me direction on my RPi garage door project. One thing to note, it is not a good idea to hardcode passwords. They should be saved encrypted in some database. However, I appreciate the work you've done and I hope to expand on it in my project.
Here are a couple of thoughts, the distance between the sensors (reed switches) and the RPi should either be kept as short as possible or the inputs at the RPi should be fully buffered and isolated to shunt any induced voltages. The longer the wires are, the more chance an induced voltage will overload or even damage the sensitive Pi inputs. In light of this, the best location for the Pi would be near where the sensors are on the side of the garage about half way between them two sensors. Even then, I would at least add a fast switching diode across the inputs (as a flyback) and possibly a small capacitor to smooth on/off transitions. Secondly, although this may seem like overkill to some, it's best to minimize the chances of a software or hardware 'glitch' causing the door to open on it's own. The most secure way to do this would be to duplicate the hardware using two RPi's that have to agree on the action to actuate the garage opener control before anything happens. This isn't too hard to do, but it does almost double the cost and complicates things somewhat. The other way to accomplish this, but less secure, is to have two separate processes on the RPi monitoring the sensors, each of which controls a different relay (whose outputs are wired in series), and both of those must agree before the garage door can be actuated. I did a similar project with a pair of esp8266 boards that each had a WiFi enabled MCU, a relay, and an opto-isolated input. For the software I used ESPEasy and simple scripts. Each board was less than $10 and I used two such that a failure of any component or software on either board would result in the door not being able to actuate. This was then interfaced to Home Assistant which I already had running for the web interface side. By using a simple to use and reasonable flexible software platform on the boards, ESPEasy, the scripting code was less than 20 lines on each board. To actuate the garage opener, I setup two virtual buttons on Home Assistant, each which sent a command to the respective board. In order to actuate the opener, each button has to be pressed within a 5 second window.
@@daleblount3230 I have no doubt. Rather one has to worry about spikes from induced voltages is highly dependent on the environment. When designing electronics for the general public, one has no idea of the environmental circumstances of a particular installation so worst case or near worse case must be accounted for.
In oil ans gas eline we have a collar locator that gives a single depending how clode to metal it is it would show motion well plus could also read it with the signal to "stop" or no motion.
Hi Steve, Thank you for your beautiful video, I Have a question: If I wanted to indicate These three indication of garage door (Open , Open/close and Close) with 3 lamps (GN, YE, RD) in my house wirelessly in second floor of my house. How can I do that and what kind of extra material and command needed to do the job?
Steve, thanks for the great vids. This would be my first RPi project! What are those 4 screws at 3:52? Are they literally nuts and bolts? Any particular type? Thanks
Hi, I have been running the app for quite a few months with no problem on a 14 year old Liftmaster. I had to change it for a newer model with the exact same hookup. The relay is still working but it won't open the door. The new unit just flashes the up/down buttons but doesn't open the door. Not sure why. I'm afraid to play with it too much for fear of possibly damaging the new unit. In any case the new unit is already set up for wifi but I liked the idea of hosting the function locally rather than using a third part app.
Very nice. Watched your the other video with the $10 card project (also a good one) and I was thinking how I can know wether the door is open or close. Then I found this video. It will be even better if the program can send out notification when the door is open, instead of checking the webpage.
Hello, Steve This is fantastic work, I have a single channel relay and have edited the code to reflect that. When I run the 'relaytest' it closes the circuit and doesnt open it back up again. I have used GPIO 11 and changed the code from 16. I can hear the relay close and the light comes on but it doesn't open after the 0 5 timer setting. I want to get it working on this setup before I try the Alexa version.
Thanks Steve, loving this project. I managed to get it all working in the office but am having problems in the real world. Having read the comments below I'm thinking the problems relate to location of the Pi and the distance (30m) to the reed switches. Any tips / advice on how to "stabilse" the switches over such a distance ? TIA
Spare pi sitting around while in lockdown so thought i would give this a try. easy instruction and worked a treat. Wondering before i fully connect relay etc, do you steve or anyone have a guide on how to add a video stream to the web url/image , so I can see what is going on aswell,,?? thx
Hello! Thanks for the great video. How would this work with two garage doors? I was thinking the code just needs to double up and the two more terminals for the magnet sensors. Let me know if that makes sense. I would love to do this project!
i have created my and about to install it on my garage today it was not hard just waiting on parts but a fun easy project, how would i be able to setup a web socked as stated below?
Thanks Steve. Built the garage opener around RPi Zero with latest software. Added the two lines you suggested to rc.local but it does not execute the web.py program on reboot.
Nice project, Steve! I added Motioneye to the pi as well. One question though. When the pi reboots, it causes the relay open or close the door. I don't know if I did something wrong, but how can I prevent it to open/close the door while rebooting?
Hi Steve, Put this in today. Just wanted point out that when you are in your garage you show the reed switches using the normally open NO output, but later in the video (when you are showing the pinout diagram) it shows the GPIOs connect to the normally closed NC output. I went off the pinout diagram and spent an hour scratching my head as to why I couldn't detect the position of the door correctly. The NO normally open configuration is the correct one. I also have an issue that when the raspberry pi is rebooted it operates the relay which in the event of a power cut would open my door when the power is restored.
Sorted the relay issue. Noticed in web.py that pin 7 (that controls the relay) is defaulted to a high state. Set the default state to low and altered the opening routine accordingly (go to high, return to low) and it is working fine now.
I'm very new to the PI and Arduino scene. I'm wondering if you could tie this in with an ESP8266 and add it to Home Assistant. I currently have something from Amazon that works with Smartlife, but I'm moving away from their platform.
Nice project. Password and port should be in variables, either at the top of the web.py or in a config.py file... PASSWORD = '12345678' PORT = 5000 If you have them in a separate file, you can `from config.py import *` in web.py to load them.
Fantastic Job with the project and the video! Thanks! Maybe it's not really a big deal but I'm curious why the default is to set the GPIO pins to HIGH as the default and going LOW to trigger the relay instead of the other way around. Isn't voltage applied to the PIN when high, and wouldn't it make sense to default LOW and only send the voltage to trigger the relay when necessary?
@@Steve_Does_Stuff Makes sense. I guess since I’ve only access to the relay (not the module), and having to include the switching transistor all of the schematics I referenced included a pull down resistor to make the switching definitive. I suppose I could do away with that and rely on the internal pull up and go high on the pin as well. Thanks for the quick reply and a great project!
Steve this works great but I want to connect it to my google assistant to be able to say google open the door. Is there a way to get the pi to do this?
Hi Steve. I have to refresh my iPhone in order to see the correct images for the status of the garage door. Any suggestion how to eliminate the need to refresh the iPhone? Otherwise everything is installed in the garage and working well.
You should be able to add a 'refresh' statement to the html header of each page, which will cause the page to refresh automagically every x number of seconds, set by you. In each of the Open.html, Closed.html, and Question.html files in the static folder, change to with the xx being the number of seconds between page refreshes, then reload the Pi and you should be good. An example might be http-equiv="refresh" content="30" for it to reload the page every 30 seconds.
Okay so I understand how to make it work…. But now to take this into 2023 can I make an app to access the pi? An app that only me can give out or make accessible to whom ever? If this is possible I’m doing this over the next few weeks. I don’t like the wifi options on the new units. I would rather it be a Ethernet connection.
I made an updated video that now works using Siri that uses the exact same hardware setup. Only the code for this project has changed. I made a video on this new feature. Check that out here: ua-cam.com/video/wfsYFM-9Dns/v-deo.html You can set this up to work on many iPhones.
Hi Steve. Thanks so much for the great video. I just have one question for you. How do I clear/delete the log file? I tried to simply delete the contents of the log.txt file found under /home/pi/GarageWeb/static/log.txt but strangely enough when I go and view the log file from the browser then all the old data is still displayed (even though the log.txt file is essentially blank). Am I missing something? Thank you
@@Steve_Does_Stuff Thank you so much for your response! You are a legend! And yes you were correct, seems like the browser was just displaying cached data. I just deleted the log.txt file and created a new log.txt file and I was able to get a fresh new log page. Super simple stuff. Thanks again Steve, really appreciate it. I set this up in my dad's garage and now my dad thinks I'm some kind of tech genius...feels good man.
Steve, Why not using WebSocket then you can see directley when the status of the door change no need to reload the page again and again if you combine it with an ssl certificate you kan also make the app as an static PWA app. (with own icon on you phone) the only communication need is status / commands. ;-) but anyhow a good nice project ;-)
On an iPhone, you just need to create a nice big icon, but it in a meta tag and then share the web page to your Home Screen... Curious why you'd need an ssl cert to make it an app though. Any information on using websockets? I created an api route that returns the current status in json and just do a settimeout every 2 seconds to keep checking the status and dynamically update the page when the status changes, but I'd love to know your take on websocket.
WPA is a also capable for data exchange so therefore it's mandatory to use a secure connection. WebSockets: There are a lot of simple examples also on UA-cam and GitHub. I've forked some WS libs on my GitHub : github.com/sq4/ws i don't really like to code in Python so i use NodeJS for all my projects ;-) just one language JaveScript for server and client ;-)
Steve, I realize that it's been a year since this was published, but have you updated the code at all? I was wondering if I could get your help in adding some features to your code. First, I would like to add a feature to turn on/ off the built in garage door light without opening the door, and I would also like to add in the ability to monitor and open / close two garage doors instead of just one door. Finally I would like to be able to add in Alexa control over the whole thing. If you have time I would like your help please. I am new to python programming.
@@Steve_Does_Stuff Thanks for the fast reply. This raspberry pi stuff is addictive. I stayed up late last night figuring out how the wall control unit works so that I can also control the light on the door opener. I have a Genie Pro Excelerator door opener that was installed in 2007. I'm not sure if the following information is standard for all door openers, but for my Genie Pro I figured out that the door control unit sends a 5v signal to the wall control switch assembly. In the wall switch assembly I traced the path of the circuits and figured out that if the "door" button is pressed it just shorts the 5v reference voltage to the return wire, but if the "Light" button is pressed the 5 volts passes through the switch, to first a 82.5 ohm resistor and then a 121 ohm resistor in series and then back to signal return. I didn't have a 203.5 ohm resister sitting around, but I did have a couple of 100 ohm resistors, so late last night with the help of a couple of jumper wires and a bread board, I verified that if I jump the garage door control pins at the opener through a 200 ohm resistor, only the light will turn on / off and not open the door. With that information, and an extra relay, maybe you can work light control into your code. Thanks again for your video. I am learning a lot from them.
Nice project and easy to understand. Can you suggest how to add code to log.py to send an email if the door has been open too long? I know it should go around line 31, but not sure of the syntax necessary to use msmtp to send the email. From the command line it is "echo "message text" | mail -s "Subject text" email-recipient.com " but this does not work if I insert it at line 32 of log.py. Any ideas or help with this? I am sure others would like to do this as well. Thanks!
@@Steve_Does_Stuff THanks much for your reply. I did attempt to use ssmtp but found out that it is no longer supported. Instead, it is recommended to use msmpt. After a lot of fussing with it, finally got the syntax and setup figured out and it is working just fine. Thanks for this great tutorial.
@@Steve_Does_Stuff Thanks! Works great. I'm trying to use IFTTT webhook to send my code via POST, but I keep getting a KeyError. If you have any advice I'd be thrilled, but if not I'll happily keep digging!
Thanks for this Steve! I seem to have everything working except for the autostart of the webserver .. Not working through rc.local, have tried through init.d then gave up when trying to use through Supervisor ... I am running the latest raspberry pi os Release date: August 20th 2020 , Kernel version: 5.4 . Anyone else having this issue or knowwhat image to run? Thanks :)
For those who have the same issue I've fixed it! I still used the rc.local way of autostarting but for some reason I also had to run : sudo chmod 755 /etc/rc.local sudo chmod 755 /home/pi/GarageWeb/log.py sudo chmod 755 /home/pi/GarageWeb/web.py
@@Steve_Does_Stuff I got the log script to run, I think after i worked the scripts out, I was using the wrong relay, it was a 8 relay arduino one which the pi didnt supply enough power to the relay, I have since bought another relay which looks basically same as yours but I think it was faulty when I received it, will get another relay and try that, I will post if I need further assistance thanks for the reply
Hey Steve, got a quick question, so I have everything hooked up and it works great, Except! The magnetic switches do not work when used in web.py . If I load the log.py they work as intended. When i start web.py it starts with door closed no matter the position, when you activate the door it goes to a question mark and never updates again. Any thing you can tell me to point me in the right direction?
@@Steve_Does_Stuff Yessir I've seen the video, does it also work with google? I ran into this project because I bought an android headunit for my car and I thought it would be cool to control the garage door from an app on my headunit! You are the man sir Hope you have a great night.
Steve...thanks for help with the email. Now I have another question...I would like to implement this with just one magnetic switch. How would log.py need to be modified so it will work with just one magnetic switch instead of the 2 that you are using? Thanks!
@@Steve_Does_Stuff Thanks Steve. It took quite a bit of fiddling and trial-and-error, but after many hours this non-programmer finally got it to work with the one magnetic switch. It was also pretty easy, once I figured out the correct syntax, to use msmtp to send emails and text messages to notify me of the open, close and 15 minute reminder of the door activity. Great learning experience.
@@Steve_Does_Stuff I'm looking forward to it! I'm buying a pi zero and picking it up on Monday. I'm going to do this with my 10-year old daughter as a change to teach her basic Boolean logic. If I go the Homebridge route, I'll send you a link to the code.
@@Steve_Does_Stuff Thanks for this! I have made some modifications which uses json. When the code is clean, I'll send you a link to my finished code. I also used the Apple Shortcuts app to automate it.
@@TheNewGreenIsBlue what’s the status of your project? I currently have the pi hooked up with my HapNodeJS. And this exact set up. I was looking into if I could convert my pi into a homebridge and then install the HAPNodeJS garage opener file to it. But I’m a bit stuck on how to do that. Have you made any progress?
Hey Steve! Thank you for making this video! I am new to programming and Pi, so this was a fun project to work on and build my skills! I'm hoping you could help me with a bit of debugging. I have the server up and running and I am able to see all three door status messages. However, when I send the passcode "12345678" the relay to command the garage door does not work. When I ran the "relaytest.py" the relays kicked on as expected. Hope you have the time to help and thank you again!
@@Steve_Does_Stuff Thank you so much for your help! I was able to figure out from your video that you are using relay 4 not relay 1 on your relay board. I am using a 2 relay board and not a 4 so when the code was entered it was trying to turn on relay 4 which I don't have. Thank you again for the replay and cant wait for more project videos!
Hi Steve, congratulations on the project, I have already done it for my two garages and it works perfectly, unfortunately I had to use two Raspberry Pi with two different ip, it would be nice to implement on a single raspberry the choice of which door to open, given the large size amount of GPIO available to double the functions. EXCELLENT the idea of sending an alert when the door opens, but not via email, it would be better and more immediate to receive a notification with TELEGRAM with the use of a personal BOT, which alerts me at 5 minute intervals until closes and notifies me of the closure ... Greetings from Italy.
I have an update version of the program that uses Python 3, so it should work on the Pi5 Siri Controlled Garage Door Opener Using a Raspberry Pi. DIY Project Complete Tutorial ua-cam.com/video/wfsYFM-9Dns/v-deo.html
4 роки тому
"Not knowing the status of the door is what's bothering me" Welllll, I would personally be a lot more bothered by having this little Pi open to the Internet with the ability to control the garage door. Depending on how valuable the items stored in the garage are, here is how I'd run this. Put the actual control of the garage relay on a separate R-Pi with its own wireless AP which provide wireless service to the drive way area. NO internet connection whatsoever. Then put your magnetic switch on another device with Internet connectivity and have it configured with a push notification system and all the bells and whistles of remote access if you really wanted to. Bottom line is, don't trust the Internet of things to be all secured, especially when handing off the keys of your house.
steve, i can't run python log.py . this error message is File "log.py", line 7, in logfile = open("/home/pi/GarageWeb/static/log.txt","a") IOError: [Errno 13] Permission denied: '/home/pi/GarageWeb/static/log.txt' what's the solution?
Steve, I have an update. I spent yesterday installing the Raspberry Pi Zero Z and associated hardware onto my two garage doors. The Wiring was pretty easy to set up. I wired them to 4 relays as I am planning for the future. In the future I want to not only be able to control the doors with my phone ( and Alexa ) but also the lights. Currently I have "web.py" from this video up and running on the Pi Zero, but I've run into a bit of a snag. I found that when I start "web.py" through SSH everything works great, but after I close my SSH session the program crashes and will no longer respond to my phone or desktop ( at 192.168.0.xxx:5000 ) . Have you heard of this happening before? I plan on downloading your newer software in the future, as "web.py" was mainly a proof of concept for now just to make sure that I had at least gotten the 1st door hooked up correctly. I don't know if you can tell, but I am excited about this project. Not because I need this function, or I have a use for it, because it's fun to learn this stuff and doesn't cost very much to experiment with.
Steve:
Fist of all thank you for writing this up great project !. I worked through the instructions, but I used a single opto isolated relay, which wound up causing some issues. After a lot of trouble shooting it turns out the single relay did not like having Vcc= 5V in the trigger voltage = 3.3V. As the program pulls in GPIO pins high and triggers on low, in the quiescent state I think that there is 1.7 v across the opto coupler. It would trigger but not release. The problem was solved when I fed the relays 3.3 V Vcc from pin 1 vs pin 2 in your circuit. I think that this makes sense In the quiescent state there would be zero volt drop across the opto coupler if the Vcc = 3.3V.
With Vcc = 5 V on the relay, my garage door opener did not like it at all. I think the relay was in an undefined state. Perhpas this will help some other weekend warriors.
Steve, you've done a stellar job with this project - thanks for all the great information. It's motivated me to start on my garage door system right away. Cheers!!
This gives me direction on my RPi garage door project.
One thing to note, it is not a good idea to hardcode passwords. They should be saved encrypted in some database.
However, I appreciate the work you've done and I hope to expand on it in my project.
Thanks so much for this! I am going to use it to control both of my garage doors and inform my flask hot-tub controller I am slowly building.
Great video, Steve. I did the same thing but with node.js. The part about auto-starting the server at the end was the most helpful for me. Thanks!
Here are a couple of thoughts, the distance between the sensors (reed switches) and the RPi should either be kept as short as possible or the inputs at the RPi should be fully buffered and isolated to shunt any induced voltages. The longer the wires are, the more chance an induced voltage will overload or even damage the sensitive Pi inputs. In light of this, the best location for the Pi would be near where the sensors are on the side of the garage about half way between them two sensors. Even then, I would at least add a fast switching diode across the inputs (as a flyback) and possibly a small capacitor to smooth on/off transitions.
Secondly, although this may seem like overkill to some, it's best to minimize the chances of a software or hardware 'glitch' causing the door to open on it's own. The most secure way to do this would be to duplicate the hardware using two RPi's that have to agree on the action to actuate the garage opener control before anything happens. This isn't too hard to do, but it does almost double the cost and complicates things somewhat. The other way to accomplish this, but less secure, is to have two separate processes on the RPi monitoring the sensors, each of which controls a different relay (whose outputs are wired in series), and both of those must agree before the garage door can be actuated.
I did a similar project with a pair of esp8266 boards that each had a WiFi enabled MCU, a relay, and an opto-isolated input. For the software I used ESPEasy and simple scripts. Each board was less than $10 and I used two such that a failure of any component or software on either board would result in the door not being able to actuate. This was then interfaced to Home Assistant which I already had running for the web interface side. By using a simple to use and reasonable flexible software platform on the boards, ESPEasy, the scripting code was less than 20 lines on each board. To actuate the garage opener, I setup two virtual buttons on Home Assistant, each which sent a command to the respective board. In order to actuate the opener, each button has to be pressed within a 5 second window.
I've been using over 75 ft wires on a similar setup on my reed switches for years with no issues.
@@daleblount3230 I have no doubt. Rather one has to worry about spikes from induced voltages is highly dependent on the environment. When designing electronics for the general public, one has no idea of the environmental circumstances of a particular installation so worst case or near worse case must be accounted for.
In oil ans gas eline we have a collar locator that gives a single depending how clode to metal it is it would show motion well plus could also read it with the signal to "stop" or no motion.
Steve thank you the help I have it all working now and it works great thank you again for the video and the help
Thanks, Steve. I appreciate the knowledge.
Thanks, I was looking for a replacement for my pi using Blynk which I understand is being discontinued in its present form, this looks ideal.
Thanks
Nice job, Steve!
Hi Steve, Thank you for your beautiful video, I Have a question:
If I wanted to indicate These three indication of garage door (Open , Open/close and Close) with 3 lamps (GN, YE, RD) in my house wirelessly in second floor of my house.
How can I do that and what kind of extra material and command needed to do the job?
Neat project. Nice work... but needs more RGB.
Steve, thanks for the great vids. This would be my first RPi project! What are those 4 screws at 3:52? Are they literally nuts and bolts? Any particular type?
Thanks
Thanks for the quick reply. I just now need to convince my wife that this is essential :-)
Hi,
I have been running the app for quite a few months with no problem on a 14 year old Liftmaster. I had to change it for a newer model with the exact same hookup. The relay is still working but it won't open the door. The new unit just flashes the up/down buttons but doesn't open the door. Not sure why. I'm afraid to play with it too much for fear of possibly damaging the new unit. In any case the new unit is already set up for wifi but I liked the idea of hosting the function locally rather than using a third part app.
newer garage door openers send a signal over the wires. its not just a simple close contact triggered switch anymore
Very nice. Watched your the other video with the $10 card project (also a good one) and I was thinking how I can know wether the door is open or close. Then I found this video. It will be even better if the program can send out notification when the door is open, instead of checking the webpage.
Hello, Steve
This is fantastic work, I have a single channel relay and have edited the code to reflect that. When I run the 'relaytest' it closes the circuit and doesnt open it back up again. I have used GPIO 11 and changed the code from 16. I can hear the relay close and the light comes on but it doesn't open after the 0 5 timer setting. I want to get it working on this setup before I try the Alexa version.
i was running my relay board on 5.5v, this doesn't work. i switched to 3.3v and everything works as it should! thank you
Thanks Steve, loving this project. I managed to get it all working in the office but am having problems in the real world. Having read the comments below I'm thinking the problems relate to location of the Pi and the distance (30m) to the reed switches. Any tips / advice on how to "stabilse" the switches over such a distance ? TIA
Spare pi sitting around while in lockdown so thought i would give this a try. easy instruction and worked a treat. Wondering before i fully connect relay etc, do you steve or anyone have a guide on how to add a video stream to the web url/image , so I can see what is going on aswell,,?? thx
Very nice.. now upgrade your code so we can choose which relay we want to trigger with same feedback from magnetic switches ty
Hello! Thanks for the great video. How would this work with two garage doors? I was thinking the code just needs to double up and the two more terminals for the magnet sensors. Let me know if that makes sense. I would love to do this project!
Just use 2 different ports
Tried different pins but will review that video and see what happens
i have created my and about to install it on my garage today it was not hard just waiting on parts but a fun easy project, how would i be able to setup a web socked as stated below?
Thanks Steve. Built the garage opener around RPi Zero with latest software. Added the two lines you suggested to rc.local but it does not execute the web.py program on reboot.
I added s sleep 60 instruction at the beginning of rc.local which seems to fix the issue.
@@Steve_Does_Stuff Thanks Steve. I'll try it
Nice project, Steve! I added Motioneye to the pi as well. One question though. When the pi reboots, it causes the relay open or close the door. I don't know if I did something wrong, but how can I prevent it to open/close the door while rebooting?
Can you add the ability for it to close the garage door automatically after a certain time? Just in case you forget to shut it at night.
Hi Steve
I can not find the link to the products and commands you used in this video, Will you please direct me to them?
Hi Steve, Put this in today. Just wanted point out that when you are in your garage you show the reed switches using the normally open NO output, but later in the video (when you are showing the pinout diagram) it shows the GPIOs connect to the normally closed NC output. I went off the pinout diagram and spent an hour scratching my head as to why I couldn't detect the position of the door correctly. The NO normally open configuration is the correct one.
I also have an issue that when the raspberry pi is rebooted it operates the relay which in the event of a power cut would open my door when the power is restored.
Sorted the relay issue. Noticed in web.py that pin 7 (that controls the relay) is defaulted to a high state. Set the default state to low and altered the opening routine accordingly (go to high, return to low) and it is working fine now.
I'm very new to the PI and Arduino scene. I'm wondering if you could tie this in with an ESP8266 and add it to Home Assistant. I currently have something from Amazon that works with Smartlife, but I'm moving away from their platform.
Nice project. Password and port should be in variables, either at the top of the web.py or in a config.py file...
PASSWORD = '12345678'
PORT = 5000
If you have them in a separate file, you can `from config.py import *` in web.py to load them.
Yes, much safer than asking people to poke around inside the code.
Is there a way I can ask my Echo/Alexa if the garage door is open or closed? and then tell it to open/close the door?
Fantastic Job with the project and the video! Thanks!
Maybe it's not really a big deal but I'm curious why the default is to set the GPIO pins to HIGH as the default and going LOW to trigger the relay instead of the other way around. Isn't voltage applied to the PIN when high, and wouldn't it make sense to default LOW and only send the voltage to trigger the relay when necessary?
@@Steve_Does_Stuff
Makes sense. I guess since I’ve only access to the relay (not the module), and having to include the switching transistor all of the schematics I referenced included a pull down resistor to make the switching definitive. I suppose I could do away with that and rely on the internal pull up and go high on the pin as well.
Thanks for the quick reply and a great project!
Hi Steve.I noticed that you connected the app via WIFI. Could you open the garage door while not in the perimeter of WIFI? (via 3G/4G)?
Steve this works great but I want to connect it to my google assistant to be able to say google open the door. Is there a way to get the pi to do this?
Hi Steve. I have to refresh my iPhone in order to see the correct images for the status of the garage door. Any suggestion how to eliminate the need to refresh the iPhone? Otherwise everything is installed in the garage and working well.
@@Steve_Does_Stuff Thanks Steve. Excellent as is.
You should be able to add a 'refresh' statement to the html header of each page, which will cause the page to refresh automagically every x number of seconds, set by you. In each of the Open.html, Closed.html, and Question.html files in the static folder, change
to
with the xx being the number of seconds between page refreshes, then reload the Pi and you should be good.
An example might be http-equiv="refresh" content="30" for it to reload the page every 30 seconds.
Okay so I understand how to make it work…. But now to take this into 2023 can I make an app to access the pi? An app that only me can give out or make accessible to whom ever?
If this is possible I’m doing this over the next few weeks.
I don’t like the wifi options on the new units. I would rather it be a Ethernet connection.
I made an updated video that now works using Siri that uses the exact same hardware setup. Only the code for this project has changed. I made a video on this new feature. Check that out here: ua-cam.com/video/wfsYFM-9Dns/v-deo.html
You can set this up to work on many iPhones.
Use a websocket instead of just http request and you wouldn't have to refresh to see the garage door status.
Hi Steve. Thanks so much for the great video. I just have one question for you. How do I clear/delete the log file? I tried to simply delete the contents of the log.txt file found under /home/pi/GarageWeb/static/log.txt but strangely enough when I go and view the log file from the browser then all the old data is still displayed (even though the log.txt file is essentially blank). Am I missing something? Thank you
@@Steve_Does_Stuff Thank you so much for your response! You are a legend! And yes you were correct, seems like the browser was just displaying cached data. I just deleted the log.txt file and created a new log.txt file and I was able to get a fresh new log page. Super simple stuff. Thanks again Steve, really appreciate it. I set this up in my dad's garage and now my dad thinks I'm some kind of tech genius...feels good man.
great work. PS. can we all stop using nano?
Steve, Why not using WebSocket then you can see directley when the status of the door change no need to reload the page again and again if you combine it with an ssl certificate you kan also make the app as an static PWA app. (with own icon on you phone) the only communication need is status / commands. ;-) but anyhow a good nice project ;-)
On an iPhone, you just need to create a nice big icon, but it in a meta tag and then share the web page to your Home Screen... Curious why you'd need an ssl cert to make it an app though.
Any information on using websockets? I created an api route that returns the current status in json and just do a settimeout every 2 seconds to keep checking the status and dynamically update the page when the status changes, but I'd love to know your take on websocket.
WPA is a also capable for data exchange so therefore it's mandatory to use a secure connection.
WebSockets: There are a lot of simple examples also on UA-cam and GitHub. I've forked some WS libs on my GitHub :
github.com/sq4/ws i don't really like to code in Python so i use NodeJS for all my projects ;-) just one language JaveScript for server and client ;-)
Steve, I realize that it's been a year since this was published, but have you updated the code at all? I was wondering if I could get your help in adding some features to your code. First, I would like to add a feature to turn on/ off the built in garage door light without opening the door, and I would also like to add in the ability to monitor and open / close two garage doors instead of just one door. Finally I would like to be able to add in Alexa control over the whole thing. If you have time I would like your help please. I am new to python programming.
@@Steve_Does_Stuff Thanks for the fast reply. This raspberry pi stuff is addictive. I stayed up late last night figuring out how the wall control unit works so that I can also control the light on the door opener. I have a Genie Pro Excelerator door opener that was installed in 2007. I'm not sure if the following information is standard for all door openers, but for my Genie Pro I figured out that the door control unit sends a 5v signal to the wall control switch assembly. In the wall switch assembly I traced the path of the circuits and figured out that if the "door" button is pressed it just shorts the 5v reference voltage to the return wire, but if the "Light" button is pressed the 5 volts passes through the switch, to first a 82.5 ohm resistor and then a 121 ohm resistor in series and then back to signal return. I didn't have a 203.5 ohm resister sitting around, but I did have a couple of 100 ohm resistors, so late last night with the help of a couple of jumper wires and a bread board, I verified that if I jump the garage door control pins at the opener through a 200 ohm resistor, only the light will turn on / off and not open the door. With that information, and an extra relay, maybe you can work light control into your code. Thanks again for your video. I am learning a lot from them.
Nice project. Can Alexa control it as well?
I assume you need to be on the same network as the Pi with your phone?
Nice project and easy to understand. Can you suggest how to add code to log.py to send an email if the door has been open too long? I know it should go around line 31, but not sure of the syntax necessary to use msmtp to send the email. From the command line it is "echo "message text" | mail -s "Subject text" email-recipient.com " but this does not work if I insert it at line 32 of log.py. Any ideas or help with this? I am sure others would like to do this as well.
Thanks!
Actually, the send-to should be email-recipient@gmail.com. Sorry about that typo.
@@Steve_Does_Stuff THanks much for your reply. I did attempt to use ssmtp but found out that it is no longer supported. Instead, it is recommended to use msmpt. After a lot of fussing with it, finally got the syntax and setup figured out and it is working just fine. Thanks for this great tutorial.
You should add a raspberry pi camera so when door opens it takes a snap shoot of the person at the garage door
or a 20 sec clip. ;)
This I would be interested in if anyone has details on how
@@johnb6982 so far been busy working on getting solar power to run my garage but I may have to work on that this summer and figure it out
Is it possible to log all attempts to open/close the doors? I want to make sure no one is trying to brute force open the doors.
@@Steve_Does_Stuff Thanks! Works great. I'm trying to use IFTTT webhook to send my code via POST, but I keep getting a KeyError. If you have any advice I'd be thrilled, but if not I'll happily keep digging!
And, I figured it out :D Thanks for this video. I'm having a blast building.
Dominic McIntire
How did you figure it out
Thanks for this Steve! I seem to have everything working except for the autostart of the webserver .. Not working through rc.local, have tried through init.d then gave up when trying to use through Supervisor ... I am running the latest raspberry pi os Release date: August 20th 2020
, Kernel version: 5.4 . Anyone else having this issue or knowwhat image to run? Thanks :)
For those who have the same issue I've fixed it! I still used the rc.local way of autostarting but for some reason I also had to run :
sudo chmod 755 /etc/rc.local
sudo chmod 755 /home/pi/GarageWeb/log.py
sudo chmod 755 /home/pi/GarageWeb/web.py
im having trouble getting the log script to run correctly any chance of some assistance
@@Steve_Does_Stuff I got the log script to run, I think after i worked the scripts out, I was using the wrong relay, it was a 8 relay arduino one which the pi didnt supply enough power to the relay, I have since bought another relay which looks basically same as yours but I think it was faulty when I received it, will get another relay and try that, I will post if I need further assistance thanks for the reply
Hey Steve, got a quick question, so I have everything hooked up and it works great, Except! The magnetic switches do not work when used in web.py . If I load the log.py they work as intended. When i start web.py it starts with door closed no matter the position, when you activate the door it goes to a question mark and never updates again. Any thing you can tell me to point me in the right direction?
@@Steve_Does_Stuff SWEET thanks Steve!
@@Steve_Does_Stuff I just rewatched the video and sure enough you did say it doesn't refresh the page lol, sorry Steve I hate to be one of those guys
@@Steve_Does_Stuff Yessir I've seen the video, does it also work with google? I ran into this project because I bought an android headunit for my car and I thought it would be cool to control the garage door from an app on my headunit! You are the man sir Hope you have a great night.
Steve...thanks for help with the email. Now I have another question...I would like to implement this with just one magnetic switch. How would log.py need to be modified so it will work with just one magnetic switch instead of the 2 that you are using? Thanks!
@@Steve_Does_Stuff Thanks Steve. It took quite a bit of fiddling and trial-and-error, but after many hours this non-programmer finally got it to work with the one magnetic switch. It was also pretty easy, once I figured out the correct syntax, to use msmtp to send emails and text messages to notify me of the open, close and 15 minute reminder of the door activity. Great learning experience.
Thanks!
I'd be really curious how to do this with HomeBridge so that the Pi can talk to my Apple Home app.
@@Steve_Does_Stuff I'm looking forward to it! I'm buying a pi zero and picking it up on Monday. I'm going to do this with my 10-year old daughter as a change to teach her basic Boolean logic. If I go the Homebridge route, I'll send you a link to the code.
@@Steve_Does_Stuff Thanks for this! I have made some modifications which uses json. When the code is clean, I'll send you a link to my finished code. I also used the Apple Shortcuts app to automate it.
@@TheNewGreenIsBlue what’s the status of your project?
I currently have the pi hooked up with my HapNodeJS. And this exact set up.
I was looking into if I could convert my pi into a homebridge and then install the HAPNodeJS garage opener file to it. But I’m a bit stuck on how to do that.
Have you made any progress?
Can you do this with the PI Pico ?
@@Steve_Does_Stuff with the pico W now out , thinking of trying. I'm just a beginner
What about multiple garage doors?
this guy did the same thing with multiple doors, has links to his code and parts as well ua-cam.com/video/p2abZ90-eU0/v-deo.html
@@JerryMarshall Thanks!
Hey Steve!
Thank you for making this video! I am new to programming and Pi, so this was a fun project to work on and build my skills! I'm hoping you could help me with a bit of debugging. I have the server up and running and I am able to see all three door status messages. However, when I send the passcode "12345678" the relay to command the garage door does not work. When I ran the "relaytest.py" the relays kicked on as expected. Hope you have the time to help and thank you again!
@@Steve_Does_Stuff Thank you so much for your help! I was able to figure out from your video that you are using relay 4 not relay 1 on your relay board. I am using a 2 relay board and not a 4 so when the code was entered it was trying to turn on relay 4 which I don't have. Thank you again for the replay and cant wait for more project videos!
Hi Steve, congratulations on the project, I have already done it for my two garages and it works perfectly, unfortunately I had to use two Raspberry Pi with two different ip, it would be nice to implement on a single raspberry the choice of which door to open, given the large size amount of GPIO available to double the functions.
EXCELLENT the idea of sending an alert when the door opens, but not via email, it would be better and more immediate to receive a notification with TELEGRAM with the use of a personal BOT, which alerts me at 5 minute intervals until closes and notifies me of the closure ... Greetings from Italy.
Dang! It's so long! Bet you haven't heard that before.
too bad this does not work on raspberry 5 :( can you make code for rb5?
I have an update version of the program that uses Python 3, so it should work on the Pi5
Siri Controlled Garage Door Opener Using a Raspberry Pi. DIY Project Complete Tutorial
ua-cam.com/video/wfsYFM-9Dns/v-deo.html
"Not knowing the status of the door is what's bothering me"
Welllll, I would personally be a lot more bothered by having this little Pi open to the Internet with the ability to control the garage door.
Depending on how valuable the items stored in the garage are, here is how I'd run this. Put the actual control of the garage relay on a separate R-Pi with its own wireless AP which provide wireless service to the drive way area. NO internet connection whatsoever.
Then put your magnetic switch on another device with Internet connectivity and have it configured with a push notification system and all the bells and whistles of remote access if you really wanted to.
Bottom line is, don't trust the Internet of things to be all secured, especially when handing off the keys of your house.
Too many wires... I thought we moved to the age of wireless. MyQ.
peepee
couldn't agree more
steve, i can't run python log.py . this error message is File "log.py", line 7, in
logfile = open("/home/pi/GarageWeb/static/log.txt","a")
IOError: [Errno 13] Permission denied: '/home/pi/GarageWeb/static/log.txt'
what's the solution?
@@Steve_Does_Stuff now my error is this File "log.py", line 28
if DoorOpenTimer == 1: #Door Open Timer has Started
^
SyntaxError: invalid syntax
Steve, I have an update. I spent yesterday installing the Raspberry Pi Zero Z and associated hardware onto my two garage doors. The Wiring was pretty easy to set up. I wired them to 4 relays as I am planning for the future. In the future I want to not only be able to control the doors with my phone ( and Alexa ) but also the lights. Currently I have "web.py" from this video up and running on the Pi Zero, but I've run into a bit of a snag. I found that when I start "web.py" through SSH everything works great, but after I close my SSH session the program crashes and will no longer respond to my phone or desktop ( at 192.168.0.xxx:5000 ) . Have you heard of this happening before? I plan on downloading your newer software in the future, as "web.py" was mainly a proof of concept for now just to make sure that I had at least gotten the 1st door hooked up correctly. I don't know if you can tell, but I am excited about this project. Not because I need this function, or I have a use for it, because it's fun to learn this stuff and doesn't cost very much to experiment with.
@@Steve_Does_Stuff Thanks for the information. I was thinking that might work, but I haven't had a chance to try it yet.