In Phase 1 and 2 of my previous posts in this series, I showed the basic setup of a Home security + automation system. No home security system is complete without a siren/alarm so this posts addresses that.
I was looking for a way to trigger the alarm and wanted it to be completely isolated from the Pi GPIO to avoid false triggers. I also wanted to avoid using more GPIO for this project so I decided to a 433Mhz wireless siren similar to the one on Ebay here
If you open up the wireless strobe siren you will find this:
There is a small switch on the PCB to switch the circuit on/off. A white wire goes from the board to the piezo siren. For initial testing, I would recommend disconnecting the siren so that you can verify that your system works correctly without the really loud (90 dB) siren.
A 433MHz transmitter accompanies the strobe/siren to trigger it. I wanted to decode the code sent by this to allow me to trigger the siren myself. So I hooked it up to a 12V battery below and pressed the test button (see picture below).
The receiver already connected to the Pi (as shown in Phase 1) will help you find the code for your siren module. (use RFSniffer provided on the ninjablocks website to do this)
Here is a short video showing the system in action.
Note -
I was looking for a way to trigger the alarm and wanted it to be completely isolated from the Pi GPIO to avoid false triggers. I also wanted to avoid using more GPIO for this project so I decided to a 433Mhz wireless siren similar to the one on Ebay here
If you open up the wireless strobe siren you will find this:
There is a small switch on the PCB to switch the circuit on/off. A white wire goes from the board to the piezo siren. For initial testing, I would recommend disconnecting the siren so that you can verify that your system works correctly without the really loud (90 dB) siren.
A 433MHz transmitter accompanies the strobe/siren to trigger it. I wanted to decode the code sent by this to allow me to trigger the siren myself. So I hooked it up to a 12V battery below and pressed the test button (see picture below).
The receiver already connected to the Pi (as shown in Phase 1) will help you find the code for your siren module. (use RFSniffer provided on the ninjablocks website to do this)
Here is a short video showing the system in action.
Note -
- The 433 MHz door/window sensor shown here is actually one that is normally connected to my door/window and is not the one provided for triggering the siren.
- I have removed the waits in the code to trigger the siren immediately for the purpose of this video. You would normally have a delay to allow system disarm by an authorized individual
Hi Trushant,
ReplyDeleteI also started to make my home smart.
By studying I accidentally visit your page.
I have a business proposal based on this.
Please mail me at civanescu at gmail dot com.
Best regards,
Claudiu
This comment has been removed by a blog administrator.
ReplyDeleteWow! This is a very useful page and I really enjoyed reading article and all users’ comments. Smart Home Group is a privately owned and operated Technology Distribution company offering a full range of Home Automation solutions. With a strong brand presence in the Australian market, Smart Home Group continues to provide value for money solutions across a growing range of products. Thank you for sharing valuable information.
ReplyDeletethank the Smart Home Group is one of the best choices
ReplyDeleteHi!
ReplyDeleteI assume you are using 'sudo ./codesend 12345' to send the code to the siren? How do you implement this command in the scripts when alarm is activated? I seem to have one big problem here: when I connect data-pin of transmitter to GPIO17, the alarm is deactivated. I will only get the message 'received 15' for example when I open a door contact but alarm is not triggered. If I disconnect data-pin from GPIO17 the alarm work as expected.
I would be grateful if you could try to understand what the problem might be.
Please read this post - http://tkmaker.blogspot.com/2014/01/raspberry-pi-controlling-433-mhz-remote.html
DeleteYou have to implement the code in the alarm.py script once the alarm is triggered.
if (trigger_status == "1"):
#Allow some time (45 sec) to disarm the system
time.sleep(45)
print "Trigger recvd. Sound the alarm!!!"
os.system("sudo ./send your_code")
With Tx data pin connected to GPIO 17 and Rx data pin connected to GPIO 21 you should not see any issues. Verify all connections and try again. When you say alarm is de-activated what do you see happening exactly? Try debugging it one step at a time
Thanks for your reply Trushant! By alarm 'de-activated' I mean that the alarm is not responding to opening of the door contacts. I can only see the loop 'armed status =1' on the screen in putty. But if I remove Tx data from GPIO17, I will read 'received 12345' then 'Trigger recvd. Sound the alarm!!!'. Both commands: 'sudo ./RFSniffer' and 'sudo ./send 12345' are working when run manually with both Tx and Rx connected at the same time. The siren is sounding when I run the code manually. The alarm is triggered when opening the door contacts if the Tx data pin is not connected to GPIO17. I will then get email and see in Putty: 'sending code 12356', but because Tx data pin is not connected the siren will not sound. I have to add that I am using 'GPIO Breakout Pro' but I hope that it is not causing any problems. I re-checked the soldering on the breakout board but could not find any problems. I believe the problem has to be software related. What do you think?
DeleteI tried debugging the alarm.py script with Python pdb. I get no errors if the script is run as root: 'sudo python alarm.py'. But if I quit the debugger with pressing 'ctrl+c' I get this error message:
ReplyDelete'Traceback (most recent call last):
File "alarm.py", line 81, in
kill_child_process()
File "alarm.py", line 33, in kill_child_process
print "Killing RFSniffer process pid %s"%p0.pid
NameError: global name 'p0' is not defined'
As I am new to Python I don't know if this is of any significance to the problem I am encountering. Also I can see the 'control.py' is calling 'alarm.py' as root so that should not be related to the script not getting access to GPIO pins. I am running all scripts as user 'pi' but with executive rights.
Any new ideas are appreciated
Hi Jens- I know what the problem is now. The RF Tx uses GPIO 7 and my original code also used the same GPIO for the keypad. I changed the code on my side but didnt update the post or the code in git. (I will fix this). For now change the line in keypad.py that controls the GPio being used to this:
DeleteCOLUMN = [4,22,10]
This would use GPIO pins 4,22,10 instead of 4,17,22. No one else commented about this so I assume no one else is using the whole system as I am using it today.
Thanks that's great Trushant! Yes that fixed the problem instantly! I assume you mean the RF Tx uses GPIO 17 and not '7'. I did strike me that the keypad was connected to the same GPIO 17 as the RF Tx data, but eventually I forgot to mention it or think that it had any significance.
ReplyDeleteThe security system you build is very clever and very functional is a simple installation, but want to add siren, radar traps. www.synagermos.eu
ReplyDeleteVery interesting, your brain is very intelligent. This security system is very useful for home. Now many companies are providing this type of security system for home, smart phones, laptops, shop and many more. These security systems help to protect from thieves.
ReplyDeleteBecause of this many swing gates must have a control panel as a part of the system. Smarter cctv system
ReplyDeleteThank you to all of the members for supporting the event and of course a very big thank you to all of our sponsors, the ISIA Awards would not be possible without you. Smarter Security Melbourne
ReplyDeleteI like your post. It is good to see you verbalize from the heart and clarity on this important subject can be easily observed... Security cameras
ReplyDeleteI just couldn't leave your website before telling you that I truly enjoyed the top quality info you present to your visitors? Will be back again frequently to check up on new posts.
ReplyDeletehome security camera installation service
Hello Wow what an article I truly delighted in perusing this I will return again to peruse, And you are searching for best smart home installation near me Please visit us security guard services
ReplyDelete