Skip to content

A front-end to the Raspberry Pi that uses the NoIR camera & GPIO for remote residential door control

License

Notifications You must be signed in to change notification settings

plasmacorral/GarageSecurity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GarageSecurity

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.

Hardware Punch List

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

Security & OS Setup

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

Hardware Installation

See http://hackaday.io/project/2049/instructions for hardware installation

Software Installation

These installation instructions have been tested with the latest version of Raspian (Jessie)

  1. 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
  2. Install Bower using sudo npm install -g bower
  3. Enable the Apache2 modules using sudo a2enmod authnz_external proxy_http
  4. If you are using the Raspberry Pi camera, add bcm2835-v4l2 to /etc/modules
  5. Edit /etc/default/motion and set it to start on boot
  6. Clone this repository or download https://github.com/deckerego/GarageSecurity/archive/master.zip which will include the Bottle webapp and some admin configs/scripts
  7. Install GarageSecurity's dependencies using sudo pip install -r app/requirements.txt
  8. 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.
  9. Allow the pi user to access motion files by adding it to the motion user group in /etc/group
  10. Copy the files within the app/ directory into /srv/garagesec
  11. Change into the /srv/garagesec/views directory and execute bower install bootstrap
  12. Copy the service config files from config/etc into the appropriate /etc directory, altering them as needed.
  13. Copy the alert scripts from the scripts/ directory into /usr/local/motion, modifying rest_call.sh so that API_USER and API_PASS are set to your "pi" usernamed and password used to log in to Apache
  14. Create a copy of app/config.sample as /srv/garagesec/config.py, altering config.py to fit your preferences
  15. Enable the webapp with sudo a2dissite 000-default, followed by sudo a2ensite security, then start up (or restart) Apache2
  16. Ensure config/etc/init.d/garagesec has been copied to /etc/init.d, then install it using sudo update-rc.d garagesec defaults
  17. Start the webapp using sudo service garagesec start

GPIO Permissions Issues

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'"

About

A front-end to the Raspberry Pi that uses the NoIR camera & GPIO for remote residential door control

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 60.9%
  • Shell 17.3%
  • Smarty 13.3%
  • JavaScript 7.5%
  • CSS 1.0%