Cov txheej txheem:
- Kauj ruam 1: Teeb Koj Li Pi
- Kauj Ruam 2: SSHing Rau Koj Tus PI
- Kauj Ruam 3: Email Koj Tus IP Chaw Nyob ntawm Boot
- Kauj Ruam 4: Txhim Kho thiab Teeb Meem
- Kauj Ruam 5: Emailing Yeeb Yaj Kiab Los Ntawm Kev Tshaj Tawm ntawm Kev Tshawb Nrhiav
- Kauj Ruam 6: Troubleshooting thiab Sources
Video: Raspberry Pi 3 Motion Detection Camera With Live Feed: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Taw qhia
Hauv txoj haujlwm no, koj yuav kawm paub tsim lub koob yees duab kom pom lub ntsej muag uas koj yuav tuaj yeem siv los ua lub koob yees duab, cuab tsiaj/menyuam saib, lub koob yees duab ruaj ntseg, thiab ntau ntxiv.
Txoj Haujlwm no tau teeb tsa ua ob peb kauj ruam:
- Taw qhia
- Teem koj li Pi
- SSHing rau hauv koj tus Pi
- Email Koj Tus IP chaw nyob ntawm khau raj
- Txhim kho thiab teeb tsa tsab ntawv tsa suab
- Emailing Yeeb yaj duab los ntawm Tsab ntawv tsa suab ntawm kev kuaj pom
- Teeb meem thiab qhov chaw
Koj yuav xav tau dab tsi:
- Tus qauv Raspberry Pi 3 b ~~ $ 35
- 8gb Micro SD daim ~ ~ $ 10
- USB Webcam ~~ $ 20 (txoj haujlwm no siv Logitech HD Webcam c270)
- micro usb cable ~ $ 5
- yog:
- rechargeable 5 volt roj teeb pob (xov tooj backup roj teeb), qhov no ua rau koj txoj haujlwm wireless ~~ $ 20
- los yog
- usb phab ntsa adapter ~~ $ 5
- Kev sib txuas WiFi
Dab tsi koj yuav xav tau nkag mus rau teeb tsa:
- Saib
- Mouse thiab keyboard
- Lub khoos phis tawj nrog daim npav SD daim npav
- Micro SD rau SD daim npav hloov pauv (yuav tsum tuaj nrog koj daim npav micro SD)
Kauj ruam 1: Teeb Koj Li Pi
Tam sim no cia teeb tsa koj Pi
Txhawm rau pib, xyuas kom koj muaj txhua yam khoom xav tau los ntawm cov kauj ruam kawg. Tom qab ntawd, ua raws cov theem ntawm Raspberry Pi lub vev xaib ntawm kev teeb tsa Raspbian Jessie ntawm koj daim npav Microsd, pom ntawm no.
Thaum koj muaj Raspbian teeb tsa ntawm koj Pi, nws yog lub sijhawm kom tau txais qee yam yooj yim nta teeb tsa.
WiFi
Thawj kauj ruam kom tau txais txiaj ntsig zoo tshaj plaws ntawm koj Pi yog txhawm rau txuas nws rau hauv is taws nem. Koj tuaj yeem ua tiav cov kauj ruam no twb yog los ntawm kev nrhiav lub cim WiFi nyob rau sab saud sab xis ntawm koj Pi lub vijtsam tseem ceeb thiab kos npe rau hauv, lossis ua tib yam ua ntej txhim kho Raspbian hauv qib kawg. Yog tias koj tsis tuaj yeem nkag mus rau hauv koj li Wi -nkaus network los ntawm koj Pi's desktop interface, koj tuaj yeem ua raws cov lus qhia ntawm no txhawm rau teeb tsa WiFi los ntawm kab hais kom ua.
SSH
Ib qho cuab yeej siv tau yooj yim muaj rau koj thaum siv koj Pi yog qhov kev xaiv muab cov lus txib rau koj Pi hauv qhov uas paub tias yog lub taub hau teeb. Los ntawm kev siv Secell SHell, lossis SSH, koj tuaj yeem tswj hwm koj tus Pi nyob deb ntawm lub khoos phis tawj. Nrog rau txoj hauv kev no, txhua yam koj yuav tsum tau kho koj li Pi yog lub zog siv los ua kom nws nyob, tsis muaj tus saib xyuas thiab keyboard ntau dua!
Kauj Ruam 2: SSHing Rau Koj Tus PI
SSHing rau hauv koj li Raspberry Pi yog qhov yooj yim thiab muaj txiaj ntsig zoo, raws li txheej txheem tso cai rau koj muab cov lus txib rau koj Pi los ntawm ib lub khoos phis tawj uas tsis muaj dab tsi ntau dua li kev txuas WiFi.
Txhawm rau SSH rau hauv koj Pi, koj yuav tsum ua raws 3 cov kauj ruam yooj yim no.
Ua ntej tshaj, koj yuav tsum pab kom SSH ntawm koj tus Pi. Txhawm rau ua qhov no, qhib lub qhov rai hais kom ua hauv koj Pi, thiab ntaus hauv:
sudo raspi-teeb tsa
Cov lus txib no tso cai rau koj nkag mus rau cov ntawv qhia zaub mov teeb tsa. los ntawm qhov ntawd koj yuav xav siv xub, tab, thiab nkag cov yuam sij mus rau thawj qhov cuam tshuam kev xaiv, tom qab ntawd txhawm rau pab SSH, ntxiv rau lub koob yees duab, tom qab ntawd tawm thiab rov pib dua pi.
Tom ntej no, koj yuav tsum nrhiav koj tus IP chaw nyob IP. Hauv qhov hais kom ua davhlau ya nyob twg, ntaus:
sudo ifconfig
Thiab koj tus IP chaw nyob yuav tsum nyob hauv ntu wlan0 uas tshwm tuaj, nyob hauv qab Txuas Txuas: ethernet. Hauv daim duab demo saum toj no, IP Chaw Nyob yog 192.168.1.10.
Thaum kawg, koj yuav tsum tau qhib qhov tsim hauv lub davhlau ya nyob twg app ntawm mac, lossis nrhiav thiab ua raws cov lus qhia rau tus thib peb ssh app rau lub qhov rais. Hauv Terminal app, ntaus:
ssh pi@Koj tus IP chaw nyob
Yog tias koj tsis tau hloov tus password thaum nyob hauv Raspi-teeb tsa, tom qab ntawd koj tus password nkag mus thaum lub sijhawm nug yuav yog tus lej zais: raspberry.
Los ntawm qhov ntawd, koj yuav tsum zoo mus!
Kauj Ruam 3: Email Koj Tus IP Chaw Nyob ntawm Boot
Hauv theem no peb yuav tsom mus rau kev nkag mus rau koj li Raspberry Pi, tsis hais txog lub network koj nyob. Nyob ntawm lub network, Pi tus IP chaw nyob hloov pauv. Thiab yog tias koj tsis muaj lub teeb tsa saib xyuas, koj yuav tsum tau ssh rau hauv Pi txhawm rau ua kom pom cov lus pom zoo raws cai, hloov cov lus nyiam, lossis nkag mus rau lwm yam ntawm lub cuab yeej. Txhawm rau daws qhov teeb meem no peb yuav sau tsab ntawv nab nab uas xa email rau peb Pi tus IP tam sim no IP chaw nyob thaum pib. Python tsab ntawv yog raws li hauv qab no thiab tau muab khaws cia rau hauv cov npe cim "keeb kwm yav dhau".
#pib hauv phau ntawv qhia tsev
cd ~ ib
#tsim cov ntawv keeb kwm yav dhau
mkdir keeb kwm yav dhau
#create python tsab ntawv
sudo nano emailip.py
#sau hauv emailip.py
ntshuam ntsawb
s = socket.socket (socket. AF_INET, socket. SOCK_DGRAM)
s.connect (("8.8.8.8", 80))
print (s.getsockname () [0]) x = s.getsockname () [0] s.close ()
ntshuam smtplib
los ntawm email. MIMEMultipart ntshuam MIMEMultipart
los ntawm email. MIMEText ntshuam MIMEText
fromaddr = "Koj qhov chaw nyob"
toaddr = "RAWS LI NTAWV"
msg = MIMEMultipart ()
msg ['Los ntawm'] = fromaddr
msg ['To'] = toaddr
msg ['Subject'] = "IP Chaw Nyob"
lub cev = xmsg.attach (MIMEText (lub cev, 'tiaj'))
neeg rau zaub mov = smtplib. SMTP ('smtp.gmail.com', 587)
server.starttls ()
server.login (fromaddr, "KOJ PASSWORD")
ntawv = msg.as_string ()
server.sendmail (fromaddr, toaddr, ntawv nyeem)
server.quit ()
#ces qhov no ua rau ntawm kev rov pib dua
sudo nano /etc/rc.local
#enter hauv /etc/rc.local
thaum! /sbin/ifconfig wlan0 | grep -q 'inet addr: [0-9]';
ntxu 3
ua tiav
_IP = $ (hostname -I) || muaj tseeb
yog ["$ _IP"]; ces
printf "Kuv tus IP chaw nyob yog %s / n" "$ _IP"
nab hab sej /home/pi/Background/emailip.py &
fi ua
ua ex0
#thiab koj ua tiav
Kauj Ruam 4: Txhim Kho thiab Teeb Meem
#update pib
sudo apt-tau hloov tshiab
sudo apt-tau hloov tshiab
#download tau
sudo apt-tau nruab tsab ntawv tsa suab
#tam sim no hloov cov ntawv no nrog cov kev hloov hauv qab no
sudo nano /etc/motion/motion.conf
#los teeb tus qauv rau qhov kev qhia no, hloov pauv
#################
daemon yog
stream_localhost tawm
webcontrol_localhost tawm
ffmpeg_output_movies rau
target_dir/var/lib/tsab ntawv tsa suab
##################
#local web browser streaming xaiv
##################
stream_maxrate 100 #Qhov no yuav tso cai rau kev tshaj tawm lub sijhawm tiag tiag tab sis xav tau ntau bandwidth & peev txheej
framerate 60 #Qhov no yuav tso cai rau 60 ntas yuav tsum tau ntes ib ob #qhov siab dua qhov no tau txais, qeeb cov vis dis aus
dav 640 #Qhov no hloov pauv qhov dav ntawm daim duab tso tawm
qhov siab 480 #Qhov no hloov qhov siab ntawm daim duab tso tawm
##################
#xa email chaw teeb tsa hauv…/motion.conf
##################
#delete tus ";" nyob rau pem hauv ntej ntawm kab, lub semicolon tawm tswv yim kab tawm
on_event_start nab hab sej /home/pi/background/motionalert.py %f
on_movie_end nab hab sej /home/pi/background/motionvid.py %f
##################
#Actectics
##################
#choices piav qhia hauv cov ntawv
output_pictures nrhiav_motion_style
##################
#thov hloov
sudo nano/etc/default/tsab ntawv tsa suab
#hais
start_motion_daemon = yog
#last, pib B **** nce
sudo kev pabcuam tsa suab pib
#koj tuaj yeem hloov cov lus txib kom "nres", lossis "rov pib dua"
Kauj Ruam 5: Emailing Yeeb Yaj Kiab Los Ntawm Kev Tshaj Tawm ntawm Kev Tshawb Nrhiav
Email thaum pom cov lus tsa suab:
#pib hauv tsev
lus ~
#create tsab ntawv tsa suab ceeb toom nab
sudo nano /home/pi/background/motionalert.py
#sau ntawv
ntshuam smtplib
los ntawm datetime ntshuam datetime
los ntawm email. MIMEMultipart ntshuam MIMEMultipart
los ntawm email. MIMEText ntshuam MIMEText
fromaddr = "Koj qhov chaw"
toaddr = "RECIEVINGADDRESS"
msg = MIMEMultipart ()
msg ['Los ntawm'] = fromaddr
msg ['To'] = toaddr
msg ['Subject'] = "Tshawb nrhiav Tsab Ntawv"
lub cev = 'Kev ntsuas tau pom lawm. / nTime: % s' % str (datetime.now ())
msg.attach (MIMEText (lub cev, 'tiaj'))
neeg rau zaub mov = smtplib. SMTP ('smtp.gmail.com', 587)
server.starttls ()
server.login (fromaddr, "YOURPASSWORD")
ntawv = msg.as_string ()
server.sendmail (fromaddr, toaddr, ntawv nyeem)
server.quit ()
Email Video ntawm cov lus tsa suab thaum yees duab tau txais kev cawmdim:
#start ntawm homedircd ~
#create tsab ntawv tsa suab video nab nab scriptsudo nano /home/pi/background/motionvid.py
ntshuam smtplib
los ntawm email. MIMEMultipart ntshuam MIMEMultipart
los ntawm email. MIMEText ntshuam MIMEText
los ntawm email. MIMEBase ntshuam MIMEBase
los ntawm email ntshuam encoders
fromaddr = "Koj li EMAIL"
toaddr = "EMAIL chaw nyob koj xa tuaj rau"
msg = MIMEMultipart ()
msg ['Los ntawm'] = fromaddr
msg ['To'] = toaddr
msg ['Subject'] = "Motion Cam Qhib"
lub cev = "Yees duab ntawm Tsab Ntawv Pom Zoo"
msg.attach (MIMEText (lub cev, 'tiaj'))
import os
rootpath = '/var/lib/tsab ntawv tsa suab'
filelist = [os.path.join (rootpath, f) rau f hauv os.listdir (rootpath)]
filelist = [f rau f hauv filelist yog os.path.isfile (f)]
newest = max (filelist, key = lambda x: os.stat (x).st_mtime)
filename = tshiab tshaj plaws
import os
rootpath = '/var/lib/tsab ntawv tsa suab'
filelist = [os.path.join (rootpath, f) rau f hauv os.listdir (rootpath)]
filelist = [f rau f hauv filelist yog os.path.isfile (f)]
newest = max (filelist, key = lambda x: os.stat (x).st_mtime)
attachment = qhib (tshiab tshaj, "rb")
ib feem = MIMEBase ('thov', 'octet-stream')
part.set_payload ((ntawv txuas).read ())
encoders.encode_base64 (ib feem)
part.add_header ('Cov ntsiab lus-Disposition', "txuas; filename = % s" % filename)
msg.attach (ib feem)
neeg rau zaub mov = smtplib. SMTP ('smtp.gmail.com', 587)
server.starttls ()
server.login (fromaddr, "KOJ PASSWORD")
ntawv = msg.as_string ()
server.sendmail (fromaddr, toaddr, ntawv nyeem)
server.quit ()
Kauj Ruam 6: Troubleshooting thiab Sources
Teeb meem:
Vim tias txoj haujlwm no muaj ntau theem, muaj ntau lub ntsiab lus uas yam tuaj yeem ua tsis raug. Hauv qab no yog qee qhov ua yuam kev uas tuaj yeem tshwm sim thiab yuav kho lawv li cas.
- Thaum teeb tsa koj tus pi rau email rau koj nws tus IP chaw nyob tam sim no, nws yog qhov tseem ceeb heev los hloov cov ntaub ntawv rc.local raws li pom ua ntej vim tias qhov no tso cai rau qeeb me ntsis ua ntej qhov haujlwm qhib tom qab rov pib dua. Txwv tsis pub tus pi tseem tsis tau txuas nrog wifi, thiab email yuav tsis xa.
- Thaum kho cov ntaub ntawv motion.conf nco ntsoov tshem cov semicolons ua ntej ntawm qee yam tsis. Lub semicolon txwv ib qho kev nqis tes ua, yog li txwv tsis pub qhov kev hloov pauv yuav tsis siv tau.
- Tsab ntawv tsa suab motion.conf tau teeb tsa zoo heev thiab ntxaws ntxaws. Xav tias dawb los hloov cov kev teeb tsa rau koj nyiam, tab sis nkag siab tias lawv yuav cuam tshuam qhov ua tiav ntawm cov lus tsa suab kaw lus.
- Tom qab teeb tsa email ceeb toom thiab email xaiv cov vis dis aus, nws yog ib qho tseem ceeb kom nco ntsoov tias email ntawm cov lus tsa suab pom cov vis dis aus yuav siv sijhawm me ntsis ntev dua li xa tshaj qhov ceeb toom email thawj zaug. Qhov no yog vim qhov vis dis aus xaus ob peb vib nas this tom qab lub suab tsis pom lawm, thiab vim tias email txuas tuaj yeem loj txaus kom xav tau ob peb feeb kom tau txais. Hauv qee kis, yog tias cov lus tsa suab tau txhawb nqa rau lub sijhawm ntev heev nws yuav loj heev los xa txhua lub sijhawm. Vim li no nws ib txwm yog lub tswv yim zoo los tshuaj xyuas cov kwj tawm tom qab tau txais email ceeb toom thawj zaug.
Vim Li Cas?
Thaum xub pib ntawm txoj haujlwm no peb txiav txim siab ntau qhov peev txheej sib txawv. Ua ntej peb txiav txim siab siv PiCam uas yog lub koob yees duab chav tsim tshwj xeeb rau raspberry pi. PiCam yeej yog lub cuab yeej muaj peev xwm thiab muaj ntau daim ntawv thov, tab sis nws tau txwv rau kev siv cov program uas tau tsim tshwj xeeb rau nws thiab yog tus nqi kim piv rau pheej yig ntau lub vev xaib. Yog li txhawm rau ua kom txoj haujlwm no nkag tau rau cov neeg tuaj saib coob dua, peb txiav txim siab siv USB webcam ib txwm muaj. Qhov teeb meem tom ntej yog software uas suav nrog. Peb xub txiav txim siab OpenCV uas yog software pub dawb uas tso cai rau ntau yam kev sib txawv ntawm Computer Lub Zeem Muag thiab cov phiaj xwm duab. Ntawm cov teeb meem ntawm no yog OpenCV yog cov ntaub ntawv loj heev uas siv sijhawm nco ntau thiab teeb tsa ntev. Kev teeb tsa kuj muaj ntau theem, tawm hauv chav ntau dua rau qhov ua yuam kev. Peb pom tias rau peb qhov haujlwm tshwj xeeb, Tsab ntawv tau yooj yim dua rau teeb tsa thiab ua haujlwm, tab sis muaj zog dua hauv nws qhov kev ua tiav.
Qhov chaw
Cov peev txheej Code:
www.techradar.com/how-to/computing/how-to-b…
pimylifeup.com/raspberry-pi-webcam-server/
www.pyimagesearch.com/2015/06/01/home-surve…
naelshiab.com/tutorial-send-email-python/
www.raspberrypi.org/documentation/linux/us…
learn.adafruit.com/adafruits-raspberry-pi-…
learn.adafruit.com/adafruits-raspberry-pi-…
pinout.xyz/pinout/i2c
Cov duab khab nias:
SSH Qwj:
Xa ntawv logo:
Logitech webcam:
SSH qhov rai:
Pom zoo:
CCTV Feed Controller -Raspberry Pi: 3 Kauj Ruam
CCTV Feed Controller -Raspberry Pi: Nyob zoo txhua tus, zoo siab txais tos rau Lwm Cov Lus Qhia los ntawm Tshawb Fawb Inc.! Qhov no pab ua CCTV pub
Raspberry Pi Motion Sensing Camera in Floodlight Housing: 3 Kauj Ruam
Raspberry Pi Motion Sensing Camera in Floodlight Housing: Kuv tau tinkering nrog Raspberry Pi ib pliag tam sim no siv lawv rau ntau yam me me ntawm yam tab sis feem ntau yog ua lub koob yees duab CCTV rau saib xyuas kuv lub tsev thaum nyob deb nrog lub peev xwm los saib qhov chaw nyob deb tab sis tseem tau txais email ntawm cov duab snaps
DIY Motion Detection SMS Alarm System: 5 Kauj Ruam (nrog Duab)
DIY Motion Detection SMS Alarm System: Hauv qhov haujlwm no kuv yuav suav nrog PIR lub suab qis nrog lub TC35 GSM module los tsim lub tswb uas xa koj "INTRUDER ALERT" SMS thaum twg leej twg sim nyiag koj cov khoom. Cia peb pib
RASPBERRY PI Pi OBJECT DETECTION WITH MULTIPLE CAMERA'S: 3 Kauj Ruam
RASPBERRY PI Pi OBJECT DETECTION WITH MULTIPLE CAMERA'S: Kuv yuav khaws cov lus luv luv, raws li lub npe nws tus kheej qhia tias lub hom phiaj tseem ceeb ntawm kev qhia yog dab tsi. Hauv cov lus qhia ib qib zuj zus, kuv yuav piav qhia koj yuav ua li cas txuas ntau lub koob yees duab zoo li 1-pi cam thiab tsawg kawg ib lub koob yees duab USB, lossis 2 lub koob yees duab USB
Motion Controlled Camera Siv MESH SDK: 6 Cov Kauj Ruam (nrog Duab)
Motion Controlled Camera Siv MESH SDK: Koj puas xav kom siv koj lub koob yees duab kom zoo los ntes koj tus tsiaj lub sijhawm zoo tshaj thaum koj tsis nyob hauv tsev? MESH Motion Sensor ua rau nws ua tau rau cov koob yees duab uas txhawb SDK. Piv txwv li, peb tau tso MESH Motion Sensor nyob ib sab ntawm cov khoom noj miv thiab miv khoom ua si rau