Upload
nguyendien
View
225
Download
5
Embed Size (px)
Citation preview
Home Alarm System using Raspberry Pi,Netduino Plus and ATtiny85 (HomeAlarmPlusPi
project)Written By: Feitan
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 1 of 13
INTRODUCTION
This is an open source home alarm monitoring system using Raspberry Pi, Netduino Plus, ATtiny 85and a typical home alarm system. This implementation could be used in conjunction with the PC5010Digital Security Controls (DSC) PowerSeries Security System control panel and sensors. Testedwith Netduino Plus 1 running .NET Micro Framework 4.2 (QFE1 or QFE2) and Raspberry Pi Model Arunning Debian GNU/Linux 7.0 (wheezy).
Previous Implementation
When I first started HomeAlarmPlus on February 2012 my intent was to have a simple home alarmmonitoring system and learn more about microcontrollers. As the knowledge kept growing, also thecomplexity of the circuitry, system and requirements. Then Raspberry Pi complemented the existingproject by using full capability of Apache Web server. This involved massive code changes to theoriginal project reflected in HomeAlarmPlusPi.
Objective
Use full capabilities of Raspberry Pi and Netduino Plus to monitor home alarm system and report anysensor/motion detector activities via email (using Simple Mail Transfer Protocol (SMTP)), local webserver, notifications (using PushingBox) and Pachube (now Cosm).
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 2 of 13
PARTS:Raspberry Pi Model A or B (1)
Netduino Plus (1)
ATtiny85 (ATTINY85-20PU) (1)
SD Memory Card 4 GB or above (Class 10 preferred) (1)
5V 1A (1000mA) USB port power supply (1)
Micro SD Card 2 GB (1)
WiFi(802.11b/g/n) USB Module (1)
SD Card Adapter (1)
3mm green Light Emitting Diode(LED) per alarm zone and motion detector (1)
330 ohm for each LED (1)
NPN Transistor (1)
10k ohm variable resistor (1)
1k ohm resistor for transistor's base (1)
5600 ohm resistor per alarm zone and motion detector (1)
Schottky diode per alarm zone. Schottky diode should have low forward voltage drop like theSBR10U40CT (1)
ScrewShield (Proto-Screwshield (Wingshield) kit (1)
WiFi connection using any WiFi Internet Adapter. Tested on Netgear WNCE3001 (1)
WiFi connection using any WiFi Internet Adapter. Tested on Netgear IOGEAR GWU627 (1)
Basic 16x2 Character LCD 1 (1)
Basic 16x2 Character LCD 2 (1)
DPDT switch (1)
LCD voltage selection (1)
74HC595 Shift Register (1)
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 3 of 13
Step 1 — Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85(HomeAlarmPlusPi project)
Programming Languages and Web Development
On Netduino Plus (See image 1)
C# for Netduino Plus
HTML for Web Server with Cascading Style Sheets (CSS)
JavaScript for Web Server
On Raspberry Pi (See image 2)
HTML5, PHP, Java Script, JSON, jQuery, Weather Underground API, Python (underdevelopment: use of GPIO)
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 4 of 13
Step 2
On ATtiny85 (See image 1)
C/C++ to program the ATTiny85.Built an ArduinoISP shieldfollowing the MIT High-Low TechGroup.
Warning
This code contains informationrelated to a typical home alarmsystems. Please, be aware thatthis procedure may void anywarranty. Any alarm system ofany type may be compromiseddeliberately or may fail to operateas expected for a variety ofreasons.
The author, Gilberto García, is notliable for any System Failuressuch as: inadequate installation,criminal knowledge, access byintruders, power failure, failure ofreplaceable batteries,compromise of Radio Frequency(Wireless) devices,
system users, smoke detectors,motion detectors, warning devices(sirens, bells, horns), telephonelines, insufficient time, componentfailure, inadequate testing,security and insurance (propertyor life insurance).
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 5 of 13
One last thing: DISCONNECT ACPOWER AND TELEPHONELINES PRIOR TO DOINGANYTHING.
Step 3
Optional Hardware
Panel Mount LED (Green LED with Holder) (See image 1)
Mini Buzzer (3VDC) (See image 2)
USB Ruggedized / Waterproof Panel Connector (RR-211300-30) (See image 3)
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
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 6 of 13
Step 4
Arduino Proto Shield R3. Morespace for additional components.[1]or others [2], [3]
Low-profile microSD card adapter forRaspberry Pi [1]
Raspberry Pi case [1] or others [2]
In-line power switch for 2.1mmbarrel jack [1] or [2]
Raspberry Pi heat sink set [1]
12 VDC Micro fan to cool downRaspberry Pi [1]
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 7 of 13
Step 5
Settings (See image 1)
For HomeAlarmPlus and HomeAlarmPlus Pi the conditional symbol ALARM_DEBUG enablesalarm debug on Visual Studio. To enable debugging on Visual Studio just right clickAlarmByZones project, select properties, select Build tab and add ALARM_DEBUG under"Conditional compilation symbols".
More debugging capabilities will be implemented for Raspberry Pi and ATtiny85.
Circuitry (See image 2 & 3)
The following Fritzing diagram shows how the Netduino plus, LEDs and the alarm zones (ormotion detector) are wired. Compared from previous implementation(HomeAlarmPlus) I addedATtiny85 in order to reduce threads in the Netduino Plus 1. By doing this I saved 2 KB of RAMand have more code space.
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 8 of 13
Step 6
Keep in mind that one or more zone consist of the following: (See image 1)
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 Schottkydiode. This will bring the protection needed for the Netduino or Arduino.
c) Each ground zone should be connected to the ProtoScrewShield GND.
Web server options on Netduino Plus (See image 2 & 3)
Step 7
Web server options on Raspberry Pi
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 9 of 13
Step 8
Software Architecture (See image 1 & 2)
Final Product (See image 3)
Under Development
Web interface for tablet based devices. [Testing, not released]
Cameras with integrated motion sensor and night vision. Camera should be integrated withRaspberry Pi GPIO.
More debugging capabilities for Raspberry Pi and ATtiny85.
Explore additional notification options like IFTTT. [Done. Released July 17, 2013]
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 10 of 13
Step 9
References
Simple Mail Transfer Protocol(SMTP) based onBanskySPOTMail by: PavelBánský.
Netduino Web Server based onMFToolkit library by: MichaelSchwarz.
Pachube Embeddable GraphGenerator (Beta) by: Cosm(formerly Pachube), adapted byGilberto García.
Extensions class based on apost/implementation by: Valkyrie-MT, expanded by Gilberto García.
StopWatch class based on apost/implementation by: ChrisWalker.
LCD display using uLiquidCrystallibrary.
TimeSpan reference [1].
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 11 of 13
Step 10
Raspberry Pi basic setup.
Raspberry Pi initial setup.
Setting up a VNC server onRaspberry Pi.
How to setup a Raspberry PiWindows NAS storage and webserver [1], [2] and [3].
ATtiny85 PWM tutorial.
Wunderground API.
Wunderground weather forecastStack overflow solution.
JSON, jQuery and jQuery Mobiletools and tutorials [1], [2] and [3].
Step 11
Mobile browser detection [1] and [2].
PushingBox notifications.
PHP DateTimeZone [1].
Code Repository andDocumentation
HomeAlarmPlusPi
Video
HomeAlarmPlus Pi just initializing
HomeAlarmPlus Pi Initializing andRunning
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 12 of 13
This document was last generated on 2017-06-27 11:38:34 PM.
Home Alarm System using Raspberry Pi, Netduino Plus and ATtiny85 (HomeAlarmPlusPi project)
© 2017 www.botsbits.org Page 13 of 13