I had security system wired to RJ-11 modem port on switch that would call a specific number if alarm was triggered. I wanted to get rid of IPS provided switch and instead plug SFP and fiber optics directly into my router. But then I couldn’t be notified of alarm because my router doesn’t have RJ-11 port for isdn and alarm system doesn’t support VOIP. So I decided to make notification system using Raspberry Pi.
First, I had to figure out how to tell raspberry whether alarm is on or off. That was quite easy. I measured the voltage on siren connectors that was 0V in the normal state, and about 12V when alarm was on. Perfect. Then I connected relay on the same connector. Now when alarm is on, both sirens and relay receive 12V.

I made a simple circuit, similar to one used for push button for Raspberry Pi, but used relay instead of a button. Now when alarm switches on, relay does to and raspberry can read that through gpio. All we need now is software.


I already had installed wiringPi for accessing gpio pins:
1 2 3 4 5 |
git clone git://git.drogon.net/wiringPi cd wiringPi git pull origin cd wiringPi ./build |
I wrote a simple python script that checks gpio state every second. If there is a change in gpio read value, it checks its state again because I experienced false reads about twice a week due to unknown reasons. Then it runs sh script, which is used for pushing notification.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import time import os import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) int = 0 lastState = 1 while True: if lastState == 1 and GPIO.input(4) == 0: #alarm was off and now it's on - send sms / push notification time.sleep(1.2) if GPIO.input(4) == 0: print 'Sending notification' os.system('sh /home/user/alarm/push.sh') if lastState == 0 and GPIO.input(4) == 0: #alarm is on print 'Alarm is still on' if lastState == 1 and GPIO.input(4) == 1: #alarm is off if lastState == 0 and GPIO.input(4) == 1: #alarm was on and now it's off print 'Alarm is now off' lastState = 1 lastState = GPIO.input(4) time.sleep(1) |
I used pushbullet for pushing notification to my phone. They provide API for pushing notification via curl. I could also use SMS service provider to send SMS to my phone instead of pushbullet through API, but since I have data plan for my phone, I don’t need it.
Here is the shell script
1 2 3 4 5 6 |
#!/bin/bash API="pushbullet api id" MSG="Alarm is turned on!" curl -u $API: https://api.pushbullet.com/v2/pushes -d type=note -d title="Alarm" -d body="$MSG" |
I run some tests to see if everything is working like it should, then I added cronjob for executing python script at reboot and set notifications for other family members.

Please update post with a parts list.
Parts used are:
Raspberry Pi
10k & 1k Ohm resistors
12V relay (don’t remember which exactly)