Introduction: IOT Garage Door Opener (Android and Intel Edison)
This instructable will describe a method that uses an Intel Edison and an Android phone/tablet app as a garage door remote control. This is not really a new idea and I am aware of similar projects already out there on the web, but this is my version of an IOT Garage door opener and the way it works is as follows:
The Edison runs a Python script that listens on a WiFi socket (port) and when it receives the correct password (over the WiFi socket connection from the Android app) the Edison will activate a relay that is connected to the garage door opener open/close button. The Android app has a very simple/familiar user interface that consists of a touchscreen button to open/close the garage door. An app "Settings" menu is available to configure the WiFi settings and the users custom password.
Note: I chose to use Android because 1) I have an Android phone and 2) there are many free courses on the web that teach Android programming. It is of course possible to make a version of this for the iPhone (or Blackberry ;) but I do not plan to make an iPhone (or Blackberry) version.
Step 1: Configure the Edison Hardware
I used an Intel Edison with the Arduino breakout board (EDI1ARDUIN.AL.K) and initially used the Grove kit Base Shield board and connected the relay to the digital port D3.
In the final version, I re-purposed a VCR cassette box to use as an enclosure which required removing the Base Shield and connecting directly to the Arduino breakout board due to height constrains of the enclosure.
Step 2: Configure the Edison to Use a Fixed IP Address
I will assume that your Edison is already setup and running on your home wifi network. If not there are many tutorials on the web (check YouTube) that cover the basic Edison setup.
We want to have a fixed IP address on the Edison because the Android app must connect to this address in order to communicate to the Edison. To do this, modify the file: /etc/wpa_supplicant/wpa_cli-actions.sh and comment the udhcpc line and insert the ifconfig line (see below): vi /etc/wpa_supplicant/wpa_cli-actions.sh
... if [ "$CMD" = "CONNECTED" ]; then kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid # udhcpc -i $IFNAME -p /var/run/udhcpc-$IFNAME.pid -S ifconfig $IFNAME 192.168.0.199 netmask 255.255.255.0 fi ...
Step 3: Install the Python Script on the Edison
Create a sub-directory in the root home directory. I named this directory bin. If you choose a different name, you will need to modify the gdstart.sh script to match (see next step).
<p>cd<br>mkdir bin cd bin</p>
Install the gdserver.py python script in the new directory and modify the password line:
PWD = 'secret password'
to whatever you want you password to be.
Step 4: Configure the Edison to Run the Python Script at Startup
To configure the gdserver.py script run whenever the Edison starts up, do the following:
<p>mkdir /etc/init.d<br><copy the gdstart.sh script to the /etc/init.d directory> chmod 755 /etc/init.d/gdstart.sh update-rc.d gdstart.sh defaults</p>
Step 5: Install the Android App on Your Phone
The Android app can be downloaded from the Google Play Store. To find it, search for "Sierra Circuit Design Garage Door" (or just "Sierra Circuit Design" if you want to also see my other apps).
Note: I have not published the Android source code on GitHub. If I decide to upload it, I will add a link here.
Step 6: Configure the Android App
Use the setup menu to configure the app for your WiFi network and garage door password.
Step 7: Connect the Relay to the Garage Door Open/Close Button
Most garage door openers will have a wired garage door open/close button, which is usually a button mounted on the wall of your garage that connects by a wire to your garage door opener. Simply wire the relay in parallel with the existing wired garage door open/close button.
It is also possible to wire the relay to the open/close button on a remote control. I did not try this, but it should work.
Step 8: Debugging
Hopefully it all just works, but if it doesn't here are a few things to try:
First double-check the phone and password setting in the Android app
Next make sure the Python script is running (it should have started automatically)
> ps | grep gdserver 230 root 18828 S python /home/root/bin/gdserver
If it is not running (no output from the grep command), try starting the script manually.
Participated in the
Intel® IoT Invitational