SlideShare une entreprise Scribd logo
1  sur  6
Télécharger pour lire hors ligne
Home security with Raspberry Pi, not only with Zoneminder
As you probably already know you can have a cheap monitoring system with cameras and email
notifications using Raspberry Pi and Zoneminder. Although I have managed to use Zoneminder on a
RPI 1 B+ with two USB cameras (I had used ZM for a few years before) I still have the feeling that
Zoneminder is just a bit too «heavy» for SoC computers - enterprise quality database and enterprise
web server for quite a dumb task? So I have begun to downsize my thinking, which eventually will
lead to Arduino, better reliability (no SD card!) and power consumption at levels enabling long
operation without access to power grid.
But today let us start with Zoneminder. There are many tutorials which can easily be found with
Google. Let me add mine – th steps below lead to a working Zoneminder on RPI1 with Raspbian
Jessie (I will omit 'sudo' at the beginning of commands, you'd rather add it for most of them)1
:
1. change the default password for 'pi' user with 'passwd'
2. if you don't like cables or another keyboard on your desk, enable SSH by running raspi-config
and navigating to Interfacing Options / ssh / enable and put RPI aside where it doesn't hamper
you.
3. the you maybe don't need X server that consumes resources – use the same raspi-config and Boot
Options / B1 Desktop / CLI / B1 Console. While being there - check the time zone!
4. apt-get update
5. it works without apt-get dist-upgrade but you know ...
6. apt-get install php5 mysql-server php5-mysql (works without explicit php-pear here; you will be
asked to submit a password to the database, not needed further in this tutorial)
7. apt-get install zoneminder
8. adduser www-data video (you can see the effect in /etc/group – look for a line beginning with
video:x:)
9. ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf
10. a2enmod cgi (without it you could get errors like socket_sendto(/tmp/zm/zms-704658s.sock )
failed: No such file or /directory//usr/share/zoneminder/includes/functions.php 2344)
11. a2enconf javascript-common (it did not need to run it on Raspbian but before I had troubles
with buttons on web console while running Ubuntu on a PC, just in case)
12. there might still be a bug in your version of ZM – go to
/usr/share/perl5/ZoneMinder/Memory.pm and around line 130 change
$arch = int(3.2*length(~0));
to2
$arch = 32;
13. echo "kernel.shmmax = 134217728" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
14. /etc/init.d/apache2 restart (or service apache2 restart or service apache2 reload ; you could
now be able to see Zoneminder at http://localhost/zm)
15. apt-get install postfix (you will be asked to chose for example 'local only')
16. go to /etc/postfix and create file sasl_passwd and put one line into it :
[smtp.gmail.com]:587 john.smith:pass1234
Replace user name and password with your credentials; you have noticed that is a line for a
Google Mail account. This account is used to send alarm notifications (sent-from). The address
of the recipient shall be configured soon in Zoneminder.
17. postmap hash:/etc/postfix/sasl_passwd
1 See https://wiki.zoneminder.com/Raspbian for an explanation of commands
2 Fixed in newer versions by our $arch = 32 + 32*( qx(uname -m) =~ /64/ );
18. rm /etc/postfix/sasl_passwd
19. replace the content of /etc/postfix/main.cf with following lines (you might want to adjust
hostname):
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_security_level = may
smtp_use_tls = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
myhostname = raspberrypi
myorigin = $myhostname
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = raspberrypi, localhost.localdomain, localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sasl_tls_security_options = noanonymous
20. /etc/init.d/postfix restart
21. you might test the configuration of Postfix by sendmail some.name@some.address <ENTER>
test content <ENTER> . <ENTER>
22. visit your local Zoneminder console http://localhost/zm and configure a monitor – your camera
might most probably be like mine:
Fig. 1. Monitor configuration
23. Maximum FPS in the monitor's General tab, reduce number of frame in the Buffers tab too
24. Navigate to Options – Email tab. Mark OPT_EMAIL, write the email address alarms should be
sent to. EMAIL_HOST will be localhost, the Postfix we configured.
25. if you want pictures to be attached to emails, supplement MESSAGE_BODY with %EI1% and
%EIM%, or maybe %ET% for the time of events.
26. Configure a filter:→ Filters → Total score, grater than 20, Email details of all matches → Save
"Alarm", run filter in background.
Fig. 2. Filter configuration
Without Zoneminder
Maybe I am not the only one who likes simplicity, and image-based motion recognition might cause
troubles. So I decided to build an alternative with two cameras connected via USB, two PIR sensors
(Fig. 1), a RFID reader (Fig. 2) to disarm the system easily, and a simple switch to arm it even
easier, plus two LEDs for status reporting. This should run like a charm on low-clocked boards and
it is way easier to activate/deactivate than using a browser while leaving your apartment.
Fig. 3. RDM630 RFID reader
Fig. 4. HC-SR501 movement sensor
Fig. 5. Pinout of the security system (don't forget to plugin USB cameras!)
The only box I had (to put it all together except RPI) was not very satisfactory for my wife but not
too bad I guess (see fig. 6.), and I managed to wire all this stuff using one single UTP cable (6
signal cables + VCC + GND), use of an RGB led does not change the wiring/schema.
Fig. 6. My control panel
All this takes less than hundred lines in Python to run. There are some prerequisites:
1. install Postfix, see 15-20 above
2. apt-get install python-setuptools
3. easy_install pip
4. pip install pyserial
5. apt-get install streamer
6. apt-get install mailutils
7. disable serial being used by console logging. I found a few different ways:
a) raspi-config → Interfacing Options → Serial → Login shell NOT accessible over serial
b) removing console=serial0,115200 from file /boot/cmdline.txt
c) systemctl stop serial-getty@ttyAMA0.service
systemctl disable serial-getty@ttyAMA0.service
Theoretically you could be able now to run attached myalarm.py3
with nohup python myalarm.py &
But before that you need to edit the code and change IDs to your RFID tags and email address too.
A short description of LED signals:
A very short, green blink (or flash)
every 10 seconds
Idle, waiting for the switch to be pressed (system to be armed
- surveillance to be activated) - default state after start
Longer, green blink twice a second You have just pressed the switch and have 10 seconds (may
be reconfigured in the code) to leave the property
Short, red flash every 10 seconds Waiting for an intruder or you coming home
Red 1sec light Intruder detected
Long, 4sec, green light You have just disarmed your security system with a RFID tag
3 You can get the code here: https://sites.google.com/site/boguszjelinski/home/raspberry-arduino
A few comments to the source code, or just hints for you to write your own:
- LEDs and PIR sensors are configured by standard GPIO.setup GPIO.OUT and GPIO.IN
respectively
- for that wiring of switch you need GPIO.setup (?, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- the RFID reader is connected to GPIO15 which is board's RX, this can be read with
ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=0.1) and ser.read(12)
This works on Raspbian Jessie on RPI 1, but it might be changed to /dev/serial0 with other
distributions.
- maybe there should be a resistor for the switch too
- I use streamer to dump images from USB cameras:
streamer -c /dev/video0 -s 640x480 -o camdmp.jpeg
and streamer -c /dev/video1 -s 640x480 -o camdmp2.jpeg for the second camera
- write some alarming wake-up text into alarmmsg.txt file and send email with:
mail -s "Alarm" -t john.smith@gmail.com -A camdmp.jpeg -A camdmp2.jpeg < alarmmsg.txt
Have fun!
Bogusz, Moss, Norway, 10-09-2017

Contenu connexe

Tendances

Cisco router basic configuration commands
Cisco router basic configuration commandsCisco router basic configuration commands
Cisco router basic configuration commandsCCNAStudyGuide
 
Uso de Honeypots com Honeyd
Uso de Honeypots com HoneydUso de Honeypots com Honeyd
Uso de Honeypots com HoneydUlisses Costa
 
Explorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoExplorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoAlvaro Viebrantz
 
05 module managing your network enviornment
05  module managing your network enviornment05  module managing your network enviornment
05 module managing your network enviornmentAsif
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with PythonLelio Campanile
 
Innovation with pcDuino
Innovation with pcDuinoInnovation with pcDuino
Innovation with pcDuinoJingfeng Liu
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common CommandJeff Yang
 
An Easy way to build a server cluster without top of rack switches (MEMO)
An Easy way to build a server cluster without top of rack switches (MEMO)An Easy way to build a server cluster without top of rack switches (MEMO)
An Easy way to build a server cluster without top of rack switches (MEMO)Naoto MATSUMOTO
 
Esp8266 - Intro for dummies
Esp8266 - Intro for dummiesEsp8266 - Intro for dummies
Esp8266 - Intro for dummiesPavlos Isaris
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Dan Radez
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort webhostingguy
 
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)Naoto MATSUMOTO
 
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO)
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO) UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO)
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO) Naoto MATSUMOTO
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunJingfeng Liu
 

Tendances (20)

Cisco router basic configuration commands
Cisco router basic configuration commandsCisco router basic configuration commands
Cisco router basic configuration commands
 
Uso de Honeypots com Honeyd
Uso de Honeypots com HoneydUso de Honeypots com Honeyd
Uso de Honeypots com Honeyd
 
Explorando Go em Ambiente Embarcado
Explorando Go em Ambiente EmbarcadoExplorando Go em Ambiente Embarcado
Explorando Go em Ambiente Embarcado
 
Linux network tools (Maarten Blomme)
Linux network tools (Maarten Blomme)Linux network tools (Maarten Blomme)
Linux network tools (Maarten Blomme)
 
05 module managing your network enviornment
05  module managing your network enviornment05  module managing your network enviornment
05 module managing your network enviornment
 
Let's begin io t with $10
Let's begin io t with $10Let's begin io t with $10
Let's begin io t with $10
 
IoT: Internet of Things with Python
IoT: Internet of Things with PythonIoT: Internet of Things with Python
IoT: Internet of Things with Python
 
Innovation with pcDuino
Innovation with pcDuinoInnovation with pcDuino
Innovation with pcDuino
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
An Easy way to build a server cluster without top of rack switches (MEMO)
An Easy way to build a server cluster without top of rack switches (MEMO)An Easy way to build a server cluster without top of rack switches (MEMO)
An Easy way to build a server cluster without top of rack switches (MEMO)
 
Esp8266 - Intro for dummies
Esp8266 - Intro for dummiesEsp8266 - Intro for dummies
Esp8266 - Intro for dummies
 
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
Athens IoT Meetup #3 - Introduction to ESP8266 (Pavlos Isaris)
 
Proxy arp
Proxy arpProxy arp
Proxy arp
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013
 
Intrusion Detection System using Snort
Intrusion Detection System using Snort Intrusion Detection System using Snort
Intrusion Detection System using Snort
 
Prototipare col raspberry pi
Prototipare col raspberry piPrototipare col raspberry pi
Prototipare col raspberry pi
 
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)
Large Scale L2TPv3 Overlay Networking with OSPFv3(DRAFT)
 
TCP/IP Exercises
TCP/IP ExercisesTCP/IP Exercises
TCP/IP Exercises
 
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO)
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO) UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO)
UNDOCUMENTED Vyatta vRouter: Unbreakable VPN Tunneling (MEMO)
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 

Similaire à Home security with Raspberry Pi

manual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdfmanual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdfssuserc5ee4c
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry PiLloydMoore
 
Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreBenjamin Moore
 
the NML project
the NML projectthe NML project
the NML projectLei Yang
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Dobrica Pavlinušić
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleChanaka Lasantha
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_trainingvideos
 
Computer technicians-quick-reference-guide
Computer technicians-quick-reference-guideComputer technicians-quick-reference-guide
Computer technicians-quick-reference-guideShathees Rao
 
Configuring Raspberry Pi as a Dev Environment
Configuring Raspberry Pi as a Dev EnvironmentConfiguring Raspberry Pi as a Dev Environment
Configuring Raspberry Pi as a Dev EnvironmentCarole Bennett
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial艾鍗科技
 
Steps to build and run oai
Steps to build and run oaiSteps to build and run oai
Steps to build and run oaissuser38b887
 
8 steps to protect your cisco router
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco routerIT Tech
 
Raspberry pi tutorial
Raspberry pi tutorialRaspberry pi tutorial
Raspberry pi tutorialImad Rhali
 
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick NeshRaspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick NeshTE4P
 
Rete di casa e raspberry pi - Home network and Raspberry Pi
Rete di casa e raspberry pi - Home network and Raspberry Pi Rete di casa e raspberry pi - Home network and Raspberry Pi
Rete di casa e raspberry pi - Home network and Raspberry Pi Daniele Albrizio
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
User manual of n280
User manual of n280User manual of n280
User manual of n280yogesh010
 
Hardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopHardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopSlawomir Jasek
 

Similaire à Home security with Raspberry Pi (20)

snortinstallguide
snortinstallguidesnortinstallguide
snortinstallguide
 
manual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdfmanual_2020_Cyber Physical System.pdf
manual_2020_Cyber Physical System.pdf
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry Pi
 
Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMoore
 
the NML project
the NML projectthe NML project
the NML project
 
Xen time machine
Xen time machineXen time machine
Xen time machine
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 
Computer technicians-quick-reference-guide
Computer technicians-quick-reference-guideComputer technicians-quick-reference-guide
Computer technicians-quick-reference-guide
 
Configuring Raspberry Pi as a Dev Environment
Configuring Raspberry Pi as a Dev EnvironmentConfiguring Raspberry Pi as a Dev Environment
Configuring Raspberry Pi as a Dev Environment
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
Steps to build and run oai
Steps to build and run oaiSteps to build and run oai
Steps to build and run oai
 
8 steps to protect your cisco router
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco router
 
Raspberry pi tutorial
Raspberry pi tutorialRaspberry pi tutorial
Raspberry pi tutorial
 
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick NeshRaspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
Raspberry JAM 1 - Setup Raspberry Pi with Raspbian -Vick Nesh
 
Rete di casa e raspberry pi - Home network and Raspberry Pi
Rete di casa e raspberry pi - Home network and Raspberry Pi Rete di casa e raspberry pi - Home network and Raspberry Pi
Rete di casa e raspberry pi - Home network and Raspberry Pi
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
User manual of n280
User manual of n280User manual of n280
User manual of n280
 
Hardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshopHardwear.io 2018 BLE Security Essentials workshop
Hardwear.io 2018 BLE Security Essentials workshop
 

Plus de Bogusz Jelinski

Dispatching taxi cabs with passenger pool
Dispatching taxi cabs with passenger poolDispatching taxi cabs with passenger pool
Dispatching taxi cabs with passenger poolBogusz Jelinski
 
Dispatching taxi / minibuses - about Kabina project
Dispatching taxi / minibuses - about Kabina projectDispatching taxi / minibuses - about Kabina project
Dispatching taxi / minibuses - about Kabina projectBogusz Jelinski
 
Dividend portfolio – multi-period performance of portfolio selection based so...
Dividend portfolio – multi-period performance of portfolio selection based so...Dividend portfolio – multi-period performance of portfolio selection based so...
Dividend portfolio – multi-period performance of portfolio selection based so...Bogusz Jelinski
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020 Bogusz Jelinski
 
Maturity of-code-mgmt-2016-04-06
Maturity of-code-mgmt-2016-04-06Maturity of-code-mgmt-2016-04-06
Maturity of-code-mgmt-2016-04-06Bogusz Jelinski
 
A few solvers for portfolio selection
A few solvers for portfolio selectionA few solvers for portfolio selection
A few solvers for portfolio selectionBogusz Jelinski
 

Plus de Bogusz Jelinski (8)

Dispatching taxi cabs with passenger pool
Dispatching taxi cabs with passenger poolDispatching taxi cabs with passenger pool
Dispatching taxi cabs with passenger pool
 
robotaxi2023.pdf
robotaxi2023.pdfrobotaxi2023.pdf
robotaxi2023.pdf
 
Dispatching taxi / minibuses - about Kabina project
Dispatching taxi / minibuses - about Kabina projectDispatching taxi / minibuses - about Kabina project
Dispatching taxi / minibuses - about Kabina project
 
Dividend portfolio – multi-period performance of portfolio selection based so...
Dividend portfolio – multi-period performance of portfolio selection based so...Dividend portfolio – multi-period performance of portfolio selection based so...
Dividend portfolio – multi-period performance of portfolio selection based so...
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020
 
Jakt i-polen
Jakt i-polenJakt i-polen
Jakt i-polen
 
Maturity of-code-mgmt-2016-04-06
Maturity of-code-mgmt-2016-04-06Maturity of-code-mgmt-2016-04-06
Maturity of-code-mgmt-2016-04-06
 
A few solvers for portfolio selection
A few solvers for portfolio selectionA few solvers for portfolio selection
A few solvers for portfolio selection
 

Dernier

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 

Dernier (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Home security with Raspberry Pi

  • 1. Home security with Raspberry Pi, not only with Zoneminder As you probably already know you can have a cheap monitoring system with cameras and email notifications using Raspberry Pi and Zoneminder. Although I have managed to use Zoneminder on a RPI 1 B+ with two USB cameras (I had used ZM for a few years before) I still have the feeling that Zoneminder is just a bit too «heavy» for SoC computers - enterprise quality database and enterprise web server for quite a dumb task? So I have begun to downsize my thinking, which eventually will lead to Arduino, better reliability (no SD card!) and power consumption at levels enabling long operation without access to power grid. But today let us start with Zoneminder. There are many tutorials which can easily be found with Google. Let me add mine – th steps below lead to a working Zoneminder on RPI1 with Raspbian Jessie (I will omit 'sudo' at the beginning of commands, you'd rather add it for most of them)1 : 1. change the default password for 'pi' user with 'passwd' 2. if you don't like cables or another keyboard on your desk, enable SSH by running raspi-config and navigating to Interfacing Options / ssh / enable and put RPI aside where it doesn't hamper you. 3. the you maybe don't need X server that consumes resources – use the same raspi-config and Boot Options / B1 Desktop / CLI / B1 Console. While being there - check the time zone! 4. apt-get update 5. it works without apt-get dist-upgrade but you know ... 6. apt-get install php5 mysql-server php5-mysql (works without explicit php-pear here; you will be asked to submit a password to the database, not needed further in this tutorial) 7. apt-get install zoneminder 8. adduser www-data video (you can see the effect in /etc/group – look for a line beginning with video:x:) 9. ln -s /etc/zm/apache.conf /etc/apache2/conf-enabled/zoneminder.conf 10. a2enmod cgi (without it you could get errors like socket_sendto(/tmp/zm/zms-704658s.sock ) failed: No such file or /directory//usr/share/zoneminder/includes/functions.php 2344) 11. a2enconf javascript-common (it did not need to run it on Raspbian but before I had troubles with buttons on web console while running Ubuntu on a PC, just in case) 12. there might still be a bug in your version of ZM – go to /usr/share/perl5/ZoneMinder/Memory.pm and around line 130 change $arch = int(3.2*length(~0)); to2 $arch = 32; 13. echo "kernel.shmmax = 134217728" >> /etc/sysctl.conf echo "kernel.shmall = 2097152" >> /etc/sysctl.conf 14. /etc/init.d/apache2 restart (or service apache2 restart or service apache2 reload ; you could now be able to see Zoneminder at http://localhost/zm) 15. apt-get install postfix (you will be asked to chose for example 'local only') 16. go to /etc/postfix and create file sasl_passwd and put one line into it : [smtp.gmail.com]:587 john.smith:pass1234 Replace user name and password with your credentials; you have noticed that is a line for a Google Mail account. This account is used to send alarm notifications (sent-from). The address of the recipient shall be configured soon in Zoneminder. 17. postmap hash:/etc/postfix/sasl_passwd 1 See https://wiki.zoneminder.com/Raspbian for an explanation of commands 2 Fixed in newer versions by our $arch = 32 + 32*( qx(uname -m) =~ /64/ );
  • 2. 18. rm /etc/postfix/sasl_passwd 19. replace the content of /etc/postfix/main.cf with following lines (you might want to adjust hostname): smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no append_dot_mydomain = no readme_directory = no smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_tls_security_level = may smtp_use_tls = yes smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt myhostname = raspberrypi myorigin = $myhostname alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = raspberrypi, localhost.localdomain, localhost relayhost = [smtp.gmail.com]:587 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = smtp_sasl_tls_security_options = noanonymous 20. /etc/init.d/postfix restart 21. you might test the configuration of Postfix by sendmail some.name@some.address <ENTER> test content <ENTER> . <ENTER> 22. visit your local Zoneminder console http://localhost/zm and configure a monitor – your camera might most probably be like mine:
  • 3. Fig. 1. Monitor configuration 23. Maximum FPS in the monitor's General tab, reduce number of frame in the Buffers tab too 24. Navigate to Options – Email tab. Mark OPT_EMAIL, write the email address alarms should be sent to. EMAIL_HOST will be localhost, the Postfix we configured. 25. if you want pictures to be attached to emails, supplement MESSAGE_BODY with %EI1% and %EIM%, or maybe %ET% for the time of events. 26. Configure a filter:→ Filters → Total score, grater than 20, Email details of all matches → Save "Alarm", run filter in background. Fig. 2. Filter configuration Without Zoneminder Maybe I am not the only one who likes simplicity, and image-based motion recognition might cause troubles. So I decided to build an alternative with two cameras connected via USB, two PIR sensors (Fig. 1), a RFID reader (Fig. 2) to disarm the system easily, and a simple switch to arm it even easier, plus two LEDs for status reporting. This should run like a charm on low-clocked boards and it is way easier to activate/deactivate than using a browser while leaving your apartment. Fig. 3. RDM630 RFID reader Fig. 4. HC-SR501 movement sensor
  • 4. Fig. 5. Pinout of the security system (don't forget to plugin USB cameras!) The only box I had (to put it all together except RPI) was not very satisfactory for my wife but not too bad I guess (see fig. 6.), and I managed to wire all this stuff using one single UTP cable (6 signal cables + VCC + GND), use of an RGB led does not change the wiring/schema.
  • 5. Fig. 6. My control panel All this takes less than hundred lines in Python to run. There are some prerequisites: 1. install Postfix, see 15-20 above 2. apt-get install python-setuptools 3. easy_install pip 4. pip install pyserial 5. apt-get install streamer 6. apt-get install mailutils 7. disable serial being used by console logging. I found a few different ways: a) raspi-config → Interfacing Options → Serial → Login shell NOT accessible over serial b) removing console=serial0,115200 from file /boot/cmdline.txt c) systemctl stop serial-getty@ttyAMA0.service systemctl disable serial-getty@ttyAMA0.service Theoretically you could be able now to run attached myalarm.py3 with nohup python myalarm.py & But before that you need to edit the code and change IDs to your RFID tags and email address too. A short description of LED signals: A very short, green blink (or flash) every 10 seconds Idle, waiting for the switch to be pressed (system to be armed - surveillance to be activated) - default state after start Longer, green blink twice a second You have just pressed the switch and have 10 seconds (may be reconfigured in the code) to leave the property Short, red flash every 10 seconds Waiting for an intruder or you coming home Red 1sec light Intruder detected Long, 4sec, green light You have just disarmed your security system with a RFID tag 3 You can get the code here: https://sites.google.com/site/boguszjelinski/home/raspberry-arduino
  • 6. A few comments to the source code, or just hints for you to write your own: - LEDs and PIR sensors are configured by standard GPIO.setup GPIO.OUT and GPIO.IN respectively - for that wiring of switch you need GPIO.setup (?, GPIO.IN, pull_up_down=GPIO.PUD_UP) - the RFID reader is connected to GPIO15 which is board's RX, this can be read with ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=0.1) and ser.read(12) This works on Raspbian Jessie on RPI 1, but it might be changed to /dev/serial0 with other distributions. - maybe there should be a resistor for the switch too - I use streamer to dump images from USB cameras: streamer -c /dev/video0 -s 640x480 -o camdmp.jpeg and streamer -c /dev/video1 -s 640x480 -o camdmp2.jpeg for the second camera - write some alarming wake-up text into alarmmsg.txt file and send email with: mail -s "Alarm" -t john.smith@gmail.com -A camdmp.jpeg -A camdmp2.jpeg < alarmmsg.txt Have fun! Bogusz, Moss, Norway, 10-09-2017