AAlarm is an alarm system builded with Arduino.
It's capable of detecting various events, depending on connected sensors.
In its current version, it's also using a RaspberryPi to run controlling software.
Web UI Last Camera Motion Event : Someone's home ! (Axis 207W is switching from B&W to colour accordingly to brighness)
Here's a list of required hardware :
Depending on what you need to monitor, you'll need some sensors.
I'm currently using a magnetic door sensor like this one on Amazon. Note that it acts like a switch. I'm used to monitor my door this way.
You could find the whole project in the aAlarm GitHub Repository
Use Arduino IDE to upload the program into your Arduino Board.
You'll need to install Raspbian. http://www.raspbian.org/
The easiest alternative is to use Noobs http://www.raspberrypi.org/downloads/
For this step, you'll need to connect a monitor and a keyboard to the RaspberryPi board. You wont need it later.
After installation, login through SSH.
(In most cases you'll need to install ssd with the following command : "apt-get install ssh")
I've created a Debian package for an easier installation.
Logon to your RaspberryPi, then do the following :
I'm sorry, I currently do not have an apt-source. To satisfies dependancies, you'll need a little trick.
Pay attention when you'll be prompted with mysql root password.
wget http://dev.kprod.net/sites/default/files/aalarmv2/aalarm_1.0.0.deb #ensure apt index is up-to-date sudo apt-get update #must end with some dependancies errors sudo dpkg -i aalarm_package.deb #install dependancies... sudo apt-get -f install #install package sudo dpkg -i aalarm_package.deb
If you're planning to use email alerts, install your favorite mailer.
I'm using ssmtp with allows you to send emails using gmail. It's really convenient and easy to use.
After installing the package, check this page to configure it.
apt-get install ssmtp
If you're planning to use the presence simulator, install your favorite mp3 player.
I'm using mpg123 (I will surely switch to mpg321...)
You'll need to edit "/usr/share/sh/*Playlist.sh" in case of other player installed.
apt-get install mpg123
This part must be tricky, depends on which camera model you're using.
I suggest to check the Motion Guide and test everything is working smoothly.
sudo vi /etc/motion/motion.conf
I'm dealing with the following values :
#deamon : let motion run in deamon mode daemon on #videodevice : choose video device (if you're using an USB cam, this must be the place !) videodevice /dev/video0 #netcam_url indicates where motion gets images from a network camera netcam_url //http://CAM_IP/jpg/image.jpg #netcam_userpass if required. it must be for security reasons ! netcam_userpass CAMUSER:CAMPASSWD #target_dir : indicates where to store motion images (in Django static dir) target_dir /usr/share/aalarm/webDj/static/motion #Miniserver (use for live view through java applet) webcam_port 8081 #sql_query : modified according our datamodel sql_query insert into aalarm_security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C') #mysql auth mysql_db DBNAME mysql_user DBLOGIN mysql_password DBPASSWD
We need to create a database and grant a specific user some permissions to access it.
Mind the database DBNAME / DBLOGIN / DBPASSWD, we'll need them later.
mysql -u root -p > create database djaalarm; > grant usage on *.* to DBLOGIN@localhost identified by 'DBPASSWD'; > grant all privileges on DBNAME.* to DBLOGIN@localhost;
Some data is needed by alarmSerialController in this database.
#You'll be prompted for your DBPASSWD mysql -u DBLOGIN -p --database=DBNAME < /usr/share/aalarm/sql/create_tables.sql mysql -u DBLOGIN -p --database=DBNAME < /usr/share/aalarm/sql/custom_init_tables.sql
In order to access the Arduino through USB, your user must be in dialout group
sudo usermod -a -G dialout USER
Edit settings. py and modify DBNAME / DBLOGIN / DBPASSWD
sudo vi /usr/share/webDj/djangoAAlarm/settings.py.dist
Then run Django database sync tool
Pay attention when you'll be prompted with Django admin password.
sudo /usr/share/webDj/manage.py syncdb
Edit aalarm.conf and modify DBNAME / DBLOGIN / DBPASSWD
sudo vi /etc/aalarm.conf
Then initiate parameters into Database
/usr/share/aalarm/pl/alarmSerialController.pl initdb debug
(I will soon create more convenient init.d scripts...)
Logon to your rPi and run the following command to start aAlarm
run the following command to stop aAlarm
Open a web browser and open this URL : "http://YOUR_RPI_IP:8000/admin/auth/user/"
Then create a standard user using "add user" link on the top right.
You'll be prompted with your Django login / passwd.
Then logout, and connect to aAlarm using this URL : "http://YOUR_RPI_IP:8000/aalarm/"