Cov txheej txheem:

Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Tuag: 5 Kauj Ruam (nrog Duab)
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Tuag: 5 Kauj Ruam (nrog Duab)

Video: Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Tuag: 5 Kauj Ruam (nrog Duab)

Video: Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Tuag: 5 Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub
Raspberry PI Lub Koob Yees Duab thiab Lub Teeb Tswj Lub Hnub Qub

Raws li ib txwm kuv tab tom nrhiav tsim cov cuab yeej uas muaj txiaj ntsig, ua haujlwm ruaj khov thiab feem ntau yog txawm tias txhim kho piv rau tam sim no tawm ntawm lub txee daws teeb meem.

Nov tseem yog lwm qhov haujlwm zoo, thawj lub npe hu ua Duab Ntxoo 0f Phoenix, Raspberry PI daim ntaub thaiv ua ke nrog Arduino raws kev txav txav pom thiab tswj lub teeb.

Kauj Ruam 1: Lub Xeev Kev Lag Luam IP Koob Yees Duab

Lub Xeev Kev Lag Luam IP Koob Yees Duab
Lub Xeev Kev Lag Luam IP Koob Yees Duab
Lub Xeev Kev Lag Luam IP Koob Yees Duab
Lub Xeev Kev Lag Luam IP Koob Yees Duab
Lub Xeev Kev Lag Luam IP Koob Yees Duab
Lub Xeev Kev Lag Luam IP Koob Yees Duab

Dhau li ntawm kev tsim koj tus kheej lub koob yees duab/kev saib xyuas lub cev yog qhov txias dua cia saib seb vim li cas qhov no yog kev txhim kho los ntawm kev daws teeb meem.

