A web interface for remote residential garage surveillance. This uses a Raspberry Pi to connect to a universal garage door opener via GPIO and a webcam or Raspberry NoIR video camera.
Raspberry Pi (works with all models) | https://www.adafruit.com/product/2266 |
Raspberry Pi NoIR Camera (or a spare Video4Linux-compliant webcam) | https://www.sparkfun.com/products/12654 |
Chamberlain Universal Garage Remote | http://www.chamberlain.com/clicker-and-accessories/universal-clicker-products/clicker-universal-remote-control |
Resistors, NPN transistors, NPN MOSFET | Available at Sparkfun, Adafruit, Radio Shack or from de-soldering unused electronics. |
Optional: Honeywell Temperature and Humidity Sensor | https://www.sparkfun.com/products/11295 |
Ensure you install necessary updates and install a firewall (such as UFW) before proceeding. Rather than exposing motion and other services externally, we will be proxying them through Apache. This means the only ports you should need to open are port 80 (HTTP) and port 22 (SSH), especially since motion hasn't has as extensive vetting for security. As an example, you could setup a simple firewall as:
sudo apt-get install ufw
sudo ufw allow 80
sudo ufw allow 22
sudo ufw enable
Bear in mind GarageSec uses BASIC HTTP authentication and does not necessarily support SSL out of the box (although you could definitely add it), so man-in-the-middle interception of your password is super-de-duper possible.
Also - the latest version of Raspian (Jessie) doesn't bring up wireless interfaces on boot by default, even for the RPi 3. Which is odd. To fix this, make sure your wireless interfaces in /etc/network/interfaces
are set to "auto," such as:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
It may be a good idea to create a crontab entry to delete old captured videos, e.g. 0 1 * * * find /home/motion -ctime +14 -delete
To enable I2C communication for temperature and humidity monitoring, follow the I2C instructions from Adafruit available at https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
See http://hackaday.io/project/2049/instructions for hardware installation
These installation instructions have been tested with the latest version of Raspian (Jessie)
- Install the base packages with
sudo apt-get install wiringpi python-dev python-smbus python-imaging apache2 libapache2-mod-proxy-html libapache2-mod-authnz-external motion nodejs-legacy libav-tools npm monit
- Install Bower using
sudo npm install -g bower
- Enable the Apache2 modules using
sudo a2enmod authnz_external proxy_http
- If you are using the Raspberry Pi camera, add
bcm2835-v4l2
to /etc/modules - Edit
/etc/default/motion
and set it to start on boot - Clone this repository or download https://github.com/deckerego/GarageSecurity/archive/master.zip which will include the Bottle webapp and some admin configs/scripts
- Install GarageSecurity's dependencies using
sudo pip install -r app/requirements.txt
- Expose any GPIO ports you connect the garage door opener or light switches using the WiringPi GPIO Utility, e.g.
gpio export 17 out
. You may want to add this statement to/etc/rc.local
so that it will be exported at startup. A sample rc.local is provided. - Allow the pi user to access motion files by adding it to the
motion
user group in /etc/group - Copy the files within the app/ directory into /srv/garagesec
- Change into the /srv/garagesec/views directory and execute
bower install bootstrap
- Copy the service config files from config/etc into the appropriate /etc directory, altering them as needed.
- Copy the alert scripts from the
scripts/
directory into/usr/local/motion
, modifyingrest_call.sh
so that API_USER and API_PASS are set to your "pi" usernamed and password used to log in to Apache - Create a copy of app/config.sample as /srv/garagesec/config.py, altering config.py to fit your preferences
- Enable the webapp with
sudo a2dissite 000-default
, followed bysudo a2ensite security
, then start up (or restart) Apache2 - Ensure config/etc/init.d/garagesec has been copied to /etc/init.d, then install it using
sudo update-rc.d garagesec defaults
- Start the webapp using
sudo service garagesec start
You may find that the GPIO buttons don't work as expected - this may be due to permissions issues within the /sys/class/gpio/
devices. This can sometimes be fixed by changing /etc/udev/rules.d/99-com.rules
to have the following gpio rules: SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c 'chown -H -R root:gpio /sys/class/gpio/* && chmod -R 770 /sys/class/gpio/*; chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio'"