Pi Garage for Android

Version info at the bottom.
email:frank.evo2@gmail.com
Mobile users click on MENU above.
PiGarage_1024

Pi Garage

Main Screen

Settings

Never use your house keys again, Never have to replace batteries in your garage remote again, and never have to program your remote again.

Someone in your household locked out of the house? Not likely if they have this app on their phone too, but even so you can open the door for them from anywhere in the world.

Use service like Task Rabbit and need to let someone in your house, but don’t want to hide a key for them? Use this app and let them in when they get to the house.

App also contains password protection, lose your phone? a family member loses their phone or their phone is stolen? Just change the password on the Android Smart Hub and your old phone with the old password is ignored by the hub and will not open the door.

(Next Version for Android – already in iOS version)
App has “safety switch” which when activated will not let you accidentally open the door. When you enter your selected geofence zone you will then be able to open the door from the remote.

Easily select a timer length from 30 seconds to 5 minutes with slider located settings to automatically close the door after you have entered the geofence zone. Adjust timer length (longer in the summer, shorter in the winter).
Activate button is located on main screen so you can quickly enable or disable.

Also has a Quick Timer for when you manually open the door. Leaving for work open for a minute and a half to give you time to get in the car and start it and pull out and then door will automatically close for you. Parked outside and don’t want to have to fuddle with your front door keys? Set Quick Timer for 30 seconds, walk out the door and have it automatically close behind you. Need to bring in the trash cans? Set it for 3 minutes.

Cancel timer if you need more time by simply pressing the quick button (X) in the lower right of the main screen.

That was the AWESOME! her is the not so Awesome.

At this moment garage door does not send status if it is open or closed. I did not include cloud option to receive status commands from hub for safety precautions. If a phone was stolen or lost a person could use your phone to “sniff” for every new password you created and the only fix for you would be to use a new device for your hub. I personally use a garage door alarm sensor switch to detect if the door is open or shut and texting (my hub is a phone with phone service) to send texts to my phone to tell me if my door is open or shut. I have texting functionality ready to add to the Android Smart Hub and will be doing so in the not too distant future, but this does require the hub to be a phone with phone service(phone service runs $15 a month for a “bring your own device” plan).

The easiest, fastest, cheapest workaround I used first and you see in my demonstration videos is a Webcam / Network Camera / Cloud Camera this allows you to visually inspect your garage door at any time.

An option I just thought of and never tried is, almost all camera’s now come with motion sensing technology that will e-mail you when motion is detected! I will have to try that out tomorrow! I may now be able to cancel my phone service!

For the garage door alarm sensor switch I do hope to include this functionality in the future, it does require additional wiring and to setup a gpio pin to “listen” for changes instead of performing an action.(If I get enough purchases/requests).

Also because of this inability for the app to detect whether the door is open or shut, when still using old RF Garage door openers in concert with this app causes the app/hub to get “confused”. This app is like a person sitting in a dark closet with a garage door opener, you call them and tell them to open the door they do that and then write down on a piece of paper that the door is open, if you then shut the door yourself without letting that person know they still think the door is still open. That is how this app works, but if this does happen the app has a Garage Override button on the Settings screen that allows you to tell the Android Smart Hub that the door is really closed not open and then everything will again work like normal. Once I got my wife to start using the app exclusively the process really worked better than I expected.

And because of this I had to put a disclaimer on this app, if you live somewhere that you do not leave the garage door open even when you are home you would not want to use this app.

A little background on the “sensitivity” settings of the geofence zone.

100 meters – In the future when people openly allow themselves to be tracked this will be the perfect setting, the garage door opens completely just in time for you to pull in. Which is how it works for the most part now, but only if you have your phone on and GPS actively monitoring your location (maps running).

150 meters(new) – I was having issues with my phone trying to jump on one of my neighbors open WiFi networks when it also happened to be leaving my 100 meter geofence, which could cause the open/close command to get “lost”, so I added a couple more distances to allow you to fine tune your geofence.

200 meters(new) – I was having issues with my phone trying to jump on one of my neighbors open WiFi networks when it also happened to be leaving my 100 meter geofence, which could cause the open/close command to get “lost”, so I added a couple more distances to allow you to fine tune your geofence.

250 meters – If you want to have your phone off and in your purse this is the setting for you. The delay from the weak signal being received through your purse usually detects that you are in the geofence zone about 150 meters out, if you have your phone on and maps running, 250 meters will open about 30 seconds out, so if you enable the timer function be sure to add this amount of time on to the timer amount you select to give you enough time to accomplish what you need.

408 meters (Quarter Mile) – I have not needed this range, you may possibly need it if your GPS signal is very weak. Or if you live in the country this might be an option.

816 meters (Half Mile) – Again I have not used this.

1024 meters (1 Mile) – Haven’t used.

You will need to purchase 2 apps.

A HUB app for home (Can be installed on a tablet or phone running Gingerbread or higher, only needs to be connected via WiFi)
Home Automation Hub App Link

Home Automation Hub Demo

And a “client” app for all the phones you want to open the door.
Pi Garage

Things you need to do this Home Automation thing:

— Android Smart Hub —

An Android device running Gingerbread or higher.

On the Android device you will need to install:Home Automation Hub

This device only needs to have WiFi. This will be your Hub, it will stay at home and receive commands from your phone to open and close your door. The hub will send commands to the Raspberry Pi.

— Android Garage App —

On your phone you will need to purchase also and install my Pi Garage App.

Pi Garage – Google Play Store

— Raspberry Pi Hardware —

IMG_0926
1. Raspberry Pi (around $35)
IMG_0928
2. A Micro SD Card (16 GB or higher) with Raspbian and configured the way I show you here.
(If the process seems too daunting, it is harder than I wish it was,
I sell pre configured 16 GB Micro SD cards for $15 – contact me through e-mail)
IMG_0930
3. Power Cord for the Raspberry Pi (not included with just the Raspberry Pi) ($7)
You can use a cord for a Android phone if you have extras.
IMG_0927
4. A relay ($4)
IMG_0925
5. Wires to connect the relay to the Raspberry Pi ($9)
6. Ethernet Cable
7. HDMI Cable (to hook up to a TV or Monitor)
8. Keyboard and Mouse.

— Raspberry Pi Software Configuration —

When you have all this then you can configure the Raspberry Pi like I show you here.

Then configure the extras you will need to control the Raspberry Pi over the cloud:

– PHP Install –

sudo apt-get install php5 libapache2-mod-php5 -y

– Permissions to run php scripts in web directory –

sudo pkexec visudo

go down to the very bottom and add:

www-data ALL=(ALL) NOPASSWD: ALL

ctrl-o (Save)

enter (Confirm)

ctrl-x (Exit)

Custom Script Install Detail Info:

Once you get the Raspberry Pi configured you will then need to download my python and php scripts to the Raspberry Pi from Git.

To install Git on the Raspberry Pi:

sudo apt-get install git-core

My Python and PHP scripts needed by the hub app.

Make sure you are in the /home/pi directory.

Make a directory called git: sudo mkdir git

Go to that directory: cd git

Get my scripts from Git:

sudo git clone https://github.com/z4x4van/Home-Automation-Production.git

Go to Home-Automation-Production directory: cd Home-Automation-Production

Python scripts go in the /home/pi directory – I will show you a shortcut

PHP scripts go in the /var/www directory – I will show you a shortcut
(UPDATE! raspbain JESSIE has changed this location to /var/www/html

(If this directory doesn’t exist you skipped the Raspberry Pi Configuration Process step which has you install a Apache Web server and PHP).

—-Warning—-Warning—-Warning—-Warning—-Warning!

I am about to give you a command that takes you out of safe mode and into full on admin mode that will let you break anything without asking “Are You Sure?”

But this allows you to get to root which makes copying files to the right directory doable from a single command.

Make sure you type exit as soon as your done copying the files!

So while in the /home/pi/git/Home-Automation-Production directory type:

sudo su

YOU ARE NOW IN ADMIN MODE!

Now type: cp *.php /var/www/ – to put the php files where they go.

(UPDATE! raspbian JESSIE has moved the location where to put PHP files, use above for
Wheezy, Use command below for JESSIE)

Now type: cp *.php /var/www/html – to put the php files where they go.

(UPDATE! use command below for both Wheezy and JESSIE python files)

And type: cp *.py /home/pi – to put the Python files where they go.

NOW TYPE: exit

You can now go to these directories and make sure they have:

/home/pi – powerOn.py powerOff.py togMe.py

(UPDATE! raspbian JESSIE has moved the location where to put PHP files)

Wheezy:
/var/www – powerOn.php powerOff.php togMe.php

Jessie:
/var/www/html – powerOn.php powerOff.php togMe.php

If they are there Your Raspberry Pi is now ready!

— Raspberry Pi Hardware Configuration —

Once you have that done, you are ready to wire up the relay to the Raspberry Pi and this is how you do it, the project is for a garage door opener app (to be released soon) but the hardware set up is still the same.

YouTube – Raspberry Pi – Home Automation – Garage Door Opener

My apps use the Broadcom GPIO pin layout numbering system when connecting the relay to the Raspberry Pi:

GPIO LAYOUT

Broadcom GPIO Pin Layout

— Raspberry Pi Smart Hub Software Configuration —

You can now go get and install the HUB app first which will give you an IoT Chat Room Code, this is what your Hub monitors while waiting for commands from the Remote app on your phone.

When you install the Remote app on your phone it will ask for this code so it can talk to the hub.

The best way to make sure your Phone is communicating to your Hub is to try to adjust the volume on your hub by going to the slide out menu on the left side of your phone and select a volume level.

— Pi Garage Software Configuration —

If you are running Marshmallow or higher on your phone do not run the app after installing.

First go to your phone settings and go to the application section and click on the application manager icon. Then scroll down to Pi Garage and click on it. That will take you to a permissions screen and give the app permissions to monitor your location and access your storage.

Now your should be able to run the app without crashing.

It will ask you for your IoT Chatroom name which you got when you installed the Smart Hub app.

— VERSION INFO —

v3.3 – Matched up garage door status text color with button color.

v3.2 – Switched from swiping garage door pic for opening and closing door to Open and Close buttons.

v3.1 – Added more geofence ranges.

v3.0 – Fixed bug in logic for time range to ignore geofence trigger in settings.

v2.9 – Changed logic for stronger security, removed logic that caused garage door to open when enabling geofence monitoring. Added time range setting to ignore geofence triggers.