Kuv yuav piv nws nrog NEO COOLCAM Full HD 1080P Wireless IP Camera series txij li kuv tau muaj ntau tus qauv ntau yam ntawm neo coolcams (ONVIF) lub koob yees duab. Lawv tuaj nyob rau hauv cov duab sib txawv thiab ntau thiab tsawg, sab nraum zoov thiab sab hauv, feem ntau ntawm lawv tau tsim hauv kev txhawb nqa wifi tab sis cia peb pom lawv qhov kev ceeb toom:

  • Cov tuam txhab Suav uas muag cov koob yees duab no yuav luag ib txwm dag txog qhov ua rau lub teeb pom kev zoo, thaum koj yuav lub koob yees duab 5MP/8MP ntawm Ebay koj yuav xaus nrog lub koob yees duab pheej yig 2MP nrog daim duab tsis zoo (nws ua haujlwm tab sis qhov zoo yog pov tseg). Thaum koj yuav lub 8MP Raspberry PI v2 lub koob yees duab los ntawm tus muag khoom qub koj yuav tau txais yam koj tau them rau thiab qhov tseeb 8MP sensor nrog kev daws teeb meem 3280 × 2464 pixels => https://www.raspberrypi.org/documentation/hardwar …
  • Los ntawm kev ruaj ntseg pom cov koob yees duab no (txawm tias kim dua Dlink thiab lwm tus qauv) yog qhov txaus ntshai, lawv siv tus lej zais tsis raug xws li 123456 lossis ua hauv cov neeg siv xws li admin/admin tus neeg ua haujlwm/tus neeg ua haujlwm dab tsi koj yuav tsis tuaj yeem hloov pauv lossis kev hloov pauv tau ploj mus tom qab rov pib dua. Sab saum toj nws tawm nrog ntau lub koob yees duab lub xov tooj hauv tsev (txuas rau lawv cov servers hauv Suav teb, qee qhov txawm ntws rov qab yees duab/duab yam tsis nug koj tsuas yog ua kom yooj yim dua thaum koj txiav txim siab teeb tsa lawv Android/Iphone app ib hnub los tshuaj xyuas koj tsev). Txawm hais tias koj tso cov cuab yeej no tom qab lub router nws tsuas yog tsis zoo txaus, qhov zoo tshaj yog tias koj tsis teeb tsa lub qhov rooj tsis raug nyob hauv lawv, thaiv lawv tawm lossis muab tso rau hauv VLAN kom ua rau lawv tsis tuaj yeem tawm mus rau Internet lossis zoo dua: tsis txhob siv lawv txhua.
  • Puas yog lawv ntseeg tau? tsis yog, ntau ntawm lawv txawm tias kim dua DLINKs muaj kev xaiv rov qhib lub koob yees duab txhua hnub/txhua lub lim tiam thiab lwm yam. Tsuas yog xav txog lawv li qub Win95 lub thawv uas yuav tsum tau rov pib dua ntau zaus dua li:) Kuv tsis hais tias Raspi raws li kho vajtse yog pob zeb khov heev uas koj tuaj yeem tsim lawv rau hauv kev tswj hluav taws xob nuclear tab sis nrog kho vajtse/software kom raug kev teeb tsa, lub rhaub dej kub, lub tshuab cua txias tsis siv neeg thiab txo qis RW kev ua haujlwm ntawm SDCARD lawv tuaj yeem yooj yim ntaus 100+ hnub ua haujlwm tsis muaj teeb meem. Thaum lub sijhawm sau kuv qhov DeathStar sau txij li 34 hnub, tau dhau 100 tab sis qee zaum kuv tau raug nyiag los ntawm kev pub zaub mov hauv lub zog uas yog siv qee qhov ntawm kuv cov kev sib tw yog li yuav tsum tau kaw nws:(
  • Lub hom phiaj kho vajtse: lawv tau ua rau 1 lub hom phiaj tshwj xeeb, feem ntau tuaj nrog thaj chaw nvram me thiab tsis khoom tab sis qee cov qauv ua rau nkag mus rau lub plhaub no ua tsis tau zoo ib yam yog li txhua yam koj tuaj yeem siv lawv yog qhov lawv txhais tau tias yuav siv rau thaum koj tuaj yeem ua tau siv koj lub koob yees duab Raspi raws li lwm yam haujlwm: cov ntaub ntawv server, tftp/dhcp server, web server, quake server … cov kev xaiv yog txwv.
  • Qhov chaw cia: lawv tsis muaj lossis lawv siv daim npav me me nrog FAT32 cov ntaub ntawv kaw lus VS ntawm raspberry pis koj tuaj yeem txuas 2 TB nyuaj tsav yog tias koj nyiam.
  • Tswj lub teeb: qee qhov muaj lub tswb ALARM qhov twg koj tuaj yeem tuaj yeem txuas txuas me me kom muaj teeb pom kev. Raws li kuv yuav qhia koj hauv qhov kev qhia no siv lub koob yees duab infrared ua tiav lub sijhawm pov tseg vim tias koj yuav tsis tuaj yeem txheeb xyuas leej twg ntawm IR cov duab vim qhov tsis zoo. Yog tias koj xav tau kaw cov vis dis aus hauv qhov tsaus ntuj txoj hauv kev zoo tshaj yog qhib lub teeb ua ntej ces kaw cov vis dis aus.

Yog li koj yuav nug tias puas muaj PROs ntawm kev siv lub koob yees duab tawm ntawm lub txee? Yog rau cov lag luam uas cov sijhawm ua haujlwm los teeb tsa nws yuav kim dua li tinkering ib puag ncig nrog Raspberry pis (tsis yog rau kuv li cas:)) thiab yog muaj cov kab saum toj kawg nkaus kab (500 $+ nrog daws teeb meem zoo dua li lub koob yees duab pi ntawm chav kawm). Raws li lwm qhov txiaj ntsig kuv tuaj yeem hais tias cov koob yees duab tom qab ONVIF tus qauv ua rau hauv nruab nrab muab kev yooj yim dua. Qhov no muab tus txheej txheem cuam tshuam dab tsi tuaj yeem siv los xa cov lus txib rau lub koob yees duab los teeb nws IP/Network daim npog/Rooj vag thiab lwm yam. Txog qhov no koj tuaj yeem rub tawm Onvif tus thawj tswj ntaus ntawv los ntawm Sourceforge. Ntau yam ntawm cov cuab yeej no tuaj nrog lub siab phem tawg lub web frontends qhov piv txwv nws tsis tso cai rau koj teeb tsa tus ip lossis netmask kom raug vim tias javascript uas lees paub cov haujlwm no tsis ua haujlwm thiab koj tsuas yog txoj hauv kev los teeb tsa cov kev ntsuas no kom raug yog los ntawm ONVIF.

Kauj Ruam 2: Cov phiaj xwm ntawm Lub Hnub Tuag

