Google Analytics

Monday, March 25, 2013

A Home Security System - Design Narrative

Design Narrative

Keywords: BeagleBone Black, Python, Tkinter, Raspberry Pi, RPi, Arduino, Security System, Home Automation

May 18, 2013  (Table of Contents)

Since the last posting (March 25, 2013), which documented the use of the Raspberry Pi  (RPi), I have become aware of a new platform - the "BeagleBone Black" (B3).

The B3 has the some elements, such as faster and more powerful cpu, but primarily because of the increased number of I/O pins, including analog, that the B3 provides over the RPI.  This change will provide, in my opinion, a superior platform, and ultimately a lower overall cost because of the increased number of I/O pins - I was going to have to implement a separate hardware Mux to get all of the I/O I was going to need for the project, and this was probably going to have to be an Arduino, which incurs it's own associated additional costs.

The costs between the two platforms is minor: $35 for the RPi vs. $45 for the B3.

So, moving forward, I will be using the B3.

Design update:

  • GUI Interface

    • I have done a mock-up of the GUI For the system.  It's not finished, and it may look completely different at completion, but this is what I'm currently thinking about implementing (see picture below).  This isn't functional - it's just a picture of a Python GUI implemented in Tkinter, but shows the current concept.  It shows a big area that serves as a flashing alarm in the Home area (something in alarm in the home), then the Area involved, then the Zone involved, then the sensor involved.  All will flash (alternate white/red background) until acknowledged, then seal-in to show the state.  A new event (return to normal, or another sensor goes into alarm) will cause it to go back to flashing.  Every action will be performed from this GUI, from any computer on the system or remotely when I'm away, via Smartphone or Internet connected device.  From here I will also be able to take a sensor Inactive (bad sensor), Bypass (we want to have the backdoor open and not alarm), as well as the state of the sensor (Normal, Alarm), by selecting the sensor involved and changing it's state (e.g., if going from active to Inactive, or active to Bypass)
  • Sensors will include:
    • Window open/close magnetic sensors
    • Door open/close magnetic sensors
    • Motion detectors (PIR)
    • Smoke detectors
    • Carbon Monoxide detectors
    • Natural gas detectors (not sure if these exist or not yet)
    • Water detectors (flooding in basement rooms)
    • Doorbell
    • Loss of Electrical (office, refrigerators, basement utilities room)
  • The security system will divide the home into the following:
    • Areas
      • Basement (this is a live-in basement with one side exposed to the yard outside; our yard slopes, so three sides are below ground level, and one side is at ground level),  with a den room, full kitchen, bedroom, exercise room, living room, bathroom, with two (2) entrances (one from outside, one from inside) and four windows (two in bedroom, two in living room).  This can function as an in-law suite.  This level also has all utilities, such including Internet and security system convergence, as well as a furnace room where I want to monitor for Carbon Monoxide and Fire/Smoke.
      • First Floor.  This floor has three doors: one to garage, one to back yard, and one to front yard.  There are 10 windows and a door on the back, one door on the front, and one garage door that will need to be monitored.  One bedroom.
      • Second Floor: There are four bedrooms and a utility room, each with windows and doors, and a central hall, all of which will need to be monitored.
      • Attic: There's a furnace up here, so I want to be able to check for Carbon Monoxide leaks, as well as water leaks.
      • Garage: Carbon Monoxide, Fire/Smoke.  It also has an outside door, and two car entry/exit garage-doors, along with two windows.
      • Outside: Front door area, driveway area, basement area, back yard area.
    • Zones
      • Each area will be broken down into zones.  For example, the Basement area has the following zones:
        • Living room
        • Bedroom
        • Kitchen
        • Utilities room
        • Furnace room
        • Exercise room,
        • Den
      • Similar breakdowns from Areas to Zones will be done for each Area.

March 25, 2013 (Back to Table of Contents)

Keywords: Raspberry Pi, RPi, Arduino, Security System, Home Automation

Raspberry Pi

The security system is based on a Raspberry Pi (RPi) device.  It may incorporate the use of an Arduino in order to facilitate work with external hardware devices - this is under evaluation.  

The RPi will provide the following services:

  • Web App Hosting via Tornado
  • Python program execution
  • File system for data retention
  • TCP/IP network communications
  • Communication with Arduino for hardware communications, via RS232
Python will provide the program Model, View, and Controller (MVC) services.  It will also provide:
  • Ability for the Administrator to configure the via a remote web monitoring page.
  • Ability for the Administrator to change the state of the system, sensors, and control elements via the remote web monitoring page.
  • Ability to monitor the status of the security system.
  • Ability to push status information to a remote web monitoring page.
  • Ability to send SMS text messages
  • Ability to control 120 VAC contacts
  • Ability (possibility) to control X10 devices
  • Ability to control other devices through relay contacts
  • Ability to link to, or stream (undecided) video cameras
  • Object Persistence via Shelve
  • Web Pages via Tornado
  • Web Page push updates via HTML5 Sockets
The Security System
The System
The System shall be provide the following services:
  • Screens to support configuration of the system.
    • Add, modify, delete Users
    • Add, modify, delete Contact Phone numbers
    • Add, modify, delete Senors
    • Add, modify, delete Control Elements
  • Screens to show system state:
    • System Status
      • Network Connection
      • File System
      • On AC or Battery Backup
      • Watchdog
      • Sensor State (for each sensor)
      • Normal
      • Alert - time of event
      • Alarm - time of event
      • Ignore - time of event
      • Acknowledged - time of event
    • Messages (All sensors, Control Elements, System Status)
      • Messages displayed and logged
      • Events (all)
        • Time of event
      • A log entry for any change in state of any Sensor or Control Element. Will contain such information as:
        • Sensor Name
        • Zone
        • State Change
      • User Login
        • User Name
        • Failed Attempts
      • User Logout
        • User Name
      • Web Browswer IP addresses served
        • Page accessed
        • User Name
        • Invalid Attempts
The Security System will monitor all sensors for changes from normal state.  On detection of a state change for any sensor, the will perform the assigned action.  Each action is defined for each sensor by the Administrator.  The assigned action will continue until either a timeout for this sensor's action, or a command from a User.


  1. the natural gas sensor that you are refering to can be replaced by a methane sensor as all natural gas contains this molecule. just a thought. but i would not suggest you use this as just relieving yourself could trigger this sensor. and having a system that senses whenever someone does this is somewhat...immoral?and weird

  2. Haven't decided on the implementation details yet for the sensors. Price, ease of use, etc., will all be an consideration when the time comes that I'm ready to address that detail. First will be windows and doors, then a smoke detector, then CO2.

    Thanks for your post.