Saturday, April 6, 2013

Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)

Latest update: Friday, November 8, 2013

This is an open source home alarm monitoring system using Raspberry PiNetduino Plus, ATtiny 85 and a typical home alarm system. This implementation could be used in conjunction with the PC5010 Digital Security Controls (DSC) PowerSeries Security System control panel and sensors.  Tested with Netduino Plus 1 running .NET Micro Framework 4.2 (QFE1 or QFE2) and Raspberry Pi Model A running Debian GNU/Linux 7.0 (wheezy).

Previous Implementation
When I first started HomeAlarmPlus on February 2012 my intent was to have a simple home alarm monitoring system and learn more about microcontrollers. As the knowledge kept growing, also the complexity of the circuitry, system and requirements. Then Raspberry Pi complemented the existing project by using full capability of Apache Web server. This involved massive code changes to the original project reflected in HomeAlarmPlusPi.

Objective
Use full capabilities of Raspberry Pi and Netduino Plus to monitor home alarm system and report any sensor/motion detector activities via email (using Simple Mail Transfer Protocol (SMTP)), local web server, notifications (using PushingBox) and Pachube (now Cosm).

Programming Languages and Web Development

On Netduino Plus

Netduino Plus 1
  • C# for Netduino Plus
  • HTML for Web Server with Cascading Style Sheets (CSS)
  • JavaScript for Web Server

On Raspberry Pi
Raspberry Pi with enclosure and cardboard on top with 12 VDC micro fan.
  • HTML5
  • PHP
  • Java Script
  • JSON
  • jQuery
  • Weather Underground API
  • Python (under development: use of GPIO)

On ATtiny85
Arduino “in-system programmer” (ISP) shield ATtiny programmer. 
Warning
This code contains information related to a typical home alarm systems.  Please, be aware that this procedure may void any warranty.  Any alarm system of any type may be compromised deliberately or may fail to operate as expected for a variety of reasons.

The author, Gilberto García, is not liable for any System Failures such as: inadequate installation,  criminal knowledge, access by intruders, power failure, failure of replaceable batteries, compromise of Radio Frequency (Wireless) devices, system users, smoke detectors, motion detectors, warning devices (sirens, bells, horns), telephone lines, insufficient time, component failure, inadequate testing, security and insurance (property or life insurance).

One last thing:
DISCONNECT AC POWER AND TELEPHONE LINES PRIOR TO DOING ANYTHING.

Required Hardware
  • Raspberry Pi Model A or B
  • Netduino Plus
  • ATtiny85 (ATTINY85-20PU).
  • SD Memory Card 4 GB or above (Class 10 preferred).
  • 5V 1A (1000mA) USB port power supply.
  • Micro SD Card 2 GB
  • WiFi(802.11b/g/n) USB Module [1], [2] or [3]
  • SD Card Adapter
  • 3mm green Light Emitting Diode(LED) per alarm zone and motion detector.
  • 330 ohm for each LED.
  • NPN Transistor
  • 10k ohm variable resistor
  • 1k ohm resistor for transistor's base.
  • 5600 ohm resistor per alarm zone and motion detector.
  • Schottky diode per alarm zone.  Schottky diode should have low forward voltage drop like the SBR10U40CT.
  • ScrewShield (Proto-Screwshield (Wingshield) kit from [1] or [2]).
  • WiFi connection using any WiFi Internet Adapter. Tested on Netgear WNCE3001 and IOGEAR GWU627.
  • Basic 16x2 Character LCD [1] or others [2].
  • DPDT switch [1] or others [2] for LCD voltage selection.
  • 74HC595 Shift Register

Optional Hardware
  • Panel Mount LED (Green LED with Holder)

  • Mini Buzzer (3VDC)

  • USB Ruggedized / Waterproof Panel Connector (RR-211300-30)
  • Debugging Alarm using external USB.  There is no need to open the alarm panel.

  • RF Receiver Toggle Type to arm/disarm [1].
  • USB 2.0 Cable, Type A Male to A Male (10 Feet or above). Used to access the Netduino Plusboard on the alarm panel.
  • 200 Watts / 350 VA UPS (APC BE350G UPS System or similar).
  • Push button for external reset.
  • Arduino Proto Shield R3. More space for additional components.[1] or others [2], [3].
  • Low-profile microSD card adapter for Raspberry Pi [1].
  • Raspberry Pi case [1] or others [2]
  • In-line power switch for 2.1mm barrel jack [1] or [2].
  • Raspberry Pi heat sink set [1].
  • 12 VDC Micro fan to cool down Raspberry Pi [1].

Modified Raspberry Pi case with fan

Settings
For HomeAlarmPlus and HomeAlarmPlus Pi the conditional symbol ALARM_DEBUG enables alarm debug on Visual Studio. To enable debugging on Visual Studio just right click AlarmByZones project, select properties, select Build tab and add ALARM_DEBUG under "Conditional compilation symbols".
Debug setup
More debugging capabilities will be implemented for Raspberry Pi and ATtiny85.

Circuitry
The following Fritzing diagram shows how the Netduino plus, LEDs and the alarm zones (or motion detector) are wired. Compared from previous implementation(HomeAlarmPlus) I added ATtiny85 in order to reduce threads in the Netduino Plus 1. By doing this I saved 2 KB of RAM and have more code space.

HomeAlarmPlus Pi connection diagram Rev I.

HomeAlarmPlus Pi circuitry
HomeAlarmPlus Pi circuitry details
Keep in mind that one or more zone consist of the following:
a) 1 Normally Open contact and 1 Normally closed contact with End Of Line (EOL) resistor.
b) Double EOL circuit, 1 Normally closed contact with 5.6kohm EOL resistor and Schottky diode.  This will bring the protection needed for the Netduino or Arduino.
c) Each ground zone should be connected to the  ProtoScrewShield GND.

Netduino/ProtoScrewShield Pin
Description
A0 Zone #1
A1 Zone #2
A2 Zone #3
A3 Zone #4
A4 Sensor #1 [Motion Detector]
D0 xBee RX
D2 LED Zone #1
D3 LED Zone #2
D4 LED Zone #3
D5 LED Zone #4
D6 LED Sensor #1 [Motion Detector]
D7 RF Toggle Pin (RF Receiver)
D8 Power ATtiny85
D9 Burglar Alarm or Mini Buzzer
D10, D11 and D13 Shift register LCD

Web server options on Netduino Plus
Options
Description
/Root page desktop format.
/openOpen last file on SD card.
/sdcardList files on SD card.
/suSuper user. Shows additional options.
/pachubeShows Pachube activity per zone/Datastream.
/aboutApplication credits and version.[Desktop version]
/about-mobileApplication credits and version.[Mobile version]
/delete-confirmDelete last file on SD card [confirm window].
/delete-lastDelete last file on SD card [no confirm window].
/diagDisplays available memory on Netduino and forces to clear the garbage collector.[Desktop version]
/diag-mobileDisplays available memory on Netduino and forces to clear the garbage collector.[Mobile version]
/dateGets date time from Raspberry Pi.
/mobileRoot page mobile format.

HomeAlarmPlus [Desktop version]
HomeAlarmPlus [Mobile version]

Web server options on Raspberry Pi
Options
Description
/Root page desktop format.
/index.phpRoot page desktop format.
/weather.htmlWeather data from Wunderground.[Desktop version]
/mobileRoot page mobile format.
/mobile/index.phpRoot page mobile format.
/references.htmProject link references.
/aboutApplication credits and version.
/NetduinoPlus/setNetduinoTimer.phpSetup/Update Netduino Plus time/date.

HomeAlarmPlus Pi web server [Desktop version]
HomeAlarmPlus Pi webserver [Mobile version]

HomeAlarmPlus Pi [Apple mobile screenshot]

Software Architecture

HomeAlarmPlus Pi Software Architecture

Detailed Software Architecture

Final Product
Final Product showing mobile access, Raspberry Pi, Netduino Plus 1, custom shield for Netduino and Home Alarm Panel

Under Development
  • Web interface for tablet based devices. [Testing, not released]
  • Cameras with integrated motion sensor and night vision. Camera should be integrated with Raspberry Pi GPIO.
  • More debugging capabilities for Raspberry Pi and ATtiny85.
  • Explore additional notification options like IFTTT. [Done. Released July 17, 2013]

References
Code Repository and Documentation
HomeAlarmPlusPi

Video
HomeAlarmPlus Pi just initializing

HomeAlarmPlus Pi Initializing and Running

65 comments:

  1. Great work.... thanks for share.... i will like to see whith the ITTT....

    ReplyDelete
    Replies
    1. Thank you for you comments Eduardo. I have been updating code in repository.

      Delete
    2. Eduardo, as promised, I added Pushover notification on the Raspberry Pi side. It is on PHP (index.php). You can create recipes on IFTTT and add Pushover.

      Delete
  2. hi
    your blog gives me useful information. Home security is a major issue now a time. find out more about security of home.
    Please visit our well defined website.
    Thank you

    ReplyDelete
  3. Security is the primary factor for everyone to safe guard their family and business. This blog will be helpful for those who needs to know about Home security System and its advantages.

    ReplyDelete
  4. Hi, great work.
    Do you connect the PIR sensors to the old system as well as your new circuit? If yes, how do you do this?

    ReplyDelete
    Replies
    1. Maknet, thank you for your interest in HomeAlarmPlus Pi. I used the following link as a reference for the old circuit (http://rawrwarbear.com/2011/04/10/home-alone-netduino-wireless-motion-alarm-project/). I have not implemented PIR yet for the new circuit. Thank you again.

      Delete
  5. Hi Gilberto,
    I am not sure why used the 2 micro-controllers though the RB-Pi already has a processor in it ?

    Baba

    ReplyDelete
    Replies
    1. Baba, for this project I use the Raspberry Pi as web server and Netduino Plus for the alarm/sensors. Raspberry Pi does not have ADC so you need to use MCP3008 or MCP3424. I could consolidate in one platform but in security systems it is better to have redundant monitoring. Thanks.

      Delete
  6. If you change your event listeners from "onClick" to "touchstart", the button down-state will appear ~300ms earlier. 'onClick' waits 300ms for a double click.

    ReplyDelete
  7. Hello,

    I've created a similar project using Arduino.

    A PC is used for external control (WebUi)

    More info here :
    I’ve created an alarm system based on Arduino.

    I’m also communicating with a PC using USB (serial over usb)

    More info :
    http://dev.kprod.net/?q=aalarm-v2-intrusion-detection-using-arduino-alarm-with-django-and-perl-en

    ReplyDelete
  8. You project is very a tough job but you able to get good result at the end. Two thumbs up for you dude!

    Locksmith in Snoqualmie

    ReplyDelete
  9. I didn't find any other informative blog like this,I am hoping the same high-grade blog post from you in the upcoming as well.
    Top Home Security Systems

    ReplyDelete
  10. Hello there! I must tell you the blog post is really good. It is very informative. Yes off course security is must in house.I really appreciate and keep writing..
    Thank you..

    ReplyDelete
  11. Hello there! I must tell you the blog post is really good. It is very informative. Home security systems are very important in todays life. I really appreciate and keep writing!

    home alarm monitoring cambridge

    ReplyDelete
  12. Creating your own home-made home alarm system might be complicated since there are so many things that you must know about it.

    Locksmith Palatine

    ReplyDelete
  13. Your article and the advice we are given is very good security systems are very essential and the technology is very high. alarms

    ReplyDelete
  14. Hi, Gilberto... Thanks for sharing this; I've bookmarked it (meaning I hope it stays up for a while) and intend to give it a whirl in a month or so. Meanwhile, I just have to tell you that I got a kick out of your robo-spammers. (I get them, too...)

    - Jim

    ReplyDelete
  15. Hallo, can you explain me why you used Netduino Plus and not Arduino?

    Kr Guido

    ReplyDelete
    Replies
    1. Thanks for your question. There are many reasons but the main one is that I use C# daily. You will find out that concurrency and multithreading on Arduino is not as easy as in Netduino boards. Another reason is that I do not need to buy an Ethernet shield since it is integrated in Netduino Plus.

      Delete
  16. Imprnt Systems, an ISO 9001:2008 certified company, has been serving North American clients since 2005. .Our India operations started in 2010. We are a leading supplier of closed circuit video surveillance systems in India. We provide business owners with the latest digital video monitoring solutions,Home Security System ,access control solutions, safety alarms and fire alarms to protect against internal and external threats, theft, crime, fraud and unproductiveness.

    ReplyDelete
  17. WOW!! Very informative blog and useful article. Thanks for share this nice blog
    DIY Security Alarms

    ReplyDelete
  18. your article and the circuit presented to us for the alarm system is very good and very interesting. www.synagermos.eu

    ReplyDelete
  19. The change which you made previous to current are sounds good. it is very appritiaable.
    Alarm Systems in Lakeworth

    ReplyDelete
  20. Security contractor installs and helps monitor home security systems and commercial security systems with monitoring starting at just $14.95 Protection Concepts Atlanta security contractor Atlanta Security provider.

    Atlanta Home Security Systems

    ReplyDelete
  21. Protection Concepts began in 1998 with one simple principle…To offer excellent customer service, quality equipment and monitoring all at an affordable price while conducting business with honesty and integrity.

    Marietta commercial security

    ReplyDelete
  22. This is an intresting blog that you have posted, you shares a lot of things about Système d'alarme , Télésurveillance Montreal Installation Caméra Espion .
    Which are very informative for us.Thanks

    ReplyDelete
  23. Security contractor installs and helps monitor home security systems and commercial security systems with monitoring starting at just $14.95 Protection Concepts Atlanta security contractor Atlanta Security provider.

    Home security companies Georgia

    ReplyDelete
  24. EPG Security Group provides security services and protection to executives, high-profile individuals, and organizations from businesses to places of worship to the hospitality industry.
    Protection services MN

    ReplyDelete
  25. Residential security monitoring systems from Protection Concepts serving Marietta, Atlanta areas. Monitoring starts from $14.95 a month.
    security monitoring

    ReplyDelete
  26. Residential security monitoring systems from Protection Concepts serving Marietta, Atlanta areas. Monitoring starts from $14.95 a month.
    security monitoring

    ReplyDelete
  27. Protection Concepts provide you with customized solutions designed for your specific needs, monitor home security systems and commercial security systems,requirements and budget AND remember, our base monitoring starting at just $14.95 per month .
    Commercial Security

    ReplyDelete
  28. EPG Security Group provides security services and protection to executives, high-profile individuals, and organizations from businesses to places of worship to the hospitality industry.
    Security guard MN

    ReplyDelete
  29. Protection Concepts began in 1998 with one simple principle…To offer excellent customer service, quality equipment and monitoring all at an affordable price while conducting business with honesty and integrity.

    Atlanta security contractor

    ReplyDelete
  30. Interactive home security systems from Protection Concepts based in Marietta and serving Atlanta, Georgia. Monitoring starts at $14.95 a month.

    Atlanta Security provider

    ReplyDelete
  31. EPG Security Group provides clients with exceptional security services that enable them to relax with confidence, knowing their security and the safety of their customers, guests, family, and employees are in trustworthy, experienced hands.
    organization Security

    ReplyDelete
  32. Protection Concepts is 100% committed to the protection of what matters most while maintaining the highest level of customer service and integrity in the industry. We offer you the most innovative technology available today. We specialize in both residential and commercial security systems, installation and monitoring, with monitoring starting at just $14.95 per month!

    No phone line security system

    ReplyDelete
  33. St.Paul Minneapolis security provider installs, services, and monitors residential and commercial security systems.State of the art technology, with the best installers and monitoring the State of Minnesota has to offer.
    Lloyd Security Minnesota contracted surveillance,Minnetonka alarm systems,
    Commercial security systemsMinneapolis Home Security Systems

    ReplyDelete
  34. Lloyd Security is a locally owned and operated security company with a combined 30 + years experience.
    State of the art technology, with the best installers and monitoring the State of Minnesota has to offer.
    Lloyd SecuritySecurity systems Edina, Video monitoring, Alarm companies MN, Commercial security systems, Edina Alarm, No phone line security system, Commercial security systemsMinneapolis Home Security Systems Commercial Security System

    ReplyDelete
  35. A wide vary of home security alarm systems is found at intervals the market. Some security systems ar stand alone, which suggests, it operates in its own. It does not would like any special information or tools to figure with. the highest wireless home security system is also an honest thanks to keep your house secure from unwanted guests. it's constant safety options that accompany ancient wired security systems. the only distinction is that the wires don't seem to be any more accustomed connect the sensors to the device.

    home security alarm system kit diy

    ReplyDelete
  36. Two way voice alarm systems for security monitoring. Monitoring starts from $14.95 a month.
    security systems

    ReplyDelete
  37. The information you have given in the blog really marvelous and more interesting. Aspire Nautilus

    ReplyDelete
  38. I really appreciate yOu posting this very imformative blog. I just hate to see your blog comments becoming an advertising column. Maybe you can use your c# programming skills to filter them out? Excellent alarm though, the best I've seen on the web so far

    ReplyDelete
  39. With Lloyd Security Energy Management services you can remotely adjust your lights and thermostats and set energy saving Smart Schedules™ to fit your lifestyle. Lloyd Security can help you stop wasting energy and start taking control of your energy bills.
    Minnetonka home security

    ReplyDelete
  40. Lloyd Security installs, services, and monitors both residential and commercial security systems in the Twin Cities. Unlike some other “alarm companies”, we don’t just sell security, we specialize in it.
    Lloyd Security Commercial security systems, No phone line security system, Minnetonka home security, Minneapolis Security provider Minneapolis Home Security Systems
    Our security consultants will work with you to custom-design the right security solution to fit your individual lifestyle.

    ReplyDelete
  41. Lloyd Security Offers patented security and interactive technology to provide best in class protection and the ability to monitor your property 24/7. Lloyd Security utilizes advanced interactive security solutions to provide the most reliable home and business monitoring service.
    Video monitoring

    ReplyDelete
  42. Home security systems are simply a great value .Beyond the important peace of mind for you and your family, a home security system has many benefits to protect your home, your family and your possessions.
    Security systems Minneapolis

    ReplyDelete
  43. Minneapolis-based security contractor Lloyd Security works with security systems of your choosing including Residential and Commercial Security.
    Minnesota commercial security

    ReplyDelete
  44. Each member of our Lloyd Security Team has an important role in making sure our customers get the best service available from the initial consultation, to the install, to service.
    No phone line Minnesota St. Paul Alarm systems, St. Paul home security, wireless security, No phone line security system, Commercial security systems
    Security systems St. Louis Park

    ReplyDelete
  45. Lloyd’s is the best possible platform upon which to build our insurance and reinsurance business. It offers many advantages both to ourselves as insurers and reinsurers – and to the policyholders whose interests we serve. Lloyd Security, Inc is a locally owned, operated and serviced security company based in the Twin Cities.

    Home security twin cities

    ReplyDelete
  46. Lloyd Security not only provide sell security that also offers both residential and commercial security. Our security consultants can recommend the right security solution to fit your individual lifestyle. They can answer to all your security thoughts.
    Minneapolis Security provider

    ReplyDelete
  47. Lloyd Security is the tops! A local company that really has treated me and my family with the utmost respect, from the quick installation to the reasonable pricing, we really feel safer with Lloyd on our side. We're customers for life!

    Security systems Minneapolis

    ReplyDelete
  48. Lloyd Security is a GE Security Pro Dealer. It provides both wired and wireless security systems. No phone line is required in this system because it facilitate the option of using a cell or radio connectivity device as the primary line.
    Minnesota contracted surveillance

    ReplyDelete
  49. Lloyd Security is a GE Security Pro Dealer. It provides both wired and wireless security systems. No phone line is required in this system because it facilitate the option of using a cell or radio connectivity device as the primary line.
    Minnesota contracted surveillance

    ReplyDelete
  50. Lloyd Security's been protecting my home and my cabin for years and I couldn't ask for more in a security company!
    No phone line Minneapolis

    ReplyDelete
  51. Very nice information .....thanks for sharing....

    ReplyDelete
  52. Lloyd Security handle everything from design to installation, monitoring and service. We will never have the most customers but we will have the most satisfied customers. Every employee has a mandate to never compromise on quality, integrity or service to the customer. Maintaining a constant line of communication from inception to project completion has put us at the top of customer satisfaction ratings.
    Minnetonka home security

    ReplyDelete
  53. Lloyd Security handle everything from design to installation, monitoring and service. We will never have the most customers but we will have the most satisfied customers. Every employee has a mandate to never compromise on quality, integrity or service to the customer. Maintaining a constant line of communication from inception to project completion has put us at the top of customer satisfaction ratings.
    Minnetonka home security

    ReplyDelete
  54. The blog has offered the great knowledge I really enjoyed a lot by reading this.
    home security companies

    ReplyDelete
  55. Protection Concepts provide you with customized solutions designed for your specific needs, monitor home security systems and commercial security systems,requirements and budget AND remember, our base monitoring starting at just $14.95 per month .
    Personal Emergency Response System

    ReplyDelete
  56. The info you provided in the blog that was really unique I love it!!!
    home security systems reviews

    ReplyDelete