A Raspberry Pi Garage Door Opener

We can never seem to get enough garage door hacks around here. [Tanner’s] project is the most recent entry into this category. He’s managed to hook up a Raspberry Pi to his garage door opener. This greatly extends his range to… well anywhere with an Internet connection.

His hack is relatively simple. He started with the garage door opener remote. He removed the momentary switch that was normally used to active the door. He bridged the electrical connection to create a circuit that was always closed. This meant that as long as the remote had power, the switch would be activated. Now all [Tanner] had to do was remove the battery and hook up the power connectors to his Raspberry Pi. Since the remote works on 3.3V and draws little current, he is able to power the remote directly from the Pi. The Pi just has to turn its pin high momentarily to activate the remote.

The ability to toggle the state of your garage door from anywhere in the world also comes with paranoia. [Tanner] wanted to be able to tell if the door is up, down, or stopped somewhere in the middle while he was away from home. He also wanted to use as little equipment as possible. Since he already had an IP camera in the garage, he decided to use computer vision to do the detection.

He printed off two large, black shapes onto ordinary white computer paper. One was taped to the top of the door and one to the bottom. A custom script runs on the Pi that grabs the latest image from the camera and uses OpenCV to detect the shapes. If both shapes are visible, then the script can assume the door is closed. Otherwise, it’s likely open. This makes it easier for [Tanner] to know if the door is opened or closed without having to check the camera himself.

I actually did that for a gate opener at our working place. I removed the batteries from the remote and powered it from the pi, so if the pi is on, the remote is on. Had to add a fet and a relay to pull the line for the button to ground, I soldered a wire to an existing via on that trace.

I have a similar setup. Instead of bridging the button on the remote, I connected it to a MOSFET (instead of a relay) and wired it all in a single enclosure, using motion to broadcast images & state over Jabber: http://hackaday.io/project/2049-garage-security

Step back – he can open a door he’s nowhere near. I’m not entirely clear on the utility of this. Plus, random stuff connected to the internet that can allow access to your house, what could possibly go wrong?

An example would be forgetting to close the door and now you’re far away from home. It would be nice to be able to close it and confirm that it’s closed. Another example would be having it alert you if the door state changes while your security system is armed. Thanks! Tanner

Exactly what I was thinking. I have my garage door opening by a R-Pi as well and just use a magnetic switch to let my webpage know if it’s up or down via a query from the web server to one of the Pi’s GPIO ports connected to it.

What??? There are far easier and more reliable ways to do this, but I suppose that’s what you’d expect with a RaspberryPi based project.

When I did something similar, I connected a relay to the *wired* button for the garage door opener. The Pi is near the garage door, right? Just use a bit of wire. Then cracked open the door opener and found the limit switches that it uses so it knows when to stop the motor at the end of travel. These happened to be about 30V on my old model door opener. Two appropriate series resistors and optoisolators later – a nice reliable digital input for closed, open and in between. (Reed switch would be fine here too.) No need for a spare remote, shape detection and all that over-complicated nonsense.

Cool that the OP got to work out some computer vision, but 0xfred suggestion is largely my angle as well; my garage door opener merely needed a relay across the switch terminals to trigger the door, and a reed switch that is activated in the closed position covers off sensing all non-closed states. KISS all the way.

This is a bad design. The raspberry pi GPIO pins are only supposed to source up to 16mA, and the 3.3V Rail should have no more than 50mA across all the GPIO pins. He’s powering the whole garage door opener, which includes a transmitter, off a pin that should only be sourcing no more than 16mA. It would not surprise me if this eventually fried that GPIO pin or had other random strange effects on the Pi.

A MUCH better option would have been a little more complicated but not risk any components: have the GPIO drive a MOSFET which would be connected to a linear regulator on the 5V line. That way the GPIO still controls the garage door opener but doesn’t source any current on the pin, the opener gets 3V or whatever the LDO is set at, and the current is being sourced from the 5V rail, which has a lot more room to provide power.

I’m sorry if this comes across as hating. I’m in a bit of a bad mood and it’s hard not to write in one. As a prototype or one-off, this may work for a while. But it’s pushing the Pi beyond a limit, and it may cause problems for him later that will be difficult to diagnose, and it’s not a practice that should be recommended or used in other designs. That’s why I was pointing out why it was a bad design and what could be changed to make it a better design.

Kudos to the OP for getting it working in the first place, and the solution of providing power and shorting the switch is a clever way of doing it with minimal pins.

Can you explain why you are so sure this is a bad design in terms of current draw without knowing more about power requirements? A lot of these transmitters run on cr2032 batteries which are designed to have a peak discharge current of something like 12mA and a continuous discharge of .2mA. That doesn’t seem to really be pushing it unless the device is operating outside the specs for the battery.

Stop the hating people. This is a start.
Some suggested additions.
1. a Carbon Monoxide sensor. If the detected you could have it set off an alarm and open the garage door.
2. Us the camera board on the pi to detect how far forward you have pulled up.
3. Have the pi detect when your phone comes in range and use an external camera to detect if the car is pulling in or leaving and have the pi open and close the door for you.

I agree. Why? sometimes something is done just to do it, to learn something, because you need a project to do.

I have been contemplating the same thing but hard wiring it instead. Just ’cause I can.

Also with remote access to the door, you can let someone in who doesn’t normally have a key. It would be possible to accept a delivery when you are not home and not have them leave it on the porch. Leave the door up about a foot. When the delivery is made, close the door.

I have an alarm already with it’s own relay board (that’s integrated with my automation system) so I just added an alarm OHD sensor so I can confirm if it’s open/closed and I did the same thing except wired the openers power into the relay board of the alarm via a old PC power supply that also powers my gate latch (via the same relay controls) which allows the gate and garage door to be opened either via the automation interface or my keyfob for the alarm (also allows automatic unlocking or locking of the gate in case of fire/burglary)..

I rent in an apartment, so definitely wouldn’t be allowed to wire anything directly to strata property. Unfortunately, the antenna for our garage system is deep in the basement and we can’t trigger an opening until right next to the door. We have to wait 30s on a very busy street before entering.

With this sort of setup, I could hide a box in our storage cage (which has power, is in WiFi range of the apartment, and RF remote range of the gate) and trigger an opening over 3G while 30s from home. Sure, it’s extreme overkill for what is essentially a range booster, but I’ve got nearly all of the parts lying around already.

This could have been simple. Attach the I/O pins to a relay that would be connected to the motor itself, same leads that go to the momentary switch at the door. I find stupid to use a remote when there is no need for it.