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|
|Garage door motor|
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.
#!/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)