Cov phiaj xwm ntawm Lub Hnub Tuag
Cov phiaj xwm ntawm Lub Hnub Tuag
Cov phiaj xwm ntawm Lub Hnub Tuag
Cov phiaj xwm ntawm Lub Hnub Tuag
Cov phiaj xwm ntawm Lub Hnub Tuag
Cov phiaj xwm ntawm Lub Hnub Tuag

Koj tuaj yeem tsim cov cuab yeej no nrog ib qho ntawm Raspberry PIs pib los ntawm 1 txog 3B+. Txawm tias xoom muaj lub koob yees duab chaw nres nkoj, tab sis txij li muaj ntau qhov sib txawv ntawm ob txhais tes raspis nyob rau ntawm kev ua lag luam koj yuav xav tsis thoob uas yog qhov zoo tshaj plaws rau qhov kev tsim no.

Cov lus teb nyob ntawm seb koj xav ua cov kwj video ntawm qhov twg.

Muaj ob txoj kev xaiv:

1, Ua cov vis dis aus hauv ib cheeb tsam nrog cov lus tsa suab thiab xa cov vis dis aus thaum muaj cov lus pom pom (ceeb toom: tsab ntawv tsa suab xa mus qeeb qeeb mus rau tus neeg rau zaub mov tsis muaj teeb meem dab tsi, qhov no tuaj yeem nyob ntawm qhov kev daws teeb meem thiab tus nqi koj siv los ntawm ob peb ib puas megabytes mus rau ntau gigabytes hauv ib hnub, tsuas yog ceeb toom yog tias koj xav teeb tsa ntawm qhov ntsuas sib txuas). Ntawm no CPU teeb meem thiab hmoov tsis zoo tsab ntawv tsa suab (thaum lub sijhawm sau ntawv) tsis ua kom zoo dua ntawm ntau lub cores, txawm li cas los xij OS yuav sim ua kom sib npaug ntawm lub nra me ntsis. Koj yuav ib txwm muaj cov cores ntawm 100% kev siv.

2, Ua cov vis dis aus ntawm lub hauv paus neeg rau zaub mov: ntawm no koj tsuas yog xa cov vis dis aus tshiab los ntawm lub koob yees duab mus rau lwm qhov chaw rub tawm sab nraud (zoo li iSpy khiav ntawm lub tshuab x86 lossis MotionEyeOS khiav ntawm lwm lub minicomputer tshwj xeeb). Txij li thaum tsis muaj kev ua haujlwm hauv zos tus qauv ntawm PI koj siv tsis muaj teeb meem, PI1 yuav xa tib lub kwj dej raws li PI3B+.

Hauv qhov kev qhia no kuv yuav mus nrog thawj qhov kev xaiv.

Txoj cai ntawm tus ntiv tes xoo ntawm no yog tias CPU nrawm dua koj pov rau ntawm cov lus pom zoo koj yuav tau txais. Piv txwv li kuv lub Raspi 2 raws lub koob yees duab saib ntawm txoj kev hauv tsev qee zaum tsis khaws nws thaum qee tus neeg mus nrawm thiab thaum nws tau kaw cov suab kaw tau qeeb, poob ntau cov thav duab piv rau tus qauv 3. Tus qauv 3 kuj muaj 802.11 abgn wifi uas los ua ke kom muaj peev xwm tshaj tawm cov vis dis aus zoo dua, nws ua haujlwm tawm ntawm lub thawv thiab nws ntseeg tau heev. Thaum lub sijhawm sau ntawv tias tus qauv 3B+ tau tawm kuv tsuas yog xav kom koj tau txais qhov ntawd nrog 1.4 Ghz Quad Core cpu.

Cov npe khoom

  • 30 cm yas DeathStar:)
  • Raspberry Pi 3 B+
  • PiCam v2 (8MP)
  • Arduino Pro Micro 5.5v
  • 2x SIP-1A05 Reed Hloov Hloov
  • 1x PCS HC-SR501 IR Pyroelectric Infrared IR PIR Motion Sensor Detector Module
  • 1x 10kohm resistor rau LDR
  • 1 x LDR
  • 1x12V 4A DC adapter
  • 1xWarm Dawb LED 5050 SMD Saj zawg zog Teeb Teeb Sawb 12V DC
  • 1xBuck voltage tswj

Raws li koj tuaj yeem pom nws ntawm kab lus no txoj haujlwm no tau tsim los tswj ib lub teeb nrog ib qho kev xa tawm vim tias kuv tsis tau npaj rau ntxiv teeb pom kev sab hauv (uas yog qhov txias heev) yog li kuv tsuas yog siv lub zog thib ob txuas mus rau Arduino. Qhov zoo tshaj plaws ntawm SIP-1A05 yog tias nws muaj sab hauv flyback diode thiab kev siv hauv mA yog txoj hauv kev Arduino ib tus lej txwv lub zog txwv.

Qhov laj thawj yog vim li cas PIR nyob ntawm daim ntaub thaiv ntawm cov duab vim thaum pib S0P tau npaj yuav muab tso rau hauv lub thawv yas yooj yim IP tsis yog DeathStar. Raws li koj yuav kwv yees lub koob yees duab yog ncaj qha mus rau hauv rab phom laser PIR thiab LDR xav tau lwm qhov drilled qhov thiab lawv tau nplaum-phom vim kuv tsis npaj yuav tshem tawm lawv.

Lub qhov raug laum rau hauv qab ntawm DeathStar qhov uas kuv tau glued hauv qhov ntsia liaj qhov rooj loj nrog muaj zog 2 tivthaiv nplaum. Qhov no tuaj yeem raug ntsia mus rau qhov qub Neo Coolcams sawv (nws tau zoo rau qee yam tom qab tag nrho:)). Txog kev txhawb nqa ntxiv kuv siv cov xov tooj tawv tawv kom tuav tau saum lub hnub qub.

Cov ntawv tseem ceeb hais txog lub zog xa khoom: txij li cov khoom siv tib lub zog yuav ua rau ob qho tib si PI, Arduino thiab cov kab hluav taws xob LED nws yuav tsum yog nqaij nyug txaus kom muaj peev xwm tswj tau lawv txhua tus yog li nws yuav ua raws li cov hlua LED koj xaiv rau txoj haujlwm. Ib qho kev sib tw 5050 12v 3meter LED sawb dej nyob ib puag ncig 2A, qhov ntawd ntau heev. Rau PI thiab Arduino koj yuav tsum suav hauv +2A (txawm hais tias qhov no loj dua nws yuav tsis mob). Siv cov kab hluav taws xob LED hla tus qauv qij halogen, neon lossis lwm lub zog loj teeb pom kev zoo yog tias koj tuaj yeem tso tag nrho cov Circuit Court ntawm qhov zoo 12V@10Ah ua kua qaub roj teeb ua thaub qab yog li nws tseem yuav ua haujlwm thaum muaj lub zog hluav taws xob.

Tus phaw yuav nqis qis dua qhov hluav taws xob los ntawm 12-> 5V rau lub zog rau Arduino thiab PI thaum lub sijhawm ncaj qha 12V pub yog xaim ntawm qhov txuas mus tig LED kab rau.

Kauj ruam 3: Software Arduino

Software Arduino
Software Arduino

Koj tuaj yeem pom cov peev txheej tag nrho hauv qab no uas tau hais tawm zoo tab sis ntawm no yog cov lus piav qhia luv luv tias nws ua haujlwm li cas: Thaum pib ntawm txhua lub voj ib txwm xcomm () ua haujlwm tau hu los saib seb puas muaj lus txib los ntawm Raspberry PI uas tuaj yeem yog LIGHT_ON/OFF kom tig txoj kev teeb pom kev ntawm ON lossis DS_ON/OFF kom tig lub DeathStar backlight ON/OFF, Kuv tau siv cov no tsuas yog rau qhov ua kom zoo dua txij li yog tias qee tus neeg dhau los ntawm PIR yuav tsum khaws nws thiab qhib lub teeb tab sis tej zaum koj xav saib ntawm qhov chaw vim qee yam txawm tias thaum tsis muaj leej twg nyob ntawd.

Tom qab qhov no tus nqi photocell nyeem hauv thiab tus pin tsab ntawv tsa suab tau txheeb xyuas qhov txav. Yog tias muaj tsab ntawv tsa suab txheeb xyuas yog tias nws tsaus txaus ces nws kuaj xyuas yog tias peb tsis nyob twj ywm. Yog tias tag nrho cov no dhau mus nws yooj yim tig txoj kev hauv tsev qhib thiab xa rov qab PHOENIX_MOTION_DETECTED mus rau Raspberry PI, yog tias nws tsis tsaus txaus nws tseem qhia rov qab rau lub khoos phis tawj tab sis tsis qhib lub teeb. Thaum pom cov lus tsa suab lub sijhawm 5 feeb tuav lub sijhawm pib.

Txoj cai tom qab qhov no ntu ntu ntu tom ntej yuav tshuaj xyuas seb peb puas tau tuav (uas yuav tsum yog rooj plaub yog tias tsuas muaj cov lus tsa suab, yog li cia peb xav tias 5 feeb dhau los yog li qhov kev txheeb xyuas no tuaj yeem lees paub). Txoj cai kuaj xyuas seb puas muaj kev txav mus los dua, yog tias tsis yog ces tig lub teeb tawm. Raws li koj tuaj yeem pom yog tias tsis muaj lus tsa suab qhov kev ua haujlwm no yuav rov ua nws tus kheej ib zaug thiab rov ua dua kom sim tua lub teeb kom tsis muaj kev tawm tswv yim rau PC.

Peb muaj lwm tus tuav lub sijhawm rau DeathStar lub teeb pom kev sab hauv uas yog nyob ntawm photocellReading <dark_limit.

Txawm hais tias 2 txoj kev ua haujlwm tsis paub txog ib leeg, lawv yuav ua haujlwm zoo ua ke txij thaum lub teeb ntawm txoj kev hauv tsev mus rau nws muab lub teeb pom kev ntau heev uas LDR yuav xav tias nws yog nruab hnub dua thiab nws kaw lub teeb pom kev sab hauv. Txawm li cas los xij muaj qee qhov kev ceeb toom txog cov txheej txheem no uas tau piav qhia hauv txoj cai yog tias koj txaus siab, yog tias tsis yog tom qab siv Nvidia cov lus teb tias "nws tsuas yog ua haujlwm!".

Kauj Ruam 4: Software Raspberry PI

Software Raspberry PI
Software Raspberry PI
Software Raspberry PI
Software Raspberry PI
Software Raspberry PI
Software Raspberry PI

Qhov tseeb Raspbian ua haujlwm rau kuv:

Raspbian GNU/Linux 9.4 (ncab)

Linux Phoenix 4.9.35-v7+ #1014 SMP Hnub Friday Lub Rau Hli 30 14:47:43 BST 2017 armv7l GNU/Linux ii tsab ntawv tsa suab 4.0-1 armhf V4L ntes cov phiaj xwm txhawb nqa kev nrhiav pom

Thaum koj tuaj yeem siv lwm yam kev cuam tshuam, yog tias koj ua rau muaj teeb meem nrog lub koob yees duab koj tsuas yog tau txais kev txhawb nqa los ntawm pab pawg yog tias koj tab tom siv lawv li OS. Tshem tawm qhov tsis xav tau bloatware xws li systemd kuj tseem pom zoo.

Tsab ntawv tsa suab kuj tseem tuaj yeem tsim los ntawm qhov yooj yim:

apt-tau -y nruab autoconf automake pkgconf libtool libjpeg8-dev tsim-qhov tseem ceeb libzip-dev apt-tau nruab libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev

apt-tau -y nruab libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev apt-tau -y nruab git git clone https://github.com/Motion-Project/motion cd motion/autoreconf -fiv. /configure --prefix =/usr/tsab ntawv tsa suab && ua nruab/usr/tsab ntawv tsa suab/rau hauv/tsab ntawv tsa suab -v

Kuv pom zoo iSpy ua tus kaw video/sau neeg rau zaub mov. Hmoov tsis zoo thaum lub sijhawm sau ntawv tsis muaj lwm txoj hauv kev zoo rau Linux. Lub koob yees duab tuaj yeem ntxiv nrog MJPEG url https:// CAMERA_IP: 8081 qhov chaw nres nkoj pib.

Kev ua cov lus tsa suab tuaj yeem muaj txiaj ntsig piv txwv li koj tsis tas yuav saib xyuas koj li iSpy server txhua hnub ntev, koj tuaj yeem tau txais email thaum muaj kev tawm suab. Txawm hais tias iSpy muaj lub luag haujlwm no los ceeb toom hauv email thaum muaj kev tawm suab, nws qhib rau kaw ib ntus rau lwm yam xwm txheej zoo li qee lub teeb pom kev rau thaj chaw. Nrog PIR qhov kev tshawb nrhiav pom kuv yeej tsis muaj ib lub tswb cuav. Kev ceeb toom tuaj yeem ua tiav hauv zos:

Pir tsab ntawv tsa suab tshwm sim ntawm sensor> Arduino ceeb toom> Raspberry pi tau txais ntawm console> C ua haujlwm program> Ntawv thov sab nrauv

Txawm li cas los xij kuv nyiam ua ob lub cav thiab cov vis dis aus nyob deb li ntawd hauv qhov no kuv tau ntxiv ntu rau C tswj qhov kev zov me nyuam thaum nws teev cov cav hauv ib cheeb tsam rau hauv cov ntawv yooj yim, tseem teev nws rau syslog thiab uas tau xa mus rau SIEM rau ua ntxiv

void logger (char *ntawv nyeem) {

FILE *f = fopen ("phoenix.log", "a"); yog (f == NULL) {printf ("Yuam kev qhib cov ntaub ntawv log! / n"); rov qab; } fprintf (f, " %s => %s / n", cur_time (0), ntawv nyeem); fclose (f); #ifdef SYSLOG char loggy [500]; sprintf (loggy, " %s => %s / n", cur_time (0), ntawv nyeem); setlogmask (LOG_UPTO (LOG_NOTICE)); openlog ("DeathStar", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER); // syslog (LOG_NOTICE, "Txoj haujlwm pib los ntawm Tus Neeg Siv %d", getuid ()); syslog (LOG_NOTICE, loggy); kaw (); #endif rov qab; }

Ntawm qhov tau txais qhov kawg syslog-ng tuaj yeem tshem tawm cov xwm txheej no los ntawm cov cav tseem ceeb:

lim f_phx {

phim ("DeathStar"); }; lo lus uas peb d_phx {file ("/var/log/phoenix/deathstar.log"); }; log {qhov chaw (s_net); lim (f_phx); lo lus uas peb (d_phx); };

thiab nws tuaj yeem xa mus rau lwm lub cuab yeej (motion.php saib txuas) rau kev tshuaj xyuas thiab ceeb toom.

Hauv tsab ntawv no koj tuaj yeem teeb tsa lub sijhawm ib txwm muaj nyob rau lub asthiv thaum koj tsis nyob hauv tsev:

$ opt ['alert_after'] = '09:00:00'; // Sawv ntxov $ opt ['alert_before'] = '17:00:00'; // Yav tsaus ntuj

Php program siv cov cuab yeej siv logtail zoo los cais cov cav.

$ cmd = "logtail -o". $ offsetfile. ' '. $ logfile.'> '. $ logfile2;

Logtail taug qab txoj haujlwm hauv cov ntaub ntawv offset yog li qhov haujlwm tseem ceeb tsis tas yuav paub txog lub sijhawm twg los pib saib cov cav ntawm, nws yuav muab nrog cov ntaub ntawv tsis tiav tshiab kawg.

Motion.php tuaj yeem khiav los ntawm crontab nrog cov lus dag me me rau hnub so, thaum nws yuav hla cov cav, tab sis tsis ua ntxiv.

*/5 * * * 1-5/usr/local/bin/php ~/motion.php &>/dev/null */5 * * * 6-7/usr/local/bin/php ~/motion.php lis xaus &>/dev/null

Kauj Ruam 5: Teeb Meem thiab ToDo Sau

Teeb Meem thiab ToDo List
Teeb Meem thiab ToDo List
Teeb Meem thiab ToDo List
Teeb Meem thiab ToDo List

Yog tias koj siv Raspberry pi 3 lossis tshiab dua koj tuaj yeem hla ntu no, koj yuav zoo li yuav tsis ntsib teeb meem no ntxiv lawm.

Hauv lub xyoo kuv muaj qee qhov teeb meem nrog Raspberry pi 2 raws cov laug cam uas yuav ua haujlwm tib lub software pawg tab sis tau yuav ntawm lub sijhawm sib txawv los ntawm ntau qhov chaw. Tom qab qee lub sijhawm uas tuaj yeem yog 2 hnub lossis 20 hnub thaum SSHing nyob rau hauv lub cuab yeej SSH yuav cia li dai, yog li ob qho tib si cov lus dab daemon thiab lub zos C code uas tham nrog Arduino tau thauj mus rau hauv ram yog li ntawd lub cuab yeej tau ua haujlwm tab sis nws tsis tuaj yeem ua lwm yam nrog nws ntxiv hauv lub xeev no.

Tom qab ntau qhov teeb meem kuv tau los nrog kev daws teeb meem:

homesync.sh

#!/bin/sh -e

### Pib INFO INFO # Muab: homesync # Yuav tsum-Pib: mountkernfs $ local_fs # Yuav tsum-Nres: lub koob yees duab phoenix # Default-Start: S # Default-Stop: 0 6 # Short-Description: Tsev synchronizer # Nqe lus piav qhia: Tsev synchronizer los ntawm NLD ### Xaus INIT INFO Npe = tsev DESC = "Ramdisk Tsev Synchronizer" RAM = "/home/" DISK = "/realhome/" set -e case "$ 1" in start | forth) ncha -n "Pib $ DESC: "rsync -az --numeric -ids -tshem $ DISK $ RAM &> /dev /null ncho" $ NAME. ";; nres | rov qab) ncha -n "Nres $ DESC:" rsync -az --numeric -ids -tshem $ RAM $ DISK &> /dev /null ncho "$ NAME.";; *) ncha "Siv: $ 0 {pib | nres}" tawm 1;; esac Exit 0

Tsab ntawv mus ua ke nrog kev hloov fstab:

tmpfs /home tmpfs rw, size = 80%, nosuid, nodev 0 0

Kev faib khoom hauv tsev tau teeb tsa raws li ramdisk uas yuav ua rau kwv yees li 600MB qhov chaw pub dawb ntawm Raspberry pi 2 uas ntau dua li txaus los khaws qee qhov binaries thiab cov ntaub ntawv me me:

tmpfs 690M 8.6M 682M 2% /tsev

Nws muab tawm tias PI dai tau raug ntaus nqi los ntawm kev ua haujlwm ntawm SDcard, txawm hais tias kuv tau sim daim npav sib txawv (Samsung EVO, Sandisk) uas tau txheeb xyuas qhov ua yuam kev ntau zaus ua ntej thiab tom qab thiab lawv tsis muaj teeb meem hauv lwm lub khoos phis tawj no tsuas yog tuaj. Kuv tsis muaj qhov teeb meem qub (tseem) nrog Raspberry PI 3s thiab kho vajtse siab dua yog li ntawd kuj yog vim li cas kuv thiaj qhia lawv hauv qhov kev qhia no.

Txawm hais tias qhov kev tawm suab tam sim no ntawm Raspberry PI 3 tsuas yog zoo txaus rau kuv, ntawm no yog qee cov tswv yim tsim nyog tshawb nrhiav:

  1. Tsis txhob siv cov lus tsa suab, tab sis siv cov dej ntws sib xws hla lub network thiab cia cov neeg siv khoom muaj zog ua lub suab nrhiav thiab yees duab (piv txwv li iSpy). -> Teeb meem: tas li network bandwidth hogging.
  2. Siv cov lus tsa suab thiab cia ffmpeg ua cov vis dis aus. -> Teeb meem: CPU tsis tuaj yeem daws qhov kev daws teeb meem siab dua
  3. Siv cov lus tsa suab, kaw cov vis dis aus nyoos thiab cia lub server muaj zog ua tus lej. -> Kev siv CPU ntawm RPi tsawg thiab kev sib txuas hauv network tau txwv rau thaum muaj kev tawm suab tiag. Txog qhov xwm txheej no peb tuaj yeem sau mus rau SD-card/ramdisk rau qhov siab tshaj plaws thiab tom qab ntawd crontab luam daim vis dis aus mus rau lwm lub server.

Kuv kuj tseem yuav ceeb toom tias tsim lub phiaj xwm no tuaj yeem tsim tau yam tsis muaj Arduino. Tag nrho cov khoom siv (xa tawm, LDR, PIR) tuaj yeem txuas nrog raspberry pi qee txoj hauv kev tab sis kuv nyiam lub sijhawm tiag tiag microcontrollers los cuam tshuam nrog cov ntsuas thiab cov khoom siv tso tawm. Hauv cov xwm txheej uas kuv raspberry pi tau dai rau piv txwv lossis poob, lub teeb tswj los ntawm Arduino ua haujlwm tau zoo xwb.

Yog tias koj nyiam qhov kev qhia no tseem nyob zoo li kuv yuav txuas ntxiv nrog kuv 360 degree sab nraum zoov raspberry pi xoom dome lub koob yees duab xyoo tom ntej.

Pom zoo: