aAlarm V2 : Intrusion detection with an Arduino based alarm

Updates

New version

Version Française

Update 11/17/14 : WiFi CCTV, Motion and RaspberryPi

Working on other topics since last update I’m back to improve this project some more.

I bought an Axis network camera. I’m planning to improve video part using Motion, which I’ve talk about last year.

Also, I’ve replaced the old fashion and fat laptop with a tiny RaspberryPi.

300
Figure 1. Axis camera and Rpi

Axis 207MW

A nice device to replace my usb webcam :

  • Better image quality, especially in poor light condition. I also use an IR led projector.

  • WiFi : Allowing a remote install without usb cord

  • RJ45 connector : Easiest configuration

  • Perfect motion support

Motion

It’s a software motion detector.

Real time analysis is a lot faster than with ZoneMinder.

Configuration through a classic text file is a easiest and efficient.

Using netcam_url allows to get image from camera (IP:8081/jpg/image.jpg for Axis 207MW)

Motion event can be stored in a database, which is convenient to reuse images.

RaspberryPi

Standard latop has been replaced with the tiny nano-computer.

I’m using Raspbian (Installed using Noobs)

Everything looks fine, except the fact that Motion requires some tweaks in order to get a fast motion detection.

(I’ve reduced camera resolution to VGA)

Next ?

I will try to explain in details my aAlarm setup. My next task in to improve some Perl code and Django web monitor.

I’m also planning an Android interface, but that would take some time.

Update 04/11/13

I’m currently testing Motion, a camera motion detector.

Recently, I’ve reinstalled aAlarm to a fresh Ubuntu Server box. For unclear reasons I could’nt use ZoneMinder at all, my C270 is not detected anymore.

It’s working smoothly with Motion. Motion service is also faster to start than ZoneMinder. Motion does not come with a complete Web UI (as in ZoneMinder), but it’s by far easier to use. Also, Motion provides db support. Each recorded image could be registered into db. I will integrate Motion with aAlarm, allowing replace ZoneMinder service.

Soon more about it.

Overview

AAlarm is an alarm system based on Arduino.

Feel free to leave your comments at the bottom of the page.

Features

  • Up to 13 digital sensors

  • Control panel: Matrix keyboard, LED status, Buzzer

  • Piezo-electric siren

  • Web Interface

  • Sending email alert

  • Playlist playing (Sound presence simulator)

  • Video recording (Using ZoneMinder)

  • Configurable through Web Interface

Video demo

  • Overview of web interface

  • Use Case 1: Activation and deactivation of the system without intrusion

  • Use Case 2: Activating the system with intrusion

Youtube aAlarm presentation

Future Improvements

  • Create a complete home automation solution (remote control of electrical devices, wireless capabilities) including aAlarm

  • Complex sensors using the Arduino analog inputs

  • Multi-user : personal access codes, per zone and per user permits

  • Event logging by user

  • Event Planning (Turn alarm off on a specific time frame, for a particular user ..)

Hardware

aAlarm consists of three electronic modules connected via USB to a PC.

Main board

The main module is based on an Arduino Uno board, connected as a classic Arduino shield.

The main module concentrates connections to :

  • Control board (matrix keyboard) connected I2C

  • Siren board

  • Detectors

  • PC (Serial over USB)

300
Figure 2. Main module and Arduino Uno
300
Figure 3. Main module and Arduino Uno connected
300
Figure 4. Main module with Arduino, RJ11 connector (to control board), siren power board (without siren!)
300
Figure 5. Main board wiring

Control board

Connected with I2C, it can be placed relatively far from the main board (more than 5 meters in my case). I used a telephone-type cable with RJ11 connectors on both sides for a clean and easy connection.

The connection cable also carries power for operating the board components (5v).

Features:

  • Enable or disable alarm

  • Visual status (Green and Red LEDs)

  • Audible signal (buzzer)

300
Figure 6. Open box
300
Figure 7. Closed Box
300
Figure 8. Wall mounted control box
300
Figure 9. Keypad board wiring

Siren (optional)

The siren is supplied with current by a voltage booster circuit. (This type of siren requires small current to operate)

Thus, the module converts the Arduino 5v output to 12v, with a sufficient level of decibels to wake the whole building..

300
Figure 10. Siren power board
300
Figure 11. Siren board wiring

Sensors

Arduino has 14 digital I/Os. With siren connecyed, it is possible to connect 13 sensors on the main module.

Currently, I use a single detector door. It consists of a simple second hand switch.

Placed against the door of my apartment, the sensor detects door status : Open or Closed.

I’ve tested with multiple sensors connected (some simple switches). However, I would try to connect a gas or a smoke detector on free inputs.

300
Figure 12. Door detector (open)
300
Figure 13. Door detector (closed)

Camera

ZoneMinder allows you to use one (or more) USB webcam.

I use a cheap Logitech cam to monitor the front door.

300
Figure 14. Logitech C270 Webcam

PC

I’m using an old second hand laptop recovery. Several reasons for this:

  • Easy to fit

  • Works on battery and provides power to the entire alarm system in case of power failure (plus my modem is connected to an APC, this way alerts continue to be sent)

  • CPU power : ZoneMinder is a intensive CPU user. I doubt that a RaspberryPi would be sufficient.

300
Figure 15. aAlarm : Acer 6100 (AMD Turion) and electronic boards

Audio playlist playing

I use a spared amplified speaker, placed near the door. Play music when I’m leaving home.

Software

aAlarm has 3 software components:

  • aAlarm Controller, written in Perl, which provides interface with Arduino

  • The program loaded in Arduino itself

  • A Web client written in Django

The Controller and the Web client communicates through a data model (MySQL) built with Django ORM.

general
Figure 16. General overview

Perl Controller

This is the main software component.

It communicates with Arduino, checking sensors states and determines the overall status. On the other hand, it intercepts commands from the web client to run them.

  • Serial communication (Serial over USB) with Arduino (Device::SerialPort)

  • Sending emails (MIME::Lite)

  • Database (DBI)

This Perl script also checks the ZoneMinder service is running and playlist is playing

Default settings are provided by a configuration file. Later, settings are saved in database and becomes the reference.

Arduino program

An evolution from the first version, simplified and more effective.

Checks sensors states, in case of change, notify the Controller. In addition, it controls the electronic components (LEDs, Buzzer, Siren) according to the orders passed by the Controller.

Web Client

Initially, the Web client was written in PHP. Using Django allows more development flexibility, and provides an integrated ORM.

The Web client provides a real-time view (Ajax) of statuses and allows to remote control aAlarm.

Features:

  • Real-time status of the alarm and sensors

  • Real-time ZoneMinder and playlist status

  • Remote control (Enable / Disable alarm and services)

  • Event history

  • User authentication (Django)

  • Intrusion viewing (Using intrusion images from ZoneMinder)

  • On the fly settings (some configurations, however, require a reboot of the controller)

300
Figure 17. Homepage: Global State (Online), sensors (door closed, playlist playing, ZoneMinder is running)
300
Figure 18. Homepage: Global State (Alert), sensors (door closed, playlist stopped, ZoneMinder is running) - It’s a confirmed intrusion !

Data Model

The data model is maintained by the built-in Django ORM.

  • Event: Events (global state and sensors)

  • Execute: Orders from the Web Interface

  • Parameter: Application Settings

300
Figure 19. Data Model aAlarm

ZoneMinder

ZoneMinder uses USB cameras (or IP) with motion detection.

This optional service is launched by aAlarm, and provides access to intrusion recordings.

How it works

Global State

AAlarm is based on six linked global states.

Each state represents a different situation that causes actions

  • OFFLINE: Disabled alarm

  • TIMED: Transient state, allowing user to get out

  • ONLINE: Enabled alarm

  • INTRUSION: A sensor has changed, the deactivation code must be entered

  • WARNING: The deactivation code was not entered correctly, warn the intruder with a sound (buzzer) and send a first email to user

  • ALERT: The siren is triggered, an email alert is sent

The transition from one state to another is determined either by user actions or by a changing sensor state.

states
Figure 20. Global state cycle

Sensor states

The door sensor can be open or closed. It is possible to create other types of sensors through configuration.

Special sensors

Monitoring of optional services (ZoneMinder and playlist playing ) are implemented as sensors. Thus, they appear in the interface as conventional sensors.

Download

aAlarm history

Arduino and intrusion alarm

A very basic system, using matrix keyboard
Communicates to a PC through USB and mail sending
Then I made aAlarm current software

Previous version

The first full version AAlarm was functional, but basic:

  • Few settings

  • Simplistic model data

  • Web client written in PHP / MySQL

Improvements

  • Refactor of Perl Controller

  • Many settings (file and database)

  • New data model based on the Django ORM

  • Web client rewritten with Django

  • Integration with ZoneMinder (video monitoring tool)

  • Playlist playing to simulate presence

comments powered by Disqus