Most Raspberry Pi garage door remotes had open ports, or other features I wasn't too fond of. So I created my own that contains much more security, logging of who opens the garage, video capture, garage status and more.


  • 100% secure garage door operation, with access control lists. Only authorized family members can open.
  • Ability to monitor or control garage anywhere in the world from a controlled website, with no open router ports
  • Full video capture of who's coming into the garage, uploaded securely to your website for later perusal
  • Ability to remotely stop or kill the process in case of malfunction or abuse
  • Email notifications when a family member arrives or leaves the house
  • Cheap SMS solution (3/4 a cent per text), with no GSM card purchases or any cell contracts
  • Standard Linux code, easily setup on a new Pi, and quickly portable to other platforms like BeagleBone or whatever future Linux technology arrives. Basically, I wanted the ability to restore this system on a fresh device within 30 minutes or less

Step 1: Requirements

You will need:

  • A Raspberry Pi or BeagleBone Black setup with base configuration. I use Raspbian Wheezy
  • Wireless connectivity via a wireless dongle (or just plug in a network cable)
  • A camera (compatible webcam or PiCam)
  • A relay board. I use "SainSmart 5V 2-Channel Solid State Relay Board", because it defaults to LOW instead of HIGH
  • Enough wire to access your garage door opener, or just break apart a spare remote
  • A website with hosting. You can get a small amount of space on DropBox or Google Drive and use that, or you can create a random website from a cheap hosting service like 1and1.com, which will provide 100gb of space for only $11 PER YEAR. You won't need to keep these files anyhow, since they're just logs.
  • If using the PiCam, a little poster putty
<p>This is such a slick operation, thanks for posting. I&rsquo;m wondering if anyone has made this with the latest Raspberry Pi 2? Before I start working on this, I&rsquo;d like to see if there have been any issues with the latest RP? Thanks in advance!</p>
<p>Fella, this is going on my list of junk to accomplish before Spring!</p>
<p>Is there a log file so I can tell where my errors are coming from? The py runs for about 30 seconds and aborts saying an error.</p>
<p>Can someone please explain how to add phone numnber to the authorized list?</p>
<p>Great project - built it your way and everything worked great! I didn't want to continue with the email and video parts so have commented those functions out.</p><p>Instead, I added a magnetic switch on the garage door and used GPIO IN (BCM: Pin 18) to monitor switch state. Added a function in garage_sms_butler.py to get status of door (Open, Closed). Called this function with &quot;Status&quot; SMS. Also added 30 second sleep timer after OPEN or CLOSE to send a second SMS showing door's status.</p>
<p>I've been working on the same status idea as well. However, I can't get the function to work properly as the script continues to print my own error message - here's what I have. I'm calling the function down in the status section. Any thoughts?</p><p># Get the status of the garage door (open or closed)</p><p>def GetDoorStatus():</p><p> try:</p><p> if GPIO.input(18):</p><p> state = 'open'</p><p> else:</p><p> state = 'closed'</p><p> return state</p><p> except:</p><p> print &quot;Error inside function GetDoorStatus&quot;</p><p> pass</p>
<p>Hello,</p><p>I do not have an answer for you. But I have a similar setup.I used a second program I found. </p><p><a href="http://www.richlynch.com/code/pi_garage_alert" rel="nofollow">http://www.richlynch.com/code/pi_garage_alert</a></p><p>This way I knew if the garage is open by the wall mount or butler.</p><p>Scott-w</p>
<p>Hi! How do I add my authorized phone number in &quot;garage_sms_butler.py&quot; file. </p>
<p>Hey so everything is up and running pretty well, minus the shut-downs and I don't really know how to write the code to remove mysql list.. But my main question is, is there any way to hook this into the garage directly without compromising the existing door opener buttons that are also hardwired to the system? If my relay is hooked up to the opener directly, it kills the physical buttons. I tried installing in line further away from the unit as well, and it compromises all three buttons as well. Is there any way to fix this? Would a relay work without a data source telling it to activate? I have a second relay and could use a 5v power source from somewhere else to hook other three buttons to a relay if that would do anything?</p>
<p>Jumrm</p><p>Sounds like you want a setup like I have. Hardwired to the wall mounted switch. <br>I needed to change the pin setup to board.</p><p>Here is what I have</p><p>GPIO_PIN = <strong>18</strong> <br>GPIO.setmode(GPIO.<strong>BOARD</strong>)<br>GPIO.setup(GPIO_PIN, GPIO.OUT)<br>GPIO.output(GPIO_PIN,True)</p><p>Need to make sure you change the GPIO_PIN to match what you are using. </p><p>Once I changed to board All worked correctly </p><p>Scott-w</p>
<p>JulianM1,</p><p>I am having the same issues. I believe something needs to setup on Twilio website, just not sure what. I also have see that butler is eating up to process time. I found that when the process time gets over 50 mins Butler does not work well.</p><p>I have created tow simple scripts that run from cron to help this out. I do want to fix correctly. Just learning python now.</p><p>process_check.sh</p><p>#!/bin/bash<br><br># 11/20/2014<br># Check if mod_garage_sms_butler.py is running, if not start it</p><p>ps -ef |grep butler |grep -v grep |grep -v vi &gt;/dev/null<br>if [ &quot;$?&quot; -ne &quot;0&quot; ] ;<br> then<br> python -t /usr/local/etc/mod_garage_sms_butler.py &amp;<br> else<br> echo &quot; &quot; &gt;/dev/null<br>fi</p><p>run_away-process.sh</p><p>#!/bin/bash<br><br># SMS Butler Seems to be a runway procces/leak Nov.28.2014<br><br><br>F1=`ps -ef |grep mod |grep -v grep |awk '{print $7}' | cut -d : -f 1`<br>F2=`ps -ef |grep mod |grep -v grep |awk '{print $7}' | cut -d : -f 2`<br><br> if [ &quot;$F1$F2&quot; -ge &quot;0050&quot; ];<br> then<br> PS=`ps -ef |grep mod |grep -v grep |awk '{print $2}'`<br> kill $PS<br> sleep 2<br> sh /usr/local/etc/process_check.sh</p><p> else<br> echo &quot; &quot; &gt; /dev/null<br>fi</p><p>CRON JOBS</p><p>*/5 8-23 * * * sh /usr/local/etc/process_check.sh<br>29,59 8-23 * * * sh /usr/local/etc/run_away-process.sh</p><p>Scott-w</p>
<p>Scott: Try removing the database entirely, and just use the array for tracking <br>previous messages. Add a few lines to fill the array at startup with <br>all existing Twilio messages.</p>
<p>AkiraFist,</p><p>Thank you for the info. However I am very new to python. Could you give more info ? </p><p>Thank you.</p><p>Scott</p>
<p>Very nice, great idea. I am going try it when I get my pi back. :-( Borrowed to a friend.</p><p>About this:</p><p> Continuously scan Twilio's incoming SMS list</p><p>?? Should there be a 10-20 second sleep or something in there, seems a little intrusive/abusive.</p><p>Thanks for the instructable,</p><p>Al</p>
<p>Al_carr: Twilio offered to host this on their page, so apparently it's ok with them.</p>
<p>AkiraFist,</p><p>Great work by the way. </p><p>I installed the pi with the software and made modifications to the code for it to work with the PiFace board (just modified the GPIO commands).</p><p>Everything was working great for a while, but I have now started to receive the following error message when texting &quot;Status&quot; to the pi.</p><p>The error I receive is the following:</p><p>&quot;Error while inserting SID record to database&quot;</p><p>Eventually this will cause the program to bail and shut down. I then have to reboot or restart the program for it to work again.</p><p>I have made sure that the program is receiving an actual SID number from Twilio but for some reason that I cannot work through it is not able to save the record to the database.</p><p>Any thoughts on what could be causing the error?</p><p>Ray</p>
<p>Crsherman: Remove the database entirely, and just use the array for tracking previous messages. Add a few lines to fill the array at startup with all existing Twilio messages.</p>
<p> Hello Crsherman,</p><p>Where you able to work trhu this and come out with a fix ?</p><p>Scott-w </p>
<p>Why not just use email and look for passphrase or keyword and sender ID? You can send pics, datalogs, video even to that email address. Then you won't need a non-free twillio account or website.</p>
<p>Sure, design it how you'd like. Can use a phone card from Adafruit, email, bluetooth, anything that's fun.</p>
<p>Hey scott-w, i sent you a PM :)</p>
<p>My twilio was syncing for a day, and then all of a sudden stopped responding back with confirmation messages.. any idea why that would happen?</p>
<p>Hello,</p><p>I think I have all the software setup correctly. However one out of the 8 sPhone I have setup does not get anything back or I see Unauthorized user tried to access system: +1xxxxxxxxxx <br>I have tried 3 of the others in the list at they seem to work.</p><p>WORKED: 2 Galaxy S4 mini 4.2.2, 1 iPhone 5S iOS8</p><p>NOT WORKED: Galaxy S5 </p><p>Thanks for the help</p><p>Scott</p>
<p>I was able to get working on my galaxy S5. Need to type the word out completely and not use the suggestion bar to complete the word</p><p>Scott</p>
<p>Got it wired up over the weekend but it only stays running for 5-10 minutes before it errors out. Works fine otherwise...</p><p>Any idea where the twilio setting is to make it not respond with a confirmation that it received a message? </p>
<p>Hey Mr. Wilder! You can remove all the &quot;SendSMS&quot; lines and see if that fixes. If not, comment out the email portion, remove the SQL portion, and just see when it starts working again. Once you identify the culprit, email me and I'll give you a workaround.</p>
<p>Wow very cool project. Have you see the iHued cable? For $30 you can open garage from anywhere in the world, see it on the webcam in real time, and check if its open or closed... Here check out ★<a href="http://www.ihued.com/" rel="nofollow">http://www.iHued.com</a>★</p>
<p><br>Your post is really good providing good information.. I liked it and enjoyed reading it. Keep sharing such important posts.<br>&lt;a href=&quot;http://bulksmshyderabad.co.in/&quot;&gt;Bulk SMS Hyderabad&lt;/a&gt;</p>
<p><br>Your post is really good providing good information.. I liked it and enjoyed reading it. Keep sharing such important posts.<br>http://bulksmshyderabad.co.in/</p>
<p>Believe you have a typo on Step 2.</p><p>It should be </p><p>mysql-server, not </p><p>mysql-serversudo</p>
<p>Good catch, Jessica, thank you! I just fixed the typo.</p>
<p>Jliberman, yes! You can use Amazon Simple Notification services: </p><p><a href="http://aws.amazon.com/sns," rel="nofollow">http://aws.amazon.com/sns, </a> or any other method you choose. Your Pi has an internet connection, so whatever API you can find, or internet JSON call you can use would work great.</p><p>Adafruit has a great example page here using SNS: </p><p>https://learn.adafruit.com/sms-texting-pet-food-dish/amazon-sns-setup</p>
Could You use a different Texting provider? Such as WhatsApp or another compatible with the Pi?
<p>Hi Scumm7, yes you need wireless or wired connectivity from the Raspberry Pi to communicate with Twilio.</p>
<p>So is it still using ethernet or Wifi to send the SMS message? I assume it must be, but I thought maybe I missed something.</p>
<p>This is awesome. Wish it had a garage livestream. What's happening in there all day? Is it like Toy Story, but for tools? </p>

About This Instructable


561 favorites


More by AkiraFist: Raspberry Pi - SMS Garage Door Butler
Add instructable to: