Skip to content
evanmj edited this page Jul 12, 2013 · 25 revisions

calzone: A free, web enabled home alarm system for the raspberry pi, etc.

This program enables a web interface on the raspberry pi using flask. The hardware is configured to be compatible with standard home security system window and door switches, motion detectors, etc, so if your home is pre-wired, you should be able to get a system up and running pretty quickly.

When running "in production", the flask app will need deployed using WSGI to your favorite web server (lighttpd works well). See INSTALL file.

The program allows user selected OpenID (google, facebook, etc) authenticated users to arm and disarm the system, see status, zone history, etc.

When a GPIO triggered zone changes state while armed, the alarm will sound.

Alarm notification options include:

  • audio from the sound card (user provided wav file)
  • E-Mail
  • SMS (Text Message) via E-Mail Gateway
  • Visual web display in browser (when accessed)
  • Eventually maybe a hardware GPIO output for a bell or lighting options, etc.
  • Eventually maybe X10? (See README.md about future features)

Much credit and thanks goes to Miguel Grinberg for his Flask Mega Tutorial!

Functional Diagram

overview

Screenshots

login

index

zones

history

Features

Currently Supported / Working:

configurable zones (Configure zone name, and GPIO pin numbers, via admin interface after first login)
configurable users (OpenID Login users configured via admin interface after first login)
configurable OpenID providers (google, yahoo, OpenId, twitter, etc., configured in config.py)
remote web access via desktop, tablet, phone, etc.
remember users per device
logging of alarm, and arm/disarm events to the history table
logging of zone all changes to the history table.
audible wav file played when a zone is breached while armed.
admin section with access to user tables, settings, email lists, etc.

Things that are planned for near future support:

email/sms alerts (close but not working just yet).
configurable door/zone entry sound (when unarmed)
configurable settings such as volume ramps, siren timouts, etc.
history table needs "5 minutes ago" style column (maybe with toggle to date/time)
database log size limiting by number of events or storage size.

Things that 'would be nice' to eventually support:

gpio output for alarm horns / lights / sounders
X10 motion detectors/lighting/etc (serial x10 module)
dyanmic dns support (client)
more language support.. so few words anyway, it should be simple.

Things that are never planned to be supported:

video/camera monitoring/recording (zoneminder does this better)
      If the rpi camera reaches anything useful, it is too close to possible intruders!
      I'm not opposed to doing this I guess, but unless someone sends me a camera I'll probably never try it.

text message / phone calls to 911 or other emergency services (too much liability)

Hardware Setup

calzone uses Raspberry Pi Hardware GPIO Pins for each zone input. The almlogic/hardware.py program handles updating the IO from the GPIO in case you want other hardware sources.

Requires: wiringPi installed.

Pull up resistors are enabled on each input pin, so they will see 3.3v.
If you ground them out through the zones, the 3.3v will go away (pulled down through ground). Note: An external 10k resistor on the GPIO pins will protect them from unintentional short to ground if they are misconfigured as an output by mistake. Grounding an output pin with no protection resistor will damage your rPi!

Zone Wiring:

    + 3.3v  ---<10k pull up internal>-------| |---------| |---------| |--------| |--------<GND>
                                           sensor       sensor      sensor     sensor

Simulating Hardware (For Bench Testing, etc)

Define one or more zones.
Run ./run_alarmlogic.py
In a new terminal, run:  
     gpio mode <pin> down
          (this will unsecure the zone)
     gpio mode <pin> up
          (this will secure the zone)

If no wires are hooked up and no pull up or pull down resistors are selected, the pins can float, which you can see if you run 'gpio readall' a few times in a row. The above commands are useful (especially down) when you are testing and don't want to get up to open a door... the command 'gpio mode 1 down' simulates opening my back door (gpio pin 1).

Physical Installation

My calzone system is being used to replace the system that was installed in my house when built. Typically, when a system installer installs a security system, they will own the bulk of the equipment, but the wires are yours. My house was pre-wired, and luckily was labeled!

physical install I left the 'commercial unit' in the box because it all fit easily, and I left it all re-usable. Also, the commercial unit takes in low voltage AC and converts it to 12vdc that I can later use to power the Raspberry Pi if I want to remove the 120v to USB adapter and replace is with a 12v to 5v switching regulator. The benefit of doing that is that the commercial system is battery backed, and should maintain the SLA battery shown at the bottom of this pic. I'll run my 12v speaker system off the battery backup as well, and since my wifi/internet is battery backed I should not lose the system in short power outages. This is pretty low priority, but cool considering it had all the stuff there already.