Cov txheej txheem:

Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi: 6 Cov Kauj Ruam (nrog Duab)
Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi: 6 Cov Kauj Ruam (nrog Duab)

Video: Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi: 6 Cov Kauj Ruam (nrog Duab)

Video: Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi: 6 Cov Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi
Kev Ruaj Ntseg Hauv Tsev Nrog Raspberry Pi

Qhov ntawd yog kev daws teeb meem yooj yim uas tuaj yeem ua rau koj xis nyob ntau dua thaum koj tawm ntawm koj lub tsev - tau txais email nrog cov duab ntawm koj lub tsev tau ntsib los ntawm cov neeg tsis xav tau, caj npab thiab tshem riam phom rau koj li kev nyab xeeb txoj kev yooj yim tshaj plaws thiab txhim khu kev qha (nias qhov hloov thiab mus kom ze RFID tag). Thiab nws raug nqi ze li tsis muaj dab tsi - Kuv them ntau dua txhua hli rau kev siv Internet. Koj xav tau clone ntawm Raspberry Pi, ob peb qhov khoom siv hluav taws xob thiab … Kev siv Internet.

Thov nco ntsoov tias Zoneminder tsis siv rau hauv phau ntawv qhia no. Yog tias koj xav siv Zoneminder, saib ntawm no:

sites.google.com/site/boguszjelinski/home/…

Kauj Ruam 1: Khoos Phis Tawj Koj Xav Tau

Khoos phis tawj koj xav tau
Khoos phis tawj koj xav tau

1. Raspberry Pi lossis nws cov clone, kuj saib:

www.instructables.com/id/Home-Security-With-Orange-Pi/

Qhov pheej yig tshaj uas yuav ua rau koj nkag tau mus rau lub network thiab tus naj npawb ntawm cov koob yees duab uas koj xav tau. Tsis txhob hnov qab yuav cov khoom siv hluav taws xob kom tsim nyog nrog cov txuas txuas tsim nyog

2. RFID nyeem ntawv nrog kav hlau txais xov

3. PIR sensor (s)

4. qhov hloov pauv ib ntus uas txuas rau lub Circuit tsuas yog thaum koj nias rau nws (nrog lub caij nplooj ntoo hlav?)

5. ob lub LEDs - ntsuab thiab liab. Los yog ib qho RGB coj.

6. ob 1k resistors

7. USB lub koob yees duab

8. UTP cable txuas PIR sensors, hloov, coj thiab nyeem ntawv RFID (Kuv tau tswj kom txuas tag nrho nrog ib txoj kab nrog 8 xov hlau, lossis 4 khub yog tias koj nyiam)

9. ib lub thawv me lossis ob yog tias koj xav tiv thaiv koj cov khoom siv hluav taws xob lossis tsis xav khav theeb txog koj li kev txawj ntse.

10. ib qho txuas mus rau ntawm lub teeb ci - rau teeb meem thaum hmo ntuj

Kauj ruam 2: Nruab Postfix

Tom qab tau teeb tsa Linux koj yuav tsum tau teeb tsa ob peb lub software tsim los khiav kuv qhov piv txwv piv txwv. Ua ntej koj yuav tsum teeb tsa Postfix yog tias koj xav xa email:

1. apt-tau nruab postfix (koj yuav raug nug kom xaiv piv txwv 'hauv zos nkaus xwb')

2. mus rau /etc /postfix thiab tsim cov ntaub ntawv sasl_passwd thiab muab ib kab rau hauv:

[smtp.gmail.com]: 587 john.smith: pass1234

Hloov tus neeg siv lub npe thiab tus lej zais nrog koj daim ntawv pov thawj; koj tau pom tias yog kab rau tus lej Google Xa Ntawv. Tus lej no yog siv los xa cov ntawv ceeb toom ceeb toom (xa los ntawm).

3. postmap hash:/etc/postfix/sasl_passwd

4. rm/etc/postfix/sasl_passwd

5. hloov cov ntsiab lus ntawm /etc/postfix/main.cf nrog cov kab hauv qab no (koj yuav xav kho lub npe hostname):

smtpd_banner = $ myhostname ESMTP $ mail_name (Ubuntu)

pib = no

append_dot_mydomain = tsis yog

readme_directory = tsis muaj

smtp_tls_session_cache_database = btree: $ {data_directory}/smtp_scache

smtp_tls_security_level = tej zaum

smtp_use_tls = yog

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 = tag nrho

smtp_sasl_auth_enable = yog

smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

smtp_sasl_security_options =

smtp_sasl_tls_security_options = noanonymous

6. /etc/init.d/postfix rov pib dua

7. koj tuaj yeem sim teeb tsa ntawm Postfix los ntawm kev xa email [email protected] cov ntsiab lus ntsuas.

Kauj ruam 3: Npaj Software

Txog kuv li Raspberry Pi B+ thiab Raspbian Jessie Kuv yuav tsum ua raws cov hauv qab no ntxiv:

1. apt-tau nruab sej-setuptools

2. easy_install pip

3. pip nruab pyserial

4. apt-tau nruab mailutils

5. lov tes taw serial raug siv los ntawm console txiav. Kuv pom ob peb txoj hauv kev sib txawv:

a) raspi-config Options Interfacing Options → Serial → Nkag mus rau lub plhaub TSIS nkag mus tau ntau dua

b) tshem tawm console = serial0, 115200 los ntawm cov ntawv /boot/cmdline.txt

c) systemctl nres [email protected]

systemctl lov tes taw [email protected]

6. apt-tau nruab sej-opencv

7. apt-tau nruab imagemagick

Kauj Ruam 4: Hlau Nws thiab Khiav Nws

Hlau Nws thiab Khiav Nws
Hlau Nws thiab Khiav Nws

Txuas koj qhov chaw raws nraim li tau hais hauv daim duab. Yog tias koj tsis ua li ntawd koj yuav tsum tau hloov pauv hauv qhov chaw los cuam tshuam cov lej hloov chaw.

Ceeb toom! RPI IOs tsis lees txais 5V, koj yuav tsum siv piv txwv li. tus TTL hloov pauv cov laj thawj kom txo qhov hluav taws xob los ntawm RFID lossis PIR sensors. Kuv qhov kev xaiv yog 74HC4050.

Ok, raws li kev xav koj tuaj yeem tam sim no khiav rpi-alarm.py nrog:

nohup nab hab sej rpi-alarm.py &

Tab sis ua ntej ntawd koj yuav tsum hloov kho cov cai thiab hloov tus lej ID rau koj li cim npe RFID thiab email chaw nyob ib yam. Koj tuaj yeem tau txais cov cai ntawm no:

github.com/boguszjelinski/rpi-alarm

Thawj qhov pib yuav pib nrog hom kev kawm nrog ntsuab thiab liab LEDs ntsais muag. Nws lub hom phiaj yog los tsim cov ntaub ntawv rfid.txt nrog cov lej RFID - mus rau koj cov ntawv cim npe rau antena, ob peb zaug rau txhua tus, thiab nias qhov hloov pauv tsuav koj tau txais lub teeb ntsuab ntev dua. Tom qab ntawd kho cov ntawv kom pom tias nws tsis puas - nws yuav tsum muaj kab ntau npaum li koj muaj cim npe, 10 tus cim txhua tus. Koj tuaj yeem tsim cov ntaub ntawv ntawm tus kheej, tau kawg, hom kev kawm yuav raug hla. Nco ntsoov tias koj qhov nias ntev ntawm qhov hloov pauv tuaj yeem ua rau muaj kev phom sij rau koj li tom qab kev kawm paub ua tiav lub kaw lus tos kom muaj riam phom - saib "cov cim qhia siv".

Kauj Ruam 5: Teeb liab Siv

Teeb liab Siv
Teeb liab Siv

Qhov hloov kho tshiab ntawm cov cai kuj tseem muaj "hom kev kawm" - ntsuab thiab liab coj lub teeb ntsais ntsais. Lub teeb ntsuab ntsuab ntev dua (tom qab nias lub hloov) lees paub ua tiav ntawm hom.

Kauj Ruam 6: Ob peb Cov Lus Qhia Thaum Xaus

Ob peb lus hais rau qhov chaws, lossis tsuas yog qhia rau koj sau koj tus kheej:

- LEDs thiab PIR sensors tau teeb tsa los ntawm tus qauv GPIO.setup GPIO. OUT thiab GPIO. IN feem

- rau qhov txuas ntawm qhov hloov pauv koj xav tau GPIO.setup (?, GPIO. IN, pull_up_down = GPIO. PUD_DOWN)

- tus nyeem ntawv RFID txuas nrog GPIO15 uas yog pawg thawj coj RX, qhov no tuaj yeem nyeem nrog

ser = serial. Serial ('/dev/ttyAMA0', 9600, sijhawm tas = 0.1) thiab ser.read (12)

Qhov no ua haujlwm ntawm Raspbian Jessie ntawm RPI 1, tab sis nws yuav raug hloov mus rau /dev /serial0 nrog lwm qhov kev faib tawm.

- Kuv siv siv lub kwj deg los tso cov duab los ntawm USB lub koob yees duab:

streamer -c /dev /video0 -s 640x480 -o camdmp.jpg

thiab streamer -c /dev /video1 -s 640x480 -o camdmp2-j.webp

tab sis nws poob ntawm Orange Pi, yog li tam sim no kuv siv CV. Txhawm rau nruab streamer ntaus qhov no:

apt-tau nruab streamer

- sau qee cov ntawv ceeb toom tsa suab rau hauv alarmmsg.txt cov ntawv thiab xa email nrog:

xa -s "Tswb" -t [email protected] -A camdmp-j.webp

- hloov koj tus email chaw nyob hauv kab (kab 51)

Muaj kev lom zem!

Pom zoo: