Sunday, September 29, 2013

Garage Door Part 1 - Open Door (GPIO Output)

Project Garage Door

My vision for our Garage Door is to have an automated way to open and close it from both a web interface and a proximity sensor.

It has taken me a couple of weeks to finally get everything working, but I finally have my garage door automated, with the help of the Raspberry Pi.  I will break out each of the steps it took into a different article: Open Door (GPIO Output), Monitor Door (GPIO Input), Web Interface, Vocal Notification, Proximity Sensor.

First step was to get the garage door to open.  I started with trying to determine how I could get the Raspberry Pi to trigger the garage door to open/close.  After inspecting the wired garage door button, I found a simple solution to trigger the garage door.
Garage door button
The garage door button has two wires that run all the way to the garage door motor.  I found that by simply jumping the two terminals (circled in red below) this would trigger the garage door.  (FYI: The right two terminals are used for the safety closing door sensor, which makes the center terminal a common terminal).  This made the solution fairly easily, as I would simply need to electronic switch to close the circuit, which I had already posted a working solution for in my Driving a Relay using GPIO and Automated Sprinkler System First Look (Relay Module) articles.
Garage door motor
I could have run wires all the way from the Raspberry Pi to the garage door motor, but as the garage door button was much closer, I instead ran a set of wires (20 gauge door bell wire I picked up from Home Depot for cheap) to the back of the garage door button and connected them to the screw terminals I found there (Note: these new wires can be seen as the red/white combo in the garage door button picture above).

I then connected the Raspberry Pi, with attached Wifi dongle, to a breadboard and wired up a relay (relay-diode-transistor-resistor) as described in Driving a Relay using GPIO).  A pre-built Relay Module would have been easier, but I did not have an extra one on hand at the moment.  I then placed the Raspberry Pi and breadboard into a plastic container, to keep the dust off (which I cut holes for venting).




Raspberry Pi in plastic container to protect from dust

To trigger the electronic relay switch, which will in turn close the garage door button loop, I use the following Python code.


trigger_door.py:
#!/usr/bin/env python

import RPi.GPIO as GPIO
import time

GPIO_PIN = 25

GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_PIN, GPIO.OUT)

try:
    print "Trigger Garage Door"
    GPIO.output(GPIO_PIN, GPIO.HIGH)
    time.sleep(.5)
finally:
    print "Cleaning up..."
    GPIO.cleanup()

You may have noticed that the code makes no mention of if it will be opening or closing the door.  That is because at this point, there is no way for the code to determine the current state of the garage door.

Stay tuned, in the next article, for solution to detect the state of the garage door: Garage Door Part 2 - Monitor Door (GPIO Input)

2 comments:

Nusrat Borsha said...

That's really incredible! You have done so well with your garage door! What garage door parts or operator parts have you used? I would like to buy those from AODretail because they have the best service providing accessories I ever had!

Muneer Ahmed said...

You can just tell that patching is essential if the entryways don't open without issues. A firm sound might be Clarks Garage Door & Gate Repair Reseda