Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
Latest update: Friday, November 8, 2013This is an open source home alarm monitoring system using Raspberry Pi, Netduino 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
- C/C++ to program the ATTiny85. Built an ArduinoISP shield following the MIT High-Low Tech Group.
Arduino “in-system programmer” (ISP) shield ATtiny programmer. |
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)
- 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].
Debugging Alarm using external USB. There is no need to open the alarm panel. |
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 |
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 |
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. |
/open | Open last file on SD card. |
/sdcard | List files on SD card. |
/su | Super user. Shows additional options. |
/pachube | Shows Pachube activity per zone/Datastream. |
/about | Application credits and version.[Desktop version] |
/about-mobile | Application credits and version.[Mobile version] |
/delete-confirm | Delete last file on SD card [confirm window]. |
/delete-last | Delete last file on SD card [no confirm window]. |
/diag | Displays available memory on Netduino and forces to clear the garbage collector.[Desktop version] |
/diag-mobile | Displays available memory on Netduino and forces to clear the garbage collector.[Mobile version] |
/date | Gets date time from Raspberry Pi. |
/mobile | Root page mobile format. |
HomeAlarmPlus [Desktop version] |
HomeAlarmPlus [Mobile version] |
Web server options on Raspberry Pi
Options
|
Description
|
/ | Root page desktop format. |
/index.php | Root page desktop format. |
/weather.html | Weather data from Wunderground.[Desktop version] |
/mobile | Root page mobile format. |
/mobile/index.php | Root page mobile format. |
/references.htm | Project link references. |
/about | Application credits and version. |
/NetduinoPlus/setNetduinoTimer.php | Setup/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
- Simple Mail Transfer Protocol (SMTP) based on BanskySPOTMail by: Pavel Bánský.
- Netduino Web Server based on MFToolkit library by: Michael Schwarz.
- Pachube Embeddable Graph Generator (Beta) by: Cosm (formerly Pachube), adapted by Gilberto García.
- Extensions class based on a post/implementation by: Valkyrie-MT, expanded by Gilberto García.
- StopWatch class based on a post/implementation by: Chris Walker.
- LCD display using uLiquidCrystal library.
- TimeSpan reference [1].
- Raspberry Pi basic setup.
- Raspberry Pi initial setup.
- Setting up a VNC server on Raspberry Pi.
- How to setup a Raspberry Pi Windows NAS storage and web server [1], [2] and [3].
- ATtiny85 PWM tutorial.
- Wunderground API.
- Wunderground weather forecast Stack overflow solution.
- JSON, jQuery and jQuery Mobile tools and tutorials [1], [2] and [3].
- Mobile browser detection [1] and [2].
- PushingBox notifications.
- PHP DateTimeZone [1].
HomeAlarmPlusPi
Video
HomeAlarmPlus Pi just initializing
HomeAlarmPlus Pi Initializing and Running