Google Analytics

Monday, March 25, 2013

A Home Security System - Sensors OOD

Sensors OOD

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

March 25, 2013 (Table of Contents)


This system will be Object Oriented (OO).  This page will be concerned with the Object Oriented Design (OOD) of the Sensors.  It will make use of Polymorphism.

The root type: Sensor

A Sensor Object:
  • It has the following Attributes:
    • Name
    • Zone
    • Description
  • It has the following States: 
    • Ignored
    • Alarm
    • Alert
    • Normal
  • It has the following Transition Listeners
    • ListenerOnTransitionToAlert
    • ListenerOnTrasitionToAlarm
    • LietenerOnTrasitionToNormal
    • ListenerOnTrasitionToIgnored
  • It has the following Listener Methods
    • RegisterAlertListener
    • NotifyAlertListener
    • RegisterAlarmListener
    • NotifyAlarmListener
    • RegisterNormalListener
    • NotifyNormalListener
    • RegisterIgnoreListener
    • NotifyIgnoreListener
  • It has the following Sensor Control Methods
    • SetSensorToAlarmMode
    • SetSensorToAlertMode
    • SetSensorToIgnoreMode
  • It has the following Sensor Test Methods
    • TestSetSensorToAlarm
    • TestSetSensorToAlert
    • TestSetSensorToNormal
    • TestSetSensorToIgnore

Sensor Children Types:

  • A Magnetic Contact is a type of Sensor.
    • It has the following states:
      • Contact State
        • Open
        • Closed
    • It has the following Sensor Normal Methods
      • DefineNormalAsOpenContact
      • DefineNormalAsClosedContact
    • It has the following children types:
      • A Door Sensor is a type of Magnetic Contact Sensor
      • A Window Sensor is a type of Magnetic Contact Sensor
  • A Voltage Transition Sensor is a type of Sensor
    • It has the following state transitions:
      • Transition from Voltage Low to Voltage High
      • Transition from Voltage High to Voltage Low
    • It has the following Sensor Normal Methods
      • DefineNormalAsLow
      • DefineNormalAsHigh
    • It has the following children types:
      • A Doorbell Sensor is a type of Voltage Transition Sensor
      • A Carbon Monoxide Detector Sensor is a type of Voltage Transition Sensor 
      • A Smoke Detector Sensor is a type of Voltage Transition Sensor
      • A Water Detector Sensor is a type of Voltage Transition Sensor
      • A HVAC Temperature Controller Sensor is a type of Voltage Transition Sensor
      • A Household AC Power Sensor is a type of Voltage Transition Sensor
  • To be classified:
    • Networked Sensor
    • Video Camera Sensor
    • Access Keypad
    • Door Speaker/Microphone




A Home Security System - Web Pages

Web Pages

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

May 18, 2013 (Table of Contents)

  • Reviewing whether I will use a client/server GUI or web pages.  Not yet decided.

March 25, 2013  (Table of Contents)

Web Page

Users


  • Add User Web Page
  • Delete User Web Page
  • Modify User Web Page

Sensors

  • Add Sensor Web Page
  • Delete Sensor Web Page
  • Ignore Sensor Web Page
  • Modify Sensor Web Page

Control Elements

  • Add Control Element Web Page
  • Delete Control Element Web Page
  • Ignore Control Element Web Page
  • Modify Control Element Web Page

Monitoring

  • System State Web Page
  • Sensor State Web Page
  • Alarm State Web Page
  • Log Web Page

Messaging

  • Add Message Recipient Web Page
  • Delete Message Recipient Web Page
  • Modify Message Recipient Web Page

Video

  • Video Camera Web Page

A Home Security System - Control Elements

Control Elements

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

March 25, 2013   (Table of Contents)

  • Control Element Types
    • X10
    • 120 VAC Control
    • Door Lock
    • Relay Contact Control
    • Door Speaker/Microphone (e.g., communicate with someone who rang front door).
    • Alarm Siren
    • Alert Speaker
    • Video Camera
    • Networked Control
    • HVAC On/Off
    • HVAC Damper Control (Open/Close)

A Home Security System - Sensor Types

Sensor Types

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

March 25, 2013   (Table of Contents)

Sensor Types
  • Window 
  • Door 
  • Doorbell
  • Networked Sensor
  • Video Camera
  • AC Household Power
  • Household HVAC status
  • Water Leak
  • Temperature 
  • Smoke
  • Carbon Monoxide
  • Access Keypad
  • Door Speaker/Microphone

A Home Security System - Users


Users

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


March 25, 2013   (Table of Contents)



The [Name] has three (3) types of users: An Administrator, a Commander, and a Monitor, all of which must login to use and/or view the system.
  • An Administrator has all capabilities of a Commander and a Monitor, plus the ability to:
    • Configure the system.
  • A Commander has the capabilities of a Monitor, plus the capabilities to:
    • Set Sensor State
    • Acknowledge Alarms and Alerts
  • A Monitor has the capabilities
    • Observe the system State Web Page

A Home Security System - Glossary


A Home Security System - Glossary

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



March 25, 2013  (Table of Contents)

Glossary

  • User: any one who has the capability to log in and interact or view the system.
  • Sensor Element- an input device that detects a state change.  It has an associated Activity Action to perform.  E.g., magnetic window and door alarms, smoke detector, temperature.
  • Control Element - an output device under the control of the system, such as an Alarm Siren, a 120 VAC relay, HVAC, etc.
  • Zone - the home is divided up into Zones.  E.g., back yard 1st floor.
  • Set Sensor State - set the state of a Sensor to Alarm, Alert, Ignore. 
    • Alarm - highest level of capabilities.  Alarm Action performed
    • Alert - Alert level of capabilities.  Alert Action performed
    • Ignore - Ingore the state of this Sensor.

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.




A Home Security System - Table of Contents

Home Security System: Table of Contents

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


This will be the organized central collection of the information associated with the design, development and documentation of the Home Security System.

Section X: Project - Home Security System

Section X: BeagleBone Black - Getting Started

Section X: Design Narrative

Section X: Construction Blog

Section X:  Updates

Section X: Users

Section X: Sensor Types

Section X: Control Elements

Section X: Web Pages

Section X: Testing

Section X: Documentation

Section X: Releases

Section X: Resources



Project Update 1 - A Home Security System

A Home Security System

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


Change to architecture
April 6, 2014 (Back to Table of Contents)

I recently came back to this project after taking a break to do other things.

The current architecture (same as before):

  • Python is the primary language
  • It will run on a BeagleBone Black
The changes to the architecture:
  • Is a distributed application
  • Using Kivy for the presentation layer (GUI)
  • Monitor will be available on any GUI device (e.g., Linux, Windows, Mac, Android)
  • Uses Json for IPC and network communications


Search for a Python Oriented OODBMS

May 18, 2013   (Back to Table of Contents)

  • Have decided to go with BeagleBone Black instead of Raspberry Pi.


March 25, 2013  (Table of Contents)

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


After much research regarding Object Persistence (OODBMS) for Python, I've elected to use the built-in capability of Python Shelve.

Frankly, I'm surprised that there aren't more active Python OODBMS applications!

I investigated the following candidates, all of which must be open-source, and the reason, from my opinion, for my rejection:

  • Zodb - overkill for this application
  • MongoDB - overkill for this application, not a OODBMS
  • Buzhug - not very active, no support for Python 3 yet.
  • Pypersyst - not active
  • CouchDB - document oriented database
  • Objectivity - no support for Python 3 yet, commercial product
  • Axiom - not a OODBMS; a mapper between SQL database and objects
  • Durus - Requires a download of DurusWorks, which appears to be a complete environment.  For my application, this is more of a challenge than I want to undertake.  It may be a great product though!
  • Cog - no support for Python 3 yet.  Does not appear to be very active.
  • Poodle - no support for Python 3 yet.
  • Dobbin 0.3 - Was a potential candidate.  Says it's compatible with Python 3.x. However, no activity more recent than 11 months ago.

Sunday, March 24, 2013

Project - A Home Security System

A Home Security System

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


 (Table of Contents)


Overview

March 24, 2013
Last updated 5/18/13

  • Have decided to go with BeagleBone Black instead of Raspberry Pi.

Last updated 3/25/13

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


I'm going to be replacing my current home security system with one I'm building.  This will ultimately morph into a Home Automation System.

Here are some of the highlights and design decisions:

  • Replace the current security system main board with by a Raspberry Pi.
  • It may make use of an Arduino to interface with the various contacts - not yet sure on this approach.
  • It will interface to the Internet
  • It will have a web server interface, where it can display the current status, as well as accept commands (such as "bypass a specific door alarm as I am leaving it open").
  • It will make use of IP Tunneling for web pushes to a browser via HTML5 (web sockets).
  • It will feature SMS text messages to registered cell phones
  • It will replace the existing commercial security main board
  • It will utilize the existing window and door alarm contacts
  • It will use Python for the development language
  • It will make use of Tornado for the web server
  • It will be Object Oriented in it's design
  • It will utilize an Object Persistence framework rather than a SQL database.  I am currently researching this framework, and no technology has yet been chosen.  Update 3/25/13 - I have chosen Python's Shelve.
  • It will display multiple video cameras, and offer pictures and video retention.
  • It will interface to fire, carbon-dioxide and water-flood detectors.
  • It will be open source
  • It will eventually use thermocouples for multi-room temperature monitoring and possible individual-room control.
  • It will control multiple HVAC units for multi-floor homes.
  • It will be capable of controlling a BBQ smoker's dampers at temperature, with alarms and alerts.
I will document the design, development and deployment of this system.

My Background: I have significant electrical, electronic, and software capabilities, and this project is within my scope of expertise and experience.

Monday, March 4, 2013

I took a Nerd Test

I took a Nerd Test tonight while waiting on some futures contracts to close.

I made a 93%.

That means only 7% of the population is more 'nerdy' than me.

I think that's good.

Thinking that's good is worth two more points!


7% scored higher (more nerdy),
1% scored the same, and
92% scored lower (less nerdy).
What does this mean? Your nerdiness is:

Supreme Nerd. Apply for a professorship at MIT now!!!.






Link to test

Friday, March 1, 2013

If you are thinking about a Cisco/Linksys router

After having multiple problems with a new model EA6500 router I came across this, which is my problem:  http://community.linksys.com/t5/Wireless-Routers/EA6500-Multiple-devices-under-one-device/td-p/572310

There are, to date, 18 PAGES of people with problems.

Note these problems were reported last year, and still no fix from manufacturer!