Project SpaceLock - Architecture & Design

  • 1,127 views
Uploaded on

Finally done with the Design and Architecture Description of our Project - http://spacelock.madetokill.com

Finally done with the Design and Architecture Description of our Project - http://spacelock.madetokill.com

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,127
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
38
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Architecture & Design Abhishek Mishra, Aditya Sagi, K Sree Harsha, Prabhat Godse http://spacelock.madetokill.com
  • 2. Introduction This document aims to provide an overview and a detailed description of Project SpaceLock. It is meant to have an overview of how components of SpaceLock interact with each other, the user and the environment. Before discussing various modules, it clarifies the basis on which the project has been split into modules. It also talks about reasons behind choosing a particular set of tools and libraries to realize these modules. Document Overview  Solution Overview o Introduction o Vision Statement o Scope o Objectives o Execution Overview o Team Members  Architectural Strategies o Detecting Motion o SMS Alerts o Camera Control o Web Interface o Web Server o Database  System Architecture o Components Overview o Component Interaction Diagram o User Stories  Intruder Interaction with SpaceLock  User Interaction through SMS  User Interaction over Internet/LAN  User Interaction with Control Module  What Happens on Intrusion?  Detailed System Design o Control Module o Motion Detection Module o Web Interface o SMS Module o Camera Control Module  Glossary
  • 3. Solution Overview Introduction Deployment System Project SpaceLock aims to unite already existing technologies of your infrastructure into a robust Video Surveillance System. It’s a Software Solution based on .NET Technologies, that aims to reduce your cost and assure security. The end users installs SpaceLock over their system, attach a webcam, attach an optional cheap GSM cellphone, put webcam over optional rotator mount, configure SpaceLock to suite themselves and that’s all. Vision Statement “Put video surveillance in reach of Everyone by Cost Minimization and Re-Use” Scope Project SpaceLock is developed to help a common person easily assemble a reliable security system at home or workplace. Project SpaceLock aims to provide – intrusion alerts, access & control over distance, video recordings of events. SpaceLock is software that works with hardware provided by the user. Hence, the features vary according to the kind of hardware it gets from you. SpaceLock is not only limited to small area security, but can also be implemented to wide area monitoring and for monitoring any kind of motion.
  • 4. Objectives Project SpaceLock aims to –  put visual security in reach of everyone by cost minimization and re-use  make SpaceLock easy to assemble, install, configure and maintain  present a new way to look at visual security  put before you a unique example of hardware, software & network integration  instill the same passion which drives us into our friends  send out a message on how to maximize our potential with what we already have Execution Overview SpaceLock, once configured and set into monitoring mode, watches the defined area for motion. Once a motion is detected and happens to cross the tolerance limits, it sends the user an SMS alert and starts recording a video of the intrusion. With tracking algorithms, it rotates the camera to keep intruder in the view. The user can either come over to the place of installation or access the live stream / intrusion log over the network. By configuring the local network properly, the web access can also be extended over internet. Team Members (team SpaceInvaders) Abhishek Mishra (ideamonk@gmail.com) – Web Interface in ASP.NET, Project Management Aditya Varma Sagi (ragingflames@gmail.com)– Camera Control, Electronics K Sree Harsha (sreekharsha@gmail.com)– Image Processing, Motion Detection Prabhat Godse (prabhat.godse@gmail.com)– Application Development over C#, Security
  • 5. Architectural Strategies A talk about the Architectural Strategies we decided to go for would be incomplete without specifying the requirements that the strategy aimed to fulfill. So here is a list of strategies classified under different requirements of the project –  Detecting Motion: SpaceLock needs to monitor a specified area and look if there is any motion. Any kind of motion above a fixed tolerance level translates to occurrence of an intrusion. For this, we need to interface the webcam and need to have a backend that allows us to do fast Image Processing. Since, a live video is also relayed over the Web Interface, the Image Processing work shouldn’t consume too much time. That is necessary to give a real time view of place where SpaceLock is deployed. Matlab Aforge OpenCV Domain Research, Mathematics AI, Robotics, Machine Computer Vision Learning Portable ? Needs MCR (200 MB) Yes Yes Size Bulky Lightweight Comfortable Size Speed Acceptable Slow Fast Developer Community Huge Small Big and Growing Updates As per MathWorks Less frequent Frequent (as the releases community develops it) For Motion Detection, we analyzed the existing solutions. The first choice was Matlab. But, it failed to meet our needs of portability and fast image processing due to its bulkiness. We tried another library called AForge, natively made for .NET. Aforge came out to be a generalized library and a little slow on motion detection. Intel’s OpenCV was the last stop. Unlike Matlab and AForge, it is dedicated to Computer Vision. We also found interesting wrappers like emguCV that interface OpenCV and .NET. This makes it possible for us to write Image Processing Code in C# and remove the need of inter-process communication as needed with Matlab implementation. While Matlab hinders portability and speed, AForge has a small developer community. In this scenario, it seems practical to choose OpenCV for our needs.
  • 6.  SMS Alerts: What good is a security system which doesn’t alert you on time? What could be the best way to alert the users? Now, considering India, there is no doubt that it’s a very fast growing cell- phone market. India has already ousted the US in terms of cell-phone users (http://computing.in.msn.com/articles/article.aspx?cp-documentid=1308265). This surely calls of the need of SMS alerts in SpaceLock. The users can change setting of SpaceLock and enter their GSM based cellphone number for SMS alerts. In an event of intrusion, the users get timely alerts. To be able to do so, we chose the GSMComm library (http://www.scampers.org/steve/sms/libraries.htm). Again, the .NET compatibility of this library has been the major push for this choice. It’s lightweight and has a very comfortable syntax. [Note: SMS features require the user to dedicate a GSM phone for SpaceLock. One can easily set this by choosing a cheap cell phone coupled with a provider which gives cheap/free SMS services.]  Camera Control: SpaceLock aims to track an intruder. It also has to provide the user with the ability to change camera orientation remotely at click of a mouse. For this we need a rotatory mount using Servo motors and have it connected with the PC/Laptop for control. A Servo motor is a high precision motor, and needs a microcontroller to control it precisely. We chose AVR-CDC and AVR-USB for this part for the following reasons – o Simple USB -serial converter o Works well on Windows Vista as well as older versions o Creates a COM port o No drivers required
  • 7.  Web Interface: Doing work through web is popular today. A Software with a web interface provides much more accessibility and reach, than the traditional install-and-user software. SpaceLock too aims to let user access and control the surveillance system at a distance. So, for the web interface, we had 4 options: o PHP/MySQL  FREE  Popular  Familiarity  MVC frameworks available  [-] separates from core development environment – Visual Studio o Ruby on Rails  Popular  Simplicity  [-] Lack of Ruby experience  [-] Too much time to be spent on learning RoR o ASP.NET Classic  Popular  Integrates Well  [-] Treats web development as app. Development  [-] Lacks simplicity o ASP.NET MVC  Simpler way to program ASP.NET  Clean separation of contents  Supports existing ASP.NET features  Integrates well with Visual Studio We tried ASP.NET MVC and found it to be easy to learn and suitable for project as it harnesses the power of .NET with a great IDE – Visual Studio 2008.  Web Server: Since Web Development for SpaceLock is planned to happen in ASP.NET MVC, IIS 7 is an obvious option to go for. Additionally IIS is known to have great stability, supports ASP.NET, Easy to configure, and comes bundled with Windows Vista.  Database: We chose SQL Server 2008 Express Edition. Again for it is free and mixes well with our Visual Studio 2008 Express development setup. Familiar development environment was a priority here.
  • 8. System Architecture Components Overview Components: SpaceLock is divided into 5 components. This division is direct reflection of differences in responsibilities and working of different modules. 1. Control Module – This is the main module of SpaceLock that runs on the Computer. This acts like a bridge between other modules and uses them to make the whole system work. It in a way, focuses on overall logic of the security system. Some core functions of this module: a. Lock the deployment system for security with a password b. Provide an interface to configure SpaceLock c. Use other modules to make decisions d. Alert the user on abrupt disconnection of Web Cam 2. Motion Detection Module – This module utilizes OpenCV APIs to keep a watch on user defined area for occurrences of motion. Some functions: a. Does analysis of live images b. Records video on intrusion c. Rotates camera to track intruder d. Prepares live streams for Web Interface 3. Web Interface – This is the web interface through which the user accesses and controls SpaceLock. It’s functions: a. Status & Live View of the area under surveillance b. Set camera orientation, save/load positions c. View / Manage Activity logs d. Change settings through web e. Help on SpaceLock
  • 9. 4. SMS Module – This helps SpaceLock send and receive SMS over GSM Network. This controls the phone attached to SpaceLock through COM port and communicates to Control Module. Some tasks: a. Sends alert messages to the user b. Lets user control SpaceLock through SMS c. Alerts the user in case the Camera gets detached 5. Camera Control Module – This helps the user with rotating/repositioning the Camera. It interacts with the Web Interface, Motion Detection Module and Control Module for inputs. Its helps in – a. Positioning the Camera properly to get view of important areas b. Tracking the Intruder c. Live User monitoring at a distance Component Interaction Diagram: This diagram shows how the 5 components of SpaceLock interact with one another and how a user gets access to SpaceLock.
  • 10. User Stories: To have a clear picture of how SpaceLock works, it would be nice to show use case diagrams for all the ways a user/intruder interacts with the system. Here are all the possible cases of user interaction: 1. Intruder Interaction with SpaceLock 2. User Interaction through SMS
  • 11. 3. User Interaction through Internet/LAN 4. User Interaction with Control Module
  • 12. What Happens on Intrusion?
  • 13. Detailed System Design 1. Control Module: Control module is an independent module that runs all the time on the deployment system. Control Module co-ordinates functions of other modules and controls them in order to build up a responsive surveillance system. Control Module also provides an interface for configuration and additional security to make deployment system tamper proof. Responsibilities: a. Additional Security on Deployment System / Password Lock b. Triggering SMS module on Intrusion c. Triggering SMS module on Camera Failure d. Providing an Interface for configuration of SpaceLock e. Letting user control camera position Constraints: This module is functional only till all other modules are functional. On failure of a module, it tries to raise an alert, however it cannot assure recovery from such situations. The execution of this module signifies that SpaceLock is active, however we say SpaceLock is functional only when all other modules are also working smoothly. Composition: This module has following sub-components, divided on the basis of interaction and function –  Communication Handler: It takes care of the communication that occurs between Control Module and other components. This is done using Sockets, by listening for signals and sending relevant control signals to other modules  Security Manager: Control Module locks the deployment system for preventing unauthorized access. The Security Manager takes care of this task. It also monitors for activeness of critical modules, and raises alerts/appends logs when other modules fail in their function.
  • 14.  Configuration Manager: It provides an interface to change SpaceLock settings for the owner/users of deployment system.  Database Handler: The Web Interface and Control Module share a common database to reflect changes easily. This mainly focuses on connecting and handling query results of the database. Other details:  Developed in C#, no additional libraries needed  Uses Sockets for communication  Utilizes Database over SQL Server 2008 Express 2. Motion Detection Module: Motion Detection Module keeps looking for intrusions in the area of surveillance by detecting motion. Once motion is observed to be above threshold level, it signals the Control Module about the intrusion and starts recording the video. Once an intrusion is over, it signals Control Module about completion of video recording. The Control Module then appends the video and other information into the Database. This communicates to the Camera Control Module as well to track the intruder. Since the camera image is directly available to this module, it also takes care of streaming them live. Responsibilities: a. Detecting Motion: Motion detection is done through Difference Image method using OpenCV API calls for image acquisition and analysis. b. Recording the Video of Intrusion: This module also utilizes OpenCV APIs to generate an video of intrusion in AVI format. c. Video Compression: For better scalability and optimal use of space, it compresses the video using free, open source compressors like ffmpeg. d. Intruder Tracking: An intruder might move out of area under surveillance, Motion Detection Module also analyses the images for motion and rotates the camera in such a way that intruder remains in view for maximum time. Constraints: If the intruder moves too fast, this module might not be able to capture/track it properly. The user also needs to configure SpaceLock to suite lightening conditions over area of surveillance.
  • 15. Composition:  Communication Handler: It takes care of the communication that occurs between Control Module and other components. This is done using Sockets, by listening for signals and sending relevant control signals to other modules  M-JPEG streamer: The acquired images from camera are continuously pushed frame by frame in motion-jpeg format and sent over a specific port using sockets. The live image can be easily played over web interface by using a simple <img> tag with src attribute set to url of m-jpeg streamer. http://en.wikipedia.org/wiki/Motion_JPEG  Motion Detector: This has the responsibility of detecting motion in surveillance area. It uses OpenCV APIs to analyze images. Apart from alarming the Control Module about intrusion, it also communicates to Camera Control Module to rotate the camera in order to track the intruder.  Video Recorder: It generates videos in AVI formats using OpenCV APIs. This video is then compressed and an entry is made in main database by Control Module. Other details:  This module never interacts directly with the user.  It utilizes the Camera and Camera Control Module as its resources.  Recording Algorithm – Lookout Time – The time after last motion detection till which the area is monitored for further motion. o Start recording on intrusion o Record and Monitor for motion till Lookout Time o Keep Recording till there is not further motion even after Lookout Time o Compress and Signal Control Module to append Intrusion Log.
  • 16. 3. Web Interface: This module facilitates the user with access over Internet or Local Network. It runs over an IIS7 server setup. It shares the common database with Control Module. It’s based on ASP.NET MVC, written in C#. Web Interface interacts with all other modules apart from SMS module. A Prototype – Responsibilities: a. Live Video / Status: The web interface lets the user monitor the current situation at area of surveillance at a distance. For this it provides Live View of the area using m-jpeg streams and shows current status of SpaceLock deployment. b. Remote Camera Control: The web interface allows users to control the camera position and rotation. The user is also allowed to define pre-set positions and load already defined one. One can even start or stop the surveillance. c. Intrusion Archive: The Web Interface lets users browse through old records of intrusions and one can even add notes to particular intrusion record. It also allows one to manage the intrusion archive. d. Settings: This module also enables change of SpaceLock Settings remotely. However critical settings are not available in web interface due to lack of trust as to who is accessing it? Is it the user, or someone else using the logged session e. Security: The access to the Web Interface is restricted by password. f. Online Help: The users can learn how to use SpaceLock easily over this web interface using the Help Section
  • 17. Constraints: The Web Interface doesn’t allow one to change the access control password for Control Module active on the Deployment System. Also, the videos in intrusion archive can be streamed given, the client has proper plug-ins and codecs at place. Alternatively, videos are also available for download. Composition: The composition of the Web Interface can be broken into main sections it has as shown here – These sub-sections can also be easily mapped onto sub-sections in the mock design – Resources:  IIS7 Webserver Running on Deployment system  SQL Database shared with Control Module  Bandwidth for access over internet
  • 18. Interfaces: Here are some mock templates of web interface that Project SpaceLock aims to realize:
  • 19. 4. SMS Module: This is a helper module and listens to Controller Module for tasks. It helps in sending out timely alerts about intrusions or system failures. It also helps the users control SpaceLock. Responsibilities: a. Intrusion Alert: It sends out an alert to the user through SMS about any intrusions that take place. b. System Failure Alerts: Whenever key components of SpaceLock, e.g. the Camera gets disconnected or a module doesn’t function properly for a long time, the SMS module sends out an alert to the user so that one can checkup the system for faults. c. SMS Control: A user can also opt to control SpaceLock through SMS. Before the user enters the area of surveillance, a small SMS can be sent to cell-phone attached to SpaceLock, which in turn gets verified and requests to stop/start SpaceLock can be handled. Constraints: Availability of cheap cell phone sets to dedicate to SpaceLock, and availability of cost effective SMS plans by telecom providers, happens to be the major constraint here. Though prices are reducing and companies like Reliance have introduced radical Rs.25 SIM cards with great free SMS features, it’s finally left for the user to find a cheap cell phone and SMS plan. This feature is kept optional for cases where the user does not wish to have SMS alerts. Composition: The SMS module is composed of:  SMS Dispatcher: Sends out SMS to the user defined phone number. Listens to Control Module for commands.  SMS Command Analyzer: Validates received SMS on the Cell Phone attached to SpaceLock and sends the command over to Control Module for implementation.  Cell Phone: User’s dedicated cell phone attached to SpaceLock.
  • 20. 5. Camera Control Module: It is basically the Servo motor mount over which the webcam is mounted. It helps the user rotate the camera in 4 directions – Up, Down, Left, Right. This module is based on AVR-CDC as described in Architectural Strategies – Responsibilities: a. Intruder Tracking: It rotates the camera as specified by Motion Detection Module to track a moving intruder. b. Web Control for Camera: It lets the user control camera angle and position through internet/LAN by interacting with Web Interface module. c. Camera Control from Control Module: It also listens to Control Module for commands so that the user can manage position and angles from Deployment System Constraints: It cannot rotate too fast as Image Processing task of Motion Detection Module gets affected by its motion. When it is in use by the user, there is no intrusion detection. This is because, the intrusion detection is based on motion, and if camera itself rotates, it leads to false positives. Interaction with other modules:
  • 21. Glossary  .NET - The .NET Framework is Microsoft's comprehensive and consistent programming model for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes.  API - An application programming interface (API) is a set of routines, data structures, object classes and/or protocols provided by libraries and/or operating system services in order to support the building of applications.  ASP.NET - ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites.  AVR - The AVR is a Modified Harvard architecture 8-bit RISC single chip microcontroller (µC) which was developed by Atmel in 1996  AVR-CDC - AVR-CDC is a USB-RS232C interface using the CDC (Communication Device Class) protocol. Although the bulk endpoint required for CDC is not allowed within the low-speed USB standard, it works fine on major platforms.  C# - (pronounced C Sharp) is a multi-paradigm programming language that encompasses functional, imperative, generic, object-oriented (class-based), and component-oriented programming disciplines.  COM - COM is the original, yet still common, name of the serial port interface on IBM PC-compatible computers. It might not only refer to physical ports, but also to virtual ports, such as ports created by bluetooth or USB-to- Serial adapters.  Deployment System – The Computer on which SpaceLock is installed.  Difference Image - http://www.ai.mit.edu/projects/cog/VisionSystem/motion_detection.html  EmguCV - Emgu CV is a cross platform .Net wrapper to the Intel OpenCV image-processing library.  FFmpeg - FFmpeg is a computer program that can record, convert and stream digital audio and video in numerous formats.  GSM - GSM (Global System for Mobile communications: originally from Groupe Spécial Mobile) is the most popular standard for mobile phones in the world.  IIS – Internet Information Server  Image Processing - In electrical engineering and computer science, image processing is any form of signal processing for which the input is an image, such as photographs or frames of video; the output of image processing can be either an image or a set of characteristics or parameters related to the image.  LAN – Local Area Network  MVC - Model–View–Controller is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.  OpenCV - is a computer vision library originally developed by Intel. It is free for commercial and research use under a BSD license. The library is cross-platform, and runs on Windows, Mac OS X, Linux, PSP, VCRT (Real-Time OS on Smart camera) and other embedded devices.  PHP - PHP is a scripting language originally designed for producing dynamic web pages.  Query (SQL) - A query is an inquiry into the database using the SELECT statement. A query is used to extract data from the database in a readable format according to the user's request.  SMS – Short Messaging System
  • 22.  Sockets - Normally, a server runs on a specific computer and has a socket that is bound to a specific port number.  SQL – Sequential Query Language  Surveillance - close observation of a person or group  USB - Universal Serial Bus (USB) is a serial bus standard to connect devices to a host computer.