a security system for raspberry pi 3
Go to file
ndwarshuis 02a101d900 updated readme 2019-01-31 00:06:49 -08:00
config put volume in stateFile 2017-06-24 01:11:44 -04:00
soundfx init 2016-12-30 02:51:56 -05:00
static remove jquery 2017-05-29 17:42:04 -04:00
templates no longer require janus to run, and add safety net to restart at web interface 2017-06-23 01:50:07 -04:00
LICENSE add license 2019-01-30 23:12:43 -08:00
README.org updated readme 2019-01-31 00:06:49 -08:00
auxilary.py consolidate pertinent functions in statemachine module 2017-06-10 02:48:50 -04:00
blinkenLights.py minor optimization 2017-06-18 16:11:31 -04:00
config.py better error handling for config files 2017-06-03 18:37:24 -04:00
exceptionThreading.py add support for exception-aware threading 2017-06-02 02:17:32 -04:00
gmail.py fix month wraparound in gmail module 2017-11-05 17:47:55 -05:00
listeners.py put volume in stateFile 2017-06-24 01:11:44 -04:00
main.py chdir to package before logger starts 2017-06-11 20:14:58 -04:00
sensors.py doc for sensors 2017-06-18 15:31:02 -04:00
sharedLogging.py add TODO 2017-06-17 01:28:57 -04:00
soundLib.py put volume in stateFile 2017-06-24 01:11:44 -04:00
stateMachine.py move key passwd to config 2017-06-24 00:39:28 -04:00
stream.py fix typo 2017-06-11 18:30:06 -04:00
webInterface.py no longer require janus to run, and add safety net to restart at web interface 2017-06-23 01:50:07 -04:00

README.org

Pyledriver

Home security system to be run on raspberry pi 3.

Motivation

This is a (slightly overengineered?) solution to a common problem with living in a big city. While it could probably do a decent job a securing an appartment or home (untested because our specific apartment has not been looted yet), it was also an excellent learning experience for a variety of frameworks (Flask, GStreamer, glusterFS) and programming concepts (multithreading, state machines, event-driven callbacks, video accelaration).

Detection and Countermeasures

The pyledriver security system is equiped with five IR motion sensors and a magnetic door sensor. These are managed using the excellent RPi.GPIO library. It also features a USB camera input with both audio and video (OpenMAX accelarated h.264 and opus codecs respectively) which are multiplexed using Gstreamer.

If armed, triggering any of the IR or door sensors will trigger a countdown. If the password is not entered within the countdown, an alarm will sound, and email will be sent to appropriate parties, and the camera will begin recording. The video can be saved to a glusterFS-backed directory so the files can be uploaded to a remote server and thus preserve the evidence in case the intruder finds the Pyledriver and smashes it.

Interface

  • USB touchpad for password input
  • Web interface to display video and and operate a text-to-speech engine (to yell at intruders or scare roommates)
  • linux socket for remote control via ssh

Design

The core of the Pyledriver Security System is a statemachine object to represent the disarmed, armed, triggered, and counting-down states. There are separate threads for each sensor and the USB keypad input, which asynchronously modify the state of the state machine. Each state transition has a set of callbacks that trigger alarms, make the lights blink, send emails, etc. There is also a separate thread that listens on a linux socket for commands that can trigger state changes.

The web interface is implemented in Flask and displays the video as well as provides a text input box to control the Text to speech engine (implemented in espeak).

Installation

Clone this repository

git clone git@github.com:ndwarshuis/pyledriver.git

Dependencies

Python libraries

  • python-evdev
  • python-flask
  • python-flask-wtf
  • python-numpy
  • python-psutil
  • python-pyaudio
  • python-pygame
  • python-pyinotify
  • python-raspberry-gpio
  • python-requests
  • python-yaml
  • gst-python

Linux libraries

  • glusterfs
  • gstreamer (base and good)
  • gst-omx
  • espeak

Configuration

There is a default configuration file in config/pyledriver.yaml.default. Modify options here as desired.

Future Plans

  • make web interface multi-threaded (now cannot operate text-to-speech and watch the video simultaneously, which makes it hard to yell at intruders)
  • make espeak sound like GLaDOS
  • add party mode (which really means make salsa version of "Still Alive" loop forever)