Cov txheej txheem:
- Kauj Ruam 1: Nruab Linux Motion ntawm Raspberry
- Kauj Ruam 2: Teeb Google Duab API rau Python
- Kauj Ruam 3: Xeem
- Kauj Ruam 4: Tsis teb los tau: Kho lub Vev Xaib nkag mus rau Lub Koob Yees Duab Tiag Tiag
- Kauj Ruam 5: Cov Lus Qhia
Video: Raspberry Pi Linux Motion Google Duab Kev Sib Koom: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Lub tswv yim yog txhawm rau upload cov duab thiab yeeb yaj kiab ua nrog lub suab qhib lub koob yees duab txuas nrog Raspberry Pi txhawm rau rub cov ntawv mus rau huab. 'Motion' software txhawb nqa xa mus rau Google Drive los ntawm PyDrive. Hauv kab lus no 'Tsab ntawv tsa suab' yog siv los rub rau Google Duab.
Kho vajtse:
Raspberry Pi 3B+
USB Webcam Logitech C920
Kev xaiv kho vajtse tsis tau txiav txim siab, Kuv tsuas yog coj qhov uas nyob ntawm tes.
Yam yuavtsum tau kawm uantej:
Txhawm rau kom yooj yim Raspberry pi yuav tsum nyob hauv koj lub network hauv zej zog - los tswj nws yam tsis muaj tus saib xyuas/keyboard thiab rub/rub tawm cov ntawv. Rau qhov no koj yuav tsum muaj tus neeg sawv cev ssh ntawm koj lub PC (piv txwv li putty).
Ua tsaug ntau rau ssandbac rau kev qhia zoo. Yog tias koj xav tau cov ntaub ntawv ntau ntxiv txog yuav teeb tsa ib puag ncig li cas hauv kab lus no. Kuv qiv cov lus tsa suab teeb tsa thiab teeb tsa cov kauj ruam los ntawm nws thiab ntxiv qee qhov kev hloov pauv. Tshwj xeeb, tsis txhob xa email cov ntaub ntawv thiab ceeb toom qhov piv txwv no siv uploading rau google duab sib koom album thiab tau txais kev ceeb toom zoo li "ntxiv cov duab" hauv kab ntawv ceeb toom.
Nov yog cov kauj ruam:
Kauj Ruam 1: Nruab Linux Motion ntawm Raspberry
Tshwj xeeb hauv qhov piv txwv no tau siv tsab ntawv tsa suab v4.0.
1.1 Hloov kho pi
pi@raspberrypi: ~ $ sudo apt-tau hloov tshiab
pi@raspberrypi: ~ $ sudo apt-tau hloov tshiab
1.2 Rub tawm cov lus tsa suab
pi@raspberrypi: ~ $ sudo apt-tau nruab tsab ntawv tsa suab
1.3 Tam sim no hloov cov ntawv no nrog cov kev hloov hauv qab no
pi@raspberrypi: ~ $ sudo nano /etc/motion/motion.conf
# Pib hauv daemon (keeb kwm yav dhau) hom thiab tso lub davhlau ya nyob twg (default: tawm)
daemon yog
# Siv cov ntawv txhawm rau khaws cov lus cav, yog tias tsis txhais stderr thiab syslog tau siv. (default: tsis txhais)
logfile /var/log/motion/motion.log
# Duab dav (pixels). Siv tau ntau yam: Lub koob yees duab nyob, lub neej ntawd: 352
dav 1920
# Duab qhov siab (pixels). Siv tau ntau yam: Lub koob yees duab nyob, lub neej ntawd: 288
qhov siab 1080
# Tus lej ntau tshaj ntawm cov ntas yuav raug ntes ib pliag.
duab 30
# Qhia kom meej tus naj npawb ntawm cov duab ua ntej ntes (buffered) cov duab ua ntej kev txav mus los
pre_capture 5
# Tus lej ntawm cov ntas los ntes tom qab cov lus tsa suab tsis pom lawm
pos_capture 5
# Tso cov duab 'ib txwm' thaum pom cov lus tsa suab (default: on)
output_pictures tawm
# Qhov zoo (hauv feem pua) kom siv los ntawm jpeg compression
zoo 100
# Siv ffmpeg txhawm rau saib cov yeeb yaj kiab hauv lub sijhawm tiag tiag
ffmpeg_output_movies tawm
# lossis thaj tsam 1 - 100 qhov twg 1 txhais tau tias tsis zoo thiab 100 yog qhov zoo tshaj plaws.
ffmpeg_variable_bitrate 100
# Thaum tsim cov vis dis aus, yuav tsum muab cov duab sib dhos ua ke
ffmpeg_duplicate_frames tsis tseeb
# Bool los pab lossis lov tes taw extpipe (default: off)
use_extpipe rau
extpipe ffmpeg -y -f rawvideo -pix_fmt yuv420p -video_size %wx %h -framerate %fps -i yeeb nkab: 0 -vcodec libx264 -preset ultrafast -f mp4 %f.mp4
target_dir/var/lib/tsab ntawv tsa suab
# Hais kom ua kom tiav thaum ua yeeb yaj kiab
; on_movie_end sudo python3 /var/lib/motion/photos.py %f.mp4 &
Tawm qhov kawg nrog semicolon rau tam sim no (tawm tswv yim) kom tsis pom zoo tom qab ua kom ntseeg tau tias kaw cov vis dis aus thiab tso ua haujlwm.
1.4 Tom qab ntawd hloov
pi@raspberrypi: ~ $ sudo nano/etc/default/motion
pi@raspberrypi: ~ $ start_motion_daemon = yog
Kauj Ruam 2: Teeb Google Duab API rau Python
2.1 Pom zoo los tsim tus as khauj tshiab rau lub hom phiaj no los qhia ib qho album nrog koj lub hauv paus kom tau txais kev ceeb toom thaum ntxiv cov ntaub ntawv tshiab, ntxiv rau qhov chaw cia ntau ntxiv. Pab kom Google Duab API rau tus as khauj uas koj yuav siv rau kev rub tawm.
Koj yuav tsum muaj daim ntawv pov thawj tseeb.json tom qab qhov no.
2.2 Python ib puag ncig teeb tsa
Yeej qhov teeb tsa ib puag ncig xav tau ntawm raspberry nkaus xwb. Tab sis nws xav tau kev tso cai oauth uas yooj yim dua kom ua tiav hauv PC. Txhawm rau ua qhov no ntawm raspberry koj yuav tsum txuas tus saib xyuas/keyboard rau nws lossis teeb tsa qee lub desktop desktop nyob deb. Kuv nyuam qhuav teeb tsa ib puag ncig ib yam ntawm raspberry thiab PC ob qho tib si. Yog li cov kauj ruam 2.2.1..2.2.3 tau ua hauv PC, 2.2.1, 2.2.2, 2.2.5, 2.2.6 ntawm Rpi
2.2.1 nruab Nab hab sej 3
2.2.2 Nruab google api pob khoom raws li phau ntawv qhia*(saib 5.1)
Hauv PC
pip3 nruab-hloov kho google-api-python-client google-auth-httplib2 google-auth-oauthlib
On raspberry
pi@raspberrypi: ~ $ sudo pip3 install-upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
2.2.3 Txheeb xyuas tsab ntawv xa mus rau google duab.. Nws tau muab tso rau ntawm kuv github. Muab tso rau hauv tib phau ntawv teev npe nrog daim ntawv pov thawj.json.
2.2.4 Nqa qee daim duab thiab sim upload
nab hab sej 3 photos.py image.jpg
Txhim kho qhov tsis txaus ntseeg yog tias muaj thiab sim dua. Raws li qhov tshwm sim koj yuav tsum tau txais token.pickle hauv kab ntawv cov npe thiab tseem muaj cov nkauj tshiab sib koom tsim hauv koj li Google Duab web interface nrog image.jpg. Raws li koj tau txais token.pickle koj tsis xav tau daim ntawv pov thawj.json rau photos.py hauv tib cov npe ntxiv lawm.
2.2.5 Qhia tawm cov album nrog tus lej ntawm yam koj xav tau kom tau txais kev ceeb toom ntawm kev tshaj tawm tshiab ntxiv. Ntxiv tus lej no rau koj lub xov tooj.
2.2.6 Muab photos.py thiab token.pickle hauv/var/lib/tsab ntawv tsa suab ntawm raspberry. 'Pi' cov neeg siv tsis tuaj yeem sau rau 'kev txav ntawm lub suab kom rub mus rau /tsev /pi ua ntej
scp photos.py token.pickle pi@IP:/tsev/pi
Tom qab ntawv nkag mus rau raspberry thiab txav cov ntaub ntawv hauv qab sudo
ssh pib@IP
pi@raspberrypi: ~ $ sudo mv photos.py token.pickle/var/lib/tsab ntawv tsa suab
2.2.7 Txheeb xyuas seb kev xa khoom ua haujlwm li cas rau raspberry. Nqa qee daim duab nrog fswebcam thiab sim rub nws
pi@raspberrypi: ~ $ sudo fswebcam /var/lib/motion/image.jpg
pi@raspberrypi: ~ $ sudo python3 /var/lib/motion/photos.py /var/lib/motion/image.jpg
Yuav tsum muaj duab-j.webp
Kauj Ruam 3: Xeem
3.1 Pib cov kev pabcuam
pi@raspberrypi: ~ $ sudo kev pabcuam tsa suab pib
Koj tuaj yeem hloov cov lus txib kom "nres", lossis "rov pib dua"
3.2 Pab kom cov lus tsa suab
pi@raspberrypi: ~ $ tail -f /var/log/motion/motion.log
3.2 Saib lub koob yees duab tso tawm ntawm lwm lub cuab yeej txuas nrog tib lub network. Nkag mus rau hauv browser:
IP: 8081
3.3 Saib ntawm lub cav tos kom txog thaum cov lus pom thiab cov ntaub ntawv NAME.mp4 tau sau rau hauv/var/lib/tsab ntawv tsa suab. Tom qab ntawd tso tawm cov ntawv xa tawm los ntawm tus kheej
pi@raspberrypi: ~ $ sudo python3 /var/lib/motion/photos.py /var/lib/motion/NAME.mp4
Txheeb cov nab nab. Tos kom txog thaum event_end pom tshwm hauv motion.log. Tom qab ntawd mus rau "helloworld" album hauv koj cov duab hauv google thiab xyuas seb puas muaj daim vis dis aus tso.
3.4 Yog tias kev tshaj tawm ua tiav tsis pom zoo hauv /etc/motion.conf kab:
pi@raspberrypi: ~ $ sudo nano /etc/motion.conf
# Hais kom ua kom tiav thaum cov ntawv ua yeeb yaj kiab tau npaj tiav
on_movie_end sudo python3 /var/lib/motion/photos.py %f.mp4 &
pi@raspberrypi: ~ $ sync
pi@raspberrypi: ~ $ sudo kev pabcuam tsa suab rov pib dua
3.5 Saib ntawm cov lus tsa suab thiab hauv daim ntawv txheeb xyuas yog tias daim vis dis aus tso ncaj qha.
3.6 Xaiv qhov sib koom album nrog koj tus lej tseem ceeb kom tau txais kev ceeb toom thaum ntxiv cov vis dis aus tshiab lossis yees duab ntxiv.
Kauj Ruam 4: Tsis teb los tau: Kho lub Vev Xaib nkag mus rau Lub Koob Yees Duab Tiag Tiag
Cov kauj ruam no yog ua raws Michel's Parreno qhia. Kuv tsuas yog xaiv FreeDNS tsis yog NoIP raws li pom zoo ntawm no.
4.1 teeb tsa kev tso cai nkag mus rau cov vis dis aus tso suab server:
pi@raspberrypi: ~ $ sudo nano /etc/motion/motion.conf
# Teeb tsa txoj hauv kev txheeb xyuas qhov tseeb (lub hauv paus: 0)
# 0 = xiam oob qhab
# 1 = Kev lees paub yooj yim
# 2 = MD5 zom zaub mov (kev pov hwm kev nyab xeeb)
stream_auth_method 2
# Kev lees paub rau kwj. Syntax username: password
# Default: tsis txhais (xiam oob qhab)
webcontrol_authentication username: password
# Tus lej siab tshaj plaws rau cov kwj ntws (lub hauv paus: 1)
stream_txoj 30
# Txwv kev sib txuas kwj rau localhost nkaus xwb (lub hauv paus: ntawm)
stream_localhost tawm
Yog tias koj yuav tsis siv lub vev xaib tswj kev sib txuas los ntawm sab nraud network tso nws xiam oob qhab (raws li lub neej ntawd)
# Txwv tsis pub tswj kev sib txuas mus rau localhost nkaus xwb (default: on)
webcontrol_localhost rau
Tsis tas li, txij li raspberry mus online, Kuv pom zoo kom hloov pauv tus lej raspberry tsis raug
pi@raspberrypi: ~ $ passwd
Txawm hais tias ssh chaw nres nkoj 22 tsis tau rov qab mus rau raspberry, tseem.
4.2 Mus rau FreeDNS qhov chaw
4.3 Sau npe
4.4 Ntxiv subdomain (Rau Cov Tswv Cuab -> Subdomains)
4.5 Xaiv DNS tus thov kom teeb tsa ntawm Raspberry (Rau Cov Tswv Cuab -> Dynamic DNS -> Cov Khoom Siv DNS -> Dynamic DNS Cov Neeg Siv Khoom)
Kuv xaiv wget_script hloov tshiab.sh los ntawm Adas Dean (hauv qab ntawm nplooj ntawv)
Muaj cov neeg tso npe _YOURAPIKEYHERE_ thiab _YOURDOMAINHERE_. Kom lawv mus rau (Rau Cov Tswv Cuab -> Dynamic DNS)
Thiab ntawm nplooj ntawv hauv qab no koj yuav pom cov piv txwv ntawm cov ntawv nrog koj APIKEY thiab DOMAIN (ib qho ntxiv hauv 4.4). Kuv coj cov txiaj ntsig no los ntawm Wget Script thiab hloov _YOURAPIKEYHERE_ thiab _YOURDOMAINHERE_ hauv hloov tshiab.sh
4.6 Tom qab ntawd khiav qhov hloov tshiab.sh ntawm raspberry. Nws yuav xav tau dnsutils rau nslookup. Nruab nws ces:
pi@raspberrypi: ~ $ sudo apt-tau dnsutils
4.7 Tom qab ntawd teeb tsa koj lub router kom rov txav lwm lub ntiaj teb thov mus rau 8081 chaw nres nkoj mus rau raspberry's ip
4.8 Tseg tus ip rau koj tus txiv pos nphuab MAC hauv DHCP teeb tsa kom Rpi ib txwm muaj tib lub ip
4.9 Tom qab ntawd nkag mus rau hauv browser ntawm lub cuab yeej uas tsis txuas nrog lub network hauv zos:
koj tus lej: 8081
Nkag mus rau koj daim ntawv pov thawj uas koj tau hais hauv motion.conf.
Kuaj seb cov vis dis aus ua haujlwm li cas.
4.10 txhawm rau hloov kho DDNS tau teeb tsa lub luag haujlwm cron. Saib quick_cron_example ntawm (Rau Cov Tswv Cuab -> Dynamic DNS)
Kauj Ruam 5: Cov Lus Qhia
5.1 Ua tib zoo txhim kho pob pob nab ntawm raspberry. Kuv tau siv ib hnub debug qhov no - qhov teeb meem yog los ntawm console tsab ntawv tau ua haujlwm zoo, tab sis raug hu los ntawm cov lus tsa suab tshwm sim tsis tau. Dab tsi ua rau nws tsis zoo yog tias cov kab los ntawm tsab ntawv tsis muaj nyob hauv rooj plaub tom kawg.
Qhov laj thawj yog vim ua raws li phau ntawv qhia kuv teeb tsa pob khoom rau 'pi' cov neeg siv (uas yog lub hauv paus yog hauv /tsev /pi cov npe thiab txwv rau lwm tus siv) tab sis kom khiav tsab ntawv raws li menyuam yaus ntawm 'kev txav' kev pabcuam cov pob yuav tsum yog muaj rau 'txav' cov neeg siv ib yam nkaus. Yog li thaum kawg kuv tsau nws txhim kho pob khoom raws li
sudo pib 3…
Qhov no tsis yog txoj hauv kev tseem ua haujlwm. Kev teeb tsa yam tsis muaj sudo li pip3 -system tau muab rau kuv yuam kev vim qee yam.
Raws li tsab ntawv tseem hu ua hauv qab sudo (saib tsab ntawv tsa suab.conf).
Thaum lub sijhawm daws teeb meem no kuv tau ua ntau qhov kev hloov pauv yam tsis tsim nyog thiab tsis paub meej tias yam twg tsim nyog thiab tam sim no tub nkeeg dhau los yob lawv rov qab zuj zus thiab pom thaum nws tsis ua haujlwm. Tshwj xeeb, tau txais txoj cai tswj hwm tsab ntawv tsa suab:
pi@raspberrypi: ~ $ pawg lus tsa suab
tsab ntawv tsa suab: tsab ntawv tsa suab adm sudo audio video cov neeg siv netdev pi
pi@raspberrypi: ~ $ sudo miv /etc/sudoers.d/010_pi-nopasswd
pi ALL = (ALL) NOPASSWD: TXHUA
tsab ntawv tsa suab TXHUA = (TXHUA) NOPASSWD: TXHUA
Kuj tseem tau hloov cov tswv cov ntaub ntawv thiab kev tso cai zoo ib yam li xa mus rau Google Drive. Tej zaum nws yuav pab tau koj hauv rooj plaub koj muaj teeb meem zoo ib yam.
5.2 Google Duab API tso cai ntxiv cov ntawv rau sib koom albums nkaus xwb yog li leej twg nrog qhov txuas tuaj yeem nkag mus rau nws. Tsis txhob faib nws los ntawm qhov txuas thiab tshem tawm cov yeeb yaj kiab qub lossis txav lawv mus rau thoob khib nyiab lossis los ntawm album. Hauv qhov xwm txheej tom ntej lawv tseem nyob hauv tus as khauj.
5.3 Google tus pabcuam pabcuam duab pom lub ntsej muag, uas muaj txiaj ntsig zoo yog tias lub koob yees duab zoo. Raws li qhov tau txais txiaj ntsig nws ua rau kev tshaj tawm xov xwm zoo ntawm kev suav thiab gifs thiab lwm yam.
5.4 Kuv tau sim siv 4G LTE USB modem rau kev siv internet thiab ntawm no yog kuv cov txiaj ntsig. 5.4.1 Huawei E3372h-153 ua haujlwm nrog raspberry yam tsis muaj teeb meem thiab software ntxiv 5.4.2 Kuj tseem qhib hotspot yog li Rasperry sib koom internet txuas los ntawm wifi. Muaj https://howtoraspberrypi.com/create-a-wi-fi-hotspot-in-less-than-10-minutes-with-pi-raspberry/ phau ntawv qhia yooj yim heev yuav ua li cas siv RaspAP. 5.4.3 Dynamic DNS tsis ua haujlwm hauv 4G network ntawm kuv lub tsheb. Muaj lus piav qhia yog vim li cas
5.5 Tom qab siv lub kaw lus no ob peb lub lis piam dhau los, txawm hais tias cov vis dis aus yooj yim dua los saib thiab rub tawm, Google Duab ua haujlwm tau zoo dua nrog cov duab. Piv txwv li nws ua rau yam/ntsej muag pab pawg txheeb xyuas cov duab nkaus xwb, thiab tsuas yog tom qab ntawd tab tom nrhiav ntsej muag/yam los ntawm cov duab hauv cov vis dis aus, tab sis tsis yog qhov sib txawv. Yog li kuv yuav sim cov duab uploading theej cov vis dis aus.
Pom zoo:
Cov Txheej Txheem Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: 12 Cov Kauj Ruam (nrog Duab)
Txoj Cai Kicker Yooj Yim thiab Kev Tso Cai Nrog Slack Kev Sib Koom: Hauv lub tuam txhab uas kuv ua haujlwm muaj lub rooj ncaws pob. Lub tuam txhab nyob ntau cov plag tsev thiab rau qee tus neeg ua haujlwm nws yuav siv sijhawm li 3 feeb los txog ntawm lub rooj thiab … kom paub tias lub rooj twb nyob lawm
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: 5 Cov Kauj Ruam (nrog Duab)
Qhov muag tsis pom kev Nrog ESP8266, Google Tsev thiab Openhab Kev Sib Koom thiab Kev Tswj Xyuas Web: Hauv Cov Lus Qhia no kuv qhia koj li cas kuv ntxiv kev siv tshuab rau kuv qhov muag tsis pom. Kuv xav kom muaj peev xwm ntxiv thiab tshem tawm qhov kev siv tshuab nws, yog li txhua qhov kev teeb tsa yog clip ntawm.Qhov tseem ceeb yog: Stepper motor Stepper tsav tswj bij ESP-01 Iav thiab teeb tsa
Tsim Curved UI hauv Kev Sib Koom rau Kev Muaj Tseeb Virtual: 4 Kauj Ruam
Tsim Cov Nkhaus UI hauv Kev Sib Koom rau Kev Muaj Tseeb Virtual: Yog tias koj tab tom nrhiav kev daws teeb meem dawb thiab yooj yim los tsim cov neeg siv nkhaus rau koj li Virtual Reality Application lossis VR Game koj ntawm qhov chaw raug. Hauv blog no koj yuav kawm tsim lub nkhaus ui keeb hauv kev sib koom siv Unity UI Extensions
Kev sib thooj Duab Sib Koom IOS App: 6 Kauj Ruam
Kev Sib Faib Duab Sib Txuas IOS App: Hauv cov lus qhia no peb yuav tsim iOS app nrog Swift uas tso cai rau koj qhia cov duab nrog leej twg nyob ze, tsis tas yuav siv lub cuab yeej txuas ua ke. Peb yuav siv Chirp Txuas xa cov ntaub ntawv siv suab, thiab Firebase khaws cov duab hauv clo
Web-Txuas Txuas SMART LED Animation Moos Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: 11 Cov Kauj Ruam (nrog Duab)
Web-Txuas Txuas SMART LED Animation Clock Nrog Lub Vev Xaib Tswj Vaj Huam Sib Luag, Lub Sijhawm Neeg Ua Haujlwm Sib Koom: Zaj dab neeg ntawm lub moos no rov qab mus ntev-ntau dua 30 xyoo. Kuv txiv pioneered lub tswv yim no thaum kuv tsuas yog 10 xyoo, ntev ua ntej LED kiv puag ncig - rov qab thaum LED qhov twg 1/1000 qhov ci ntawm lawv qhov muag tsis pom kev tam sim no. Qhov tseeb