Cov txheej txheem:
- Kauj ruam 1: Kev npaj
- Kauj ruam 2: Ua Tus Sensor
- Kauj Ruam 3: Kho IP Lub Koob Yees Duab
- Kauj Ruam 4: Ntsej Muag API
- Kauj Ruam 5: Node-Red Configuration
- Kauj Ruam 6: Sau tag nrho Txoj Haujlwm
- Kauj Ruam 7: Xaus
Video: Lub ntsej muag lees paub kev nyab xeeb rau lub tub yees nrog Raspberry Pi: 7 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Txheeb hauv internet Kuv tau pom tias tus nqi rau kev ruaj ntseg sib txawv ntawm 150 $ txog 600 $ thiab siab dua, tab sis tsis yog txhua qhov kev daws teeb meem (txawm tias kim heev) tuaj yeem koom ua ke nrog lwm cov cuab yeej ntse hauv koj lub tsev! Piv txwv li, koj tsis tuaj yeem teeb tsa lub koob yees duab ruaj ntseg ntawm koj lub qhov rooj ua ntej nws thiaj li qhib lub qhov rooj rau koj lossis koj cov phooj ywg!
Kuv tau txiav txim siab los ua qhov yooj yim, pheej yig thiab muaj zog daws teeb meem, uas koj tuaj yeem siv nyob txhua qhov chaw! Muaj ntau phau ntawv qhia yuav ua li cas thiaj tsim cov kev lag luam pheej yig thiab muaj kev nyab xeeb hauv tsev, txawm li cas los xij kuv xav qhia qhov tsis muaj kev cuam tshuam tiag tiag ntawm cov ntawd - kev nyab xeeb rau lub tub yees nrog lub ntsej muag paub!
Nws ua haujlwm li cas? Lub koob yees duab IP tso rau saum lub tub yees, lub ntsuas pa (ob lub nyees khawm) tshawb pom thaum ib tus neeg qhib lub qhov rooj ntawm lub tub yees, tom qab ntawd Raspberry Pi nqa daim duab ntawm tus neeg ntawd (nrog IP lub koob yees duab), tom qab ntawd xa mus rau Microsoft Face API los tshuaj xyuas cov duab thiab tau txais lub npe ntawm tus neeg. Nrog cov ntaub ntawv no Raspberry Pi txheeb xyuas "cov npe nkag": yog tias tus neeg tsis muaj kev tso cai nkag mus rau lub tub yees, Raspberry ceeb toom rau tus tswv ntawm email, ntawv xov xwm thiab twitter! (Saib cov duab saum toj no)
Vim li cas? Lub kaw lus tso cai rau koj tswj hwm koj tsev neeg, tshwj xeeb tshaj yog thaum lawv nyob hauv kev noj zaub mov, lossis tawm tsam nrog tsis noj mov tom qab ib tag hmo! Los yog siv nws tsuas yog lom zem!
Ntxiv mus, koj tuaj yeem teeb tsa lub koob yees duab ntawm koj lub qhov rooj thiab teeb tsa lub kaw lus kom qhib lub qhov rooj thaum koj, koj tsev neeg lossis cov phooj ywg tab tom los ze. Thiab qhov no tsis yog qhov kawg! Muaj peev xwm ntawm daim ntawv thov tsis muaj qhov kawg!
Cia peb pib!
Kauj ruam 1: Kev npaj
Koj yuav xav tau:
- Raspberry Pi 3 (koj tuaj yeem siv cov laus dua, tab sis tiam thib peb muaj Wi-nkaus, yog li nws yooj yim heev)
- Nyees khawm
- Hlau
- Smartphone qub lossis Raspberry Pi lub koob yees duab
Thawj qhov koj yuav tsum tau ua yog teeb tsa koj li Raspberry Pi. Cov ncauj lus kom ntxaws yuav ua li cas koj tuaj yeem pom ntawm no thiab ntawm no, tab sis peb yuav npog cov kauj ruam tseem ceeb tshaj plaws hauv phau ntawv no.
- Rub tawm Win32 DiskImager los ntawm no (yog tias koj siv Windows)
- Rub tawm SD Formatter los ntawm no
- Ntxig daim npav SD rau hauv koj lub computer thiab format nws nrog SD Formatter
- Rub tawm Raspbian Duab los ntawm no (Xaiv "Raspbian Jessie nrog pixel")
- Khiav Win32 DiskImager, xaiv koj daim npav SD, qhia txoj hauv kev rau Raspbian duab, nyem "Sau"
- Ntxig daim npav SD rau hauv koj lub Raspberry Pi thiab qhib lub zog!
Ib qho ntxiv, koj yuav tsum teeb tsa koj li Raspberry Pi kom muaj kev nkag tau rau hauv kab ke ntawm SSH. Muaj ntau cov lus qhia hauv is taws nem, koj tuaj yeem siv qhov no, piv txwv li, lossis koj tuaj yeem txuas tus saib xyuas thiab keyboard.
Tam sim no koj Pi tau teeb tsa thiab koj npaj txhij mus txuas ntxiv!
Kauj ruam 2: Ua Tus Sensor
Nqe lus piav qhia: Hauv theem no peb yuav ua lub ntsuas pa uas pom thaum tus neeg qhib lub qhov rooj ntawm lub tub yees thiab qhib Raspberry Pi.
Txhawm rau teeb tsa nws koj yuav xav tau 2 khawm uas koj tau npaj ua ntej. Thawj lub pob yuav raug tshuaj xyuas thaum lub qhov rooj qhib, lub pob thib ob yuav kuaj pom thaum lub qhov rooj qhib rau lub ntsiab lus thaum peb tab tom thaij duab ntawm ib tus neeg.
- Siv cov xov hlau txuas rau cov nyees khawm.
- Txuas thawj lub khawm rau lub qhov rooj ntawm lub tub yees kom nws raug thawb thaum lub qhov rooj raug kaw (saib daim duab saum toj no)
- Txuas lub khawm thib ob rau lub qhov rooj ntawm lub tub yees raws li qhia hauv daim duab saum toj no. Lub pob no yuav tsum tau tso tawm txhua lub sijhawm, tshwj tsis yog thaum lub qhov rooj mus txog qhov chaw thaum lub kaw lus yuav thaij duab. Txhawm rau teeb tsa nws koj yuav tsum muab qee yam tso rau hauv koj lub tub yees kom lub pob no nias thaum lub qhov rooj qhib rau qhov xav tau (saib cov duab saum toj no).
- Txuas cov xov hlau los ntawm cov nyees khawm rau Raspberry Pi: thawj khawm rau GPIO 23 thiab hauv av, khawm thib ob rau GPIO 24 thiab hauv av (Saib daim duab fritzing).
Nco tseg: Kuv siv BCM pinout (tsis yog Board), ntau ntxiv ntawm qhov sib txawv nyeem ntawm no.
Thaum txuas nrog koj li Raspberry Pi ntawm SSH, kom khiav lub plhaub nab nab, ntaus hauv lub davhlau ya nyob twg:
nab hab sej 3
Yog tias koj txuas tus saib xyuas thiab keyboard rau Raspberry Pi tsuas yog khiav "Python 3 IDLE" los ntawm cov ntawv qhia zaub mov.
Cov kauj ruam tom ntej yog ua kom Raspberry Pi ua haujlwm nrog cov nyees khawm. Peb yuav txuas cov neeg mloog tshwj xeeb rau GPIO 23 thiab 24 tus pin, uas yuav mloog rau "nce ntug" kev tshwm sim thiab "ntog ntug" kev tshwm sim ntawm cov pins. Thaum muaj xwm txheej cov neeg mloog yuav hu lub luag haujlwm uas peb tau hais tseg. "Rising ntug" txhais tau tias lub khawm tau nias thiab tam sim no tso tawm (thawj khawm - lub qhov rooj tau qhib), "ntog ntug" txhais tau tias lub pob raug tso tawm thiab tam sim no nias (khawm thib ob - lub qhov rooj tau mus txog qhov tshwj xeeb). Xav paub ntau ntxiv txog cov haujlwm khawm - ntawm no.
Ua ntej, ntshuam tsev qiv ntawv uas muab rau peb nkag mus rau tus pin:
ntshuam RPi. GPIO ua GPIO
Tam sim no txheeb xyuas cov haujlwm tshwj xeeb uas yuav raug hu thaum tshwm sim tshwm sim:
def sensor1 (channel): luam tawm (“sensor 1 triggered”) def sensor2 (channel): print (“sensor 2 triggered)
Teeb hom pinout:
GPIO.setmode (GPIO. BCM)
Kho tus pin:
GPIO.setup (23, GPIO. IN, rub_up_down = GPIO. PUD_UP) GPIO.setup (24, GPIO. IN, rub_up_down = GPIO. PUD_UP)
Txuas cov neeg mloog:
GPIO.add_event_detect (23, GPIO. RISING, hu rov qab = sensor1, bouncetime = 300) GPIO.add_event_detect (24, GPIO. FALLING, hu rov qab = sensor2, bouncetime = 300)
Tam sim no koj tuaj yeem sim nws! Yog tias koj thawb lub pob 1 koj yuav pom cov lus hauv lub davhlau ya nyob twg "sensor 1 triggered", khawm 2 muab koj cov lus "sensor 2 triggered".
Nco tseg: Thaum koj ua tiav nrog kev sim tsis txhob hnov qab hu rau cov haujlwm hauv qab no: GPIO.cleanup ().
Cia teeb tsa ib qho ntxiv ua haujlwm uas hu ua thaum lub qhov rooj mus txog qhov chaw uas peb thaij duab! Koj tuaj yeem ua nws koj tus kheej lossis siv kuv qhov kev coj ua uas kuv tau txuas ntawm no (sensor.py)
Nco tseg: sensor.py tsuas yog siv rau kev ntsuas lub hom phiaj, cov ntaub ntawv nrog ua haujlwm tau zoo Kuv tau txuas nrog rau theem kawg.
Kauj Ruam 3: Kho IP Lub Koob Yees Duab
Nqe lus piav qhia: Tam sim no peb tab tom teeb tsa lub xov tooj qub qub ua lub koob yees duab IP.
Kev siv smartphone ua lub koob yees duab IP yog ua tiav ntawm app. Muaj ntau cov apps sib txawv rau Android, iOS, Windows Phone uas koj tuaj yeem siv tau. Kuv xaiv qhov hu ua "IP Webcam" rau Android. Nov yog app dawb thiab nws yooj yim rau teeb tsa.
Khiav lub app, mus rau "Video nyiam" los teeb tsa kev daws teeb meem ntawm cov duab uas lub app yuav muab. Tom qab ntawv coj mus rhaub "Pib server" (Thawj daim duab saum toj no). Hauv qab ntawm qhov screen koj yuav tsum pom tus IP chaw nyob ntawm lub cam (Saib duab thib ob saum toj no). Hauv browser koj tuaj yeem ntaus https://cam_ip_address/photo-j.webp
Thaum kawg, muab lub koob yees duab tso rau hauv lub tub yees (Duab kawg saum toj no).
Kauj Ruam 4: Ntsej Muag API
Nqe lus piav qhia: Hauv qib no peb yuav tham txog Microsoft lub ntsej muag API uas ua ntsej muag paub thiab txheeb xyuas tib neeg.
Microsoft lub ntsej muag API yog lub ntsej muag lees paub kev pabcuam, uas peb tuaj yeem txheeb xyuas cov duab thiab txheeb xyuas tib neeg ntawm lawv.
Ua ntej, koj xav tau Microsoft Azure Account. Yog tias koj tsis muaj ib tus koj tuaj yeem tsim nws dawb ntawm no.
Qhov thib ob, mus rau https://portal.azure.com, nyem "Tshiab" ntawm sab laug, ntaus rau hauv daim ntawv "Cognitive Services APIs", xaiv nws thiab nyem "Tsim". Lossis koj tuaj yeem qhib qhov txuas no. Tam sim no koj yuav tsum sau Lub Npe ntawm koj qhov kev pabcuam, xaiv hom kev tso npe, hom API uas koj xav tau (hauv peb cov ntaub ntawv nws yog Face API), qhov chaw, tus nqi them nqi, pab pawg pab pawg thiab pom zoo Cov Cai Raws Cai (saib screenshot ntxiv rau cov kauj ruam no).
Thib peb, nyem "Txhua yam peev txheej", xaiv koj Lub ntsej muag API kev pabcuam thiab saib cov ntaub ntawv txheeb cais, ntaub ntawv pov thawj, thiab lwm yam.
Lub ntsej muag API cov ntsiab lus tuaj yeem pom ntawm no, piv txwv hauv ntau hom lus programming tau muab. Rau qhov haujlwm no peb siv nab hab sej. Koj tuaj yeem nyeem cov ntaub ntawv thiab ua koj tus kheej teeb tsa kev ua haujlwm lossis koj tuaj yeem siv qhov uas tau muab ntawm no (qhov no tsis yog tag nrho cov kev ua haujlwm tau muab los ntawm Microsoft, tsuas yog cov ntsiab lus uas xav tau rau txoj haujlwm no). Kuv cov ntaub ntawv nab hab sej tau txuas rau cov kauj ruam no.
Cia peb txav mus rau tus qauv ntawm kev ua haujlwm nrog Face API. Txhawm rau siv "Kev Txheeb Xyuas" kev ua haujlwm peb yuav tsum tsim lub tsev qiv ntawv ntawm cov neeg siv uas Face API cov kev pabcuam yuav lees paub cov duab uas tau siv los ntawm lub app. Txhawm rau teeb tsa nws, thov ua raws cov theem hauv qab no:
- Tsim Pawg
- Ntxiv Cov Neeg rau Pawg no
- Ntxiv ntsej muag rau cov neeg no
- Pab pawg cob qhia
- Xa daim duab nrog tus neeg uas koj xav txheeb xyuas (koj yuav tsum muab daim duab thiab tus lej ID uas qhov kev pabcuam yuav saib rau cov neeg sib tw)
- Qhov tshwm sim: Hauv kev teb koj yuav tau txais cov npe ntawm cov neeg sib tw uas tuaj yeem nyob ntawm daim duab uas koj xa tuaj.
Kuv tau tsim peb cov ntaub ntawv nrog kev ua haujlwm tshwj xeeb uas tso cai ua haujlwm nrog pab pawg, tib leeg neeg thiab duab ib leeg:
- PersonGroup.py - muaj cov yam ntxwv uas tso cai: tsim pab pawg, tau txais cov ntaub ntawv hais txog pab pawg, tau txais tag nrho koj pab pawg, qhia pab pawg thiab tau txais cov xwm txheej ntawm kev qhia
- Person.py - muaj cov yam ntxwv uas tso cai: tsim tus neeg, tau txais cov ntaub ntawv tus kheej, sau txhua tus neeg hauv pawg tshwj xeeb, ntxiv ntsej muag rau tus neeg tshwj xeeb
- Face.py - muaj cov yam ntxwv uas tso cai: tshawb pom lub ntsej muag ntawm daim duab, txheeb xyuas tus neeg, tau txais lub npe ntawm tus neeg txheeb xyuas
Hauv cov ntawv hu ua "recognition.py" Kuv muab cov yam ntxwv uas tso cai rau koj los tshuaj xyuas yog tias daim duab muaj lub ntsej muag thiab ntxiv lub ntsej muag rau tus neeg tshwj xeeb (txiav ntxiv lub ntsej muag los ntawm ntau cov duab los ntawm daim nplaub tshev tshwj xeeb).
Rub tawm cov ntawv txuas nrog cov kauj ruam no, unpack nws, hloov 'KEY' thoob ntiaj teb sib txawv hauv peb cov ntaub ntawv no: PersonGroup.py, Person.py thiab Face.py rau koj tus kheej qhov tseem ceeb uas koj tuaj yeem pom: portal.azure.com> txhua qhov peev txheej > ntsej muag kev pabcuam api (lossis koj hu nws li cas)> tuav lub tab. Koj tuaj yeem siv ib qho ntawm ob tus yuam sij.
Nco tseg: ntawm no peb yuav mus qhia ntsej muag API kev pabcuam kom paub txog tib neeg, yog li cov haujlwm hauv qab no tuaj yeem ua tiav los ntawm txhua lub khoos phis tawj (Raspberry Pi tsis xav tau rau qhov ntawd) - kev hloov pauv tau raug cawm ntawm Microsoft lub server.
Tom qab hloov KEY, khiav kev lees paub.py thiab nkag mus rau cov lus txib hauv qab no hauv sej sej:
PersonGroup.create ("tsev neeg", 'fff-fff')) // koj tuaj yeem siv koj lub npe thiab tus lej rau
pab pawg printResJson (PersonGroup.getPersonGroup ('fff-fff'))
Koj yuav tsum pom cov ntaub ntawv hais txog pab pawg koj nyuam qhuav tsim. Tam sim no nkag mus:
printResJson (Person.createPerson ('fff-fff', 'lub npe ntawm tus neeg'))
Tam sim no koj tau txais tus lej ID. Tsim cov ntawv tais ceev tseg nrog cov duab ntawm tus neeg no kom txhua daim duab muaj lub ntsej muag ntawm tus neeg no. Koj tuaj yeem siv ua haujlwm detectFaceOnImages hauv kev lees paub.py uas qhia koj tias daim duab ntsej muag twg raug kuaj pom. Tam sim no, khiav hais kom ua:
addFacesToPerson ('nplaub tshev nrog cov duab', 'tus neeg ID uas koj tau txais tom qab hais kom ua', 'fff-fff')
Tom qab ntawd peb yuav tsum qhia peb cov kev pabcuam los ntawm kev nkag mus rau hauv qab no:
PersonGroup.trainPersonGroup ('fff-fff') printResJson (PersonGroup.getPersonGroupTrainingStatus ('fff-fff'))
Tam sim no peb pab pawg tau kawm thiab tau npaj los txheeb xyuas tus neeg.
Txhawm rau txheeb xyuas tus neeg ntawm daim duab koj tuaj yeem:
Face.checkPerson (duab, 'fff-fff')
Hauv kev teb koj yuav tau txais cov npe ntawm cov neeg sib tw thiab qhov tshwm sim uas nyob hauv daim duab.
Nco tseg: txhua lub sijhawm koj ntxiv ntsej muag rau ib tus neeg lossis ib tus neeg rau ib pab pawg koj yuav tsum qhia cov pab pawg!
Kauj Ruam 5: Node-Red Configuration
Nqe lus piav qhia: Hauv theem no, peb yuav tsim Node-Red ntws uas yuav ceeb toom rau koj txog kev ua txhaum cai nkag mus rau koj lub tub yees =)
Yog tias koj Raspberry Pi khiav ntawm Raspbian Jessie Kaum Ib Hlis 2015 lossis tom qab ntawv koj tsis tas yuav nruab Node-Red, vim nws twb tau teeb tsa ua ntej lawm. Koj tsuas yog yuav tsum tau hloov kho nws. Thov siv phau ntawv no.
Tam sim no, peb yuav tsum nruab Twilio ntawm lub Node-Liab, yog li peb tuaj yeem ua rau muaj kab lus. Qhib davhlau ya nyob twg thiab ntaus hauv:
cd ~/.node-rednpm nruab node-red-node-twilio
Xav paub ntau ntxiv txog Twilio ntawm no. Tom qab ntawd, khiav Node-Red los ntawm kev ntaus rau hauv lub davhlau ya nyob twg:
node-liab
Tom qab ntawd mus rau: https://127.0.0.1:1880/ - yog tias koj qhib browser ntawm koj li Raspberry Pihttps:// {raspberry_pi_ip}: 1880/ - yog tias koj xav qhib Node -Red editor los ntawm lwm lub computer
Txhawm rau paub tus IP chaw nyob ntawm raspberry pi siv cov lus qhia no.
Tam sim no koj yuav tsum nrhiav Twilio ntawm cov npe ntawm cov nodes hauv koj Node-Red editor (feem ntau nws tshwm tom qab pab pawg "sib raug zoo").
Nws yog lub sijhawm los tsim cov dej ntws!
Nco tseg: koj tuaj yeem siv kuv cov dej ntws txuas nrog cov kauj ruam no, tab sis tsis txhob hnov qab teeb tsa cov nodes: email, twitter thiab twilio. Nyeem txog qhov ntawd tom qab.
Peb cov dej ntws pib nrog "ceeb toom" ntawm qhov uas lees paub POST thov los ntawm peb cov haujlwm tseem ceeb nrog qee cov ntaub ntawv hais txog kev ua txhaum cai (piv txwv li cov ntaub ntawv tuaj yeem pom hauv cov lus pom "txog kev tau txais khoom"). Qhov no tam sim teb nrog "Ok" cov lus, yog li qhov haujlwm tseem ceeb paub tias tau txais cov ntaub ntawv (Ntws: /ceeb toom> teb nrog Ok> teb). Ntsuab ntsuab nyob hauv qab nrog lub npe msg.payload muaj nyob rau lub hom phiaj debugging: yog tias qee yam tsis ua haujlwm koj tuaj yeem siv nws.
Los ntawm nrig nrig (/ceeb toom) cov ntaub ntawv nthuav tawm rau "Cov ncauj lus" thiab "Cov Duab Duab" qhov twg cov ncauj lus "cov ntaub ntawv" thiab "duab" ntxiv raws.
Hauv qhov "suav sau" peb tau txais cov ntaub ntawv (uas peb tau txais thaum thawj kauj ruam) nrog cov ncauj lus "cov ntaub ntawv" thiab cov duab nrog cov ncauj lus "duab" (cov duab tau los ntawm /home/pi/image.jpg). Ob cov lus no yuav tsum suav ua ib qho khoom, tab sis ob lub khoom tau txais nyob rau lub sijhawm sib txawv! Txhawm rau daws qhov no peb yuav siv "cov ntsiab lus" uas tso cai rau peb khaws cov ntaub ntawv ntawm kev ua haujlwm.
Cov kauj ruam tom ntej yog txhawm rau txheeb xyuas seb tus neeg los ntawm peb daim ntawv teev npe nkag los yog nws yog neeg txawv (checkConditions node). Muaj qhov "trustPerson" tus lej hauv cov ntaub ntawv peb tau txais: "muaj tseeb" txhais tau tias peb paub tus neeg no, tab sis nws/nws tau ua txhaum kev tso cai nkag mus, "cuav" txhais tau tias tus neeg ntawd yog neeg txawv.
Thaum qhov tshwm sim yog "muaj tseeb" peb xa ntawv ceeb toom rau twitter, twilio thiab email; thaum qhov tshwm sim yog "tsis tseeb" - tsuas yog email thiab twilio. Peb tsim lub hom phiaj rau email nrog cov lus, txuas cov duab thiab cov ncauj lus hauv email, yam khoom rau twilio nrog cov lus. Rau twitter peb ntxiv cov ntaub ntawv rau ib qho khoom yog "trustPerson" muaj tseeb. Tom qab ntawd xa peb cov khoom mus rau peb qhov sib txawv.
Nco tseg: Yog tias cov kab hauv qab no yuav tsum tsis tau txais cov lus peb tsuas yog xa "tsis muaj" rau nws.
Nws yog lub sijhawm los teeb tsa cov ntshav rau kev ceeb toom!
Twitter Ntxiv "twitter" ntawm qhov ntws. Qhib nws los ntawm ob npaug nias. Nyem rau ntawm tus xaum ntawv tom ntej "Twitter ID". Tom qab ntawv nyem rau "Nyem qhov no txhawm rau txheeb xyuas nrog Twitter". Nkag mus rau koj tus lej twitter thiab muab Node-Red xav tau kev tso cai.
EmailAdd "email" ntawm qhov ntws. Yog tias koj tsis siv Gmail koj yuav xav hloov cov ntaub ntawv hauv cov lus hauv qab no - "Server" thiab "Port" (koj tuaj yeem pom cov server thiab chaw nres nkoj twg koj yuav tsum siv ntawm Pab Nplooj Ntawv ntawm koj tus neeg sawv cev email) txwv tsis pub hloov qhov no teb.
- Mus> email chaw nyob uas yuav xa cov lus
- Tus neeg siv> nkag mus los ntawm koj tus email (tej zaum zoo ib yam li "Rau" teb)
- Lo lus zais> password los ntawm koj tus email account
- Lub npe> lub npe rau ntawm qhov no
Twilio Mus rau https://www.twilio.com/try-twilio thiab sau npe tus account. Xyuas nws. Mus rau https://www.twilio.com/console. Nyem rau "Tus Xov Tooj" (loj # lub cim) thiab tsim tus lej pub dawb. Yog tias koj nyob sab nraum Tebchaws Asmeskas koj yuav tsum ntxiv GEO kev tso cai, mus rau https://www.twilio.com/console/sms/settings/geo-pe… thiab ntxiv koj lub tebchaws.
Tam sim no, mus rau Node-Red editor, ntxiv Twilio node, ob npaug nias rau nws txhawm rau teeb tsa thiab sau tag nrho cov haujlwm:
- Cov Ntawv Pov Thawj> Siv Cov Ntawv Pov Thawj Hauv Zos
-
Twilio> kho kom raug
- Account SID> coj los ntawm no
- Los ntawm> ntaus hauv tus lej virtual uas koj tau tsim
- Token> coj los ntawm no
- Lub npe> Twilio
- Tawm> SMS
- Mus> koj tus xov tooj
- Lub npe> lub npe rau ntawm qhov no.
Nyem Tso Tawm
Tam sim no koj ntws tau npaj txhij! Koj tuaj yeem sim nws los ntawm kev xa POST thov nrog cov khoom tshwj xeeb!
Kauj Ruam 6: Sau tag nrho Txoj Haujlwm
Nqe lus piav qhia: Hauv theem no peb yuav muab txhua feem ua ke thiab ua kom lawv ua haujlwm sib cais.
Los ntawm cov kauj ruam no koj yuav tsum:
- Kho lub smartphone qub li lub koob yees duab ip
- Muaj cov sensors ua haujlwm
- Kev cob qhia Microsoft lub ntsej muag API
- Kho Node-Liab ntws
Tam sim no peb yuav tsum txhim kho cov cai uas peb tau sau hauv qib 2. Tshwj xeeb tshwj xeeb cov txheej txheem () uas yog hu thaum twg thaum tus neeg qhib lub qhov rooj. Hauv txoj haujlwm no peb yuav ua cov hauv qab no:
- Tau txais duab los ntawm lub koob yees duab ip thiab khaws nws hauv “/home/pi/” nrog lub npe “image.jpg” (ua haujlwm “fromIpCam” hauv ntawv “getImage”)
- Tau lub npe ntawm tus neeg ntawm daim duab ntawd (ua haujlwm "checkPerson" hauv cov ntaub ntawv "lees paub")
- Txheeb xyuas kev tso cai nkag mus rau tus neeg ntawd (ua haujlwm "kos" hauv cov ntaub ntawv "nkag mus")
- Raws li qhov tshwm sim ntawm "kos" ua haujlwm sau cov lus
- Xa cov lus sau rau Node-Red (ua haujlwm "toNodeRed" hauv cov ntawv "sendData")
Nco tseg: kom pom tag nrho cov cai ntawm cov haujlwm tau hais tseg thov rub cov ntawv zip txuas nrog rau theem no.
Txog kev ua haujlwm "fromIpCam". Txoj haujlwm no ua kom tau txais kev thov rau koj lub koob yees duab ip, tsom mus rau cov duab hauv cov lus teb thiab khaws nws mus rau txoj hauv kev tshwj xeeb los ntawm koj. Koj yuav tsum muab lub koob yees duab IP chaw nyob rau txoj haujlwm no.
Txog kev ua haujlwm "checkPerson". Lub luag haujlwm tau txais txoj hauv kev rau cov duab thiab pab pawg uas koj xav nrhiav tus neeg los ntawm daim duab raws li qhov ntsuas. Ua ntej, nws kuaj pom lub ntsej muag ntawm cov duab muab (cov ntaub ntawv Face.py, ua haujlwm "tshawb pom"). Hauv kev teb nws tau txais daim id yog lub ntsej muag uas tau kuaj pom. Tom qab ntawd nws hu "txheeb xyuas" ua haujlwm (Face.py file) uas pom cov neeg zoo sib xws hauv pawg tshwj xeeb. Hauv kev teb nws tau txais tus lej ID yog tias pom tus neeg. Tom qab ntawd hu ua haujlwm "tus neeg" (cov ntaub ntawv Person.py) nrog tus lej ID ua qhov ntsuas, "tus neeg" ua haujlwm rov qab tus neeg nrog tus lej tshwj xeeb, peb tau txais lub npe ntawm tus neeg thiab xa rov qab.
Txog kev ua haujlwm "kos". Lub luag haujlwm no tau muab tso rau hauv cov ntaub ntawv "nkag mus" qhov twg tseem tso "nkag npe" raws li kev hloov pauv thoob ntiaj teb (koj tuaj yeem hloov kho nws raws li koj xav tau). Tau txais lub npe ntawm tus neeg los ntawm kev ua haujlwm dhau los, ua haujlwm "tshuaj xyuas" piv tus neeg no nrog cov npe nkag thiab xa rov qab.
Nco tseg: tag nrho txoj haujlwm tau txuas rau qib tom ntej.
Kauj Ruam 7: Xaus
Hauv cov kauj ruam no kuv txuas tag nrho txoj haujlwm uas koj yuav tsum unzip thiab tso rau koj li Raspberry Pi.
Txhawm rau ua txoj haujlwm no ua haujlwm "main.py" cov ntaub ntawv.
Yog tias koj tswj Raspberry Pi ntawm SSH koj yuav tsum khiav ob txoj haujlwm los ntawm ib lub plhaub: qhov kev pab cuam nab nab thiab Node-Red. Ntaus hauv lub davhlau ya nyob twg hauv qab no:
node-liab
Pres "Ctrl + Z" thiab ntaus:
hauj lwm
Koj tau pom Node-Red txheej txheem. Saib tus ID ntawm tus txheej txheem thiab hom:
ua bg
Tam sim no Node-Red yuav tsum pib ua haujlwm yav dhau los. Tom qab ntawd mus rau phau ntawv teev npe nrog koj txoj haujlwm thiab ua haujlwm tseem ceeb:
sej 3 main.py
Nco tseg: tsis txhob hnov qab hloov KEY hauv cov ntaub ntawv nab hab sej (qib 4) thiab daim ntawv pov thawj hauv Node-Liab ntws (theem 5)
Ua tiav! Koj lub tub yees nyab xeeb!
Kuv vam tias koj nyiam qhov tsis yooj yim no! Xav tias dawb tso koj lub siab hauv cov lus.
Kuv yuav txaus siab yog tias koj pov npav rau kuv qhov project =)
Ua tsaug!
Pom zoo:
Covid Kev Nyab Xeeb Kev Nyab Xeeb Ntu 1: Intro rau Tinkercad Circuits !: 20 Cov Kauj Ruam (nrog Duab)
Covid Kev Nyab Xeeb Kev Nyab Xeeb Ntu 1: Intro rau Tinkercad Circuits!: Nyob zoo, phooj ywg! Hauv ob ntu ntu no, peb yuav kawm paub siv Tinkercad Cov Kev Siv Hluav Taws Xob - lom zem, muaj zog, thiab cov cuab yeej siv rau kev kawm paub txog kev ua haujlwm li cas! Ib txoj hauv kev zoo tshaj los kawm, yog ua. Yog li, peb yuav xub tsim peb tus kheej txoj haujlwm: th
Lub Ntsej Muag Ntsej Muag Ntsej Muag => Covid Tiv Thaiv!: 5 Kauj Ruam
Lub Ntsej Muag Ntsej Muag Ntsej Muag => Covid Tiv Thaiv!: Tus naj npawb 1 yam uas cov neeg saib xyuas kev noj qab haus huv xav kom tib neeg ua thaum lub sijhawm muaj tus kabmob kis no yog hnav lub ntsej muag thaum tawm mus rau qhov chaw pej xeem, tab sis qee tus neeg tseem ua qhov muag tsis pom qhov lus ceeb toom. Nkag mus ….. COVID PrevEnter! Tus neeg hlau no siv lub koob yees duab Pixy2
Yuav Ua Li Cas Hloov Kev Nyab Xeeb Kev Nyab Xeeb rau K40 Laser Cutter: 4 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Hloov Kev Nyab Xeeb Kev Nyab Xeeb rau K40 Laser Cutter: Qhov tseem ceeb kho! Thov tsis txhob xaim koj cov kev sib txuas mus rau lub ntsiab ntawm lub tshuab. Hloov chaw xaim rau PG pins ntawm PSU. Yuav ua qhov hloov tshiab tag nrho sai. -Tony 7/30-19What yog ib qho ntawm thawj cov lus qhia hauv is taws nem rau thaum koj lub npe tshiab, (ma
Kev Nyab Xeeb Zoo dua: Ua Cov Tsheb ciav hlau Kev Nyab Xeeb: 7 Cov Kauj Ruam
Kev Nyab Xeeb Zoo dua: Ua Cov Chaw Tsheb Ciav Hlau Muaj Kev Nyab Xeeb: Ntau lub chaw tsheb ciav hlau niaj hnub no tsis nyab xeeb vim tsis muaj kev nyab xeeb, teeb meem, thiab ceeb toom ntawm lub tsheb ciav hlau los rau hauv. Peb pom qhov xav tau uas yuav tsum tau kho. Txhawm rau daws qhov teeb meem no peb tsim Kev Nyab Xeeb Zoo. Peb tau siv cov ntsuas kev co, cov cim txav txav, thiab
Rov Qab Pab Chaw Nres Tsheb Hauv Lub Nkoj Siv Kev Nyab Xeeb Muaj Kev Nyab Xeeb Zoo thiab Cov Cim Hluav Taws Xob: 5 Cov Kauj Ruam
Tsheb Rov Qab Pab Hauv Qhov Chaw Nkag Siv Kev Nyab Xeeb Uas Muaj Kev Nyab Xeeb Zoo thiab Cov Hluav Taws Xob Hluav Taws Xob: Kuv xav tias ntau qhov kev tsim tawm hauv keeb kwm ntawm noob neej tau ua vim kev yws yws poj niam. Tshuab ntxhua khaub ncaws thiab tub yees yeej zoo li zoo li cov neeg sib tw siv tau. Kuv me me " invention " piav qhia hauv Cov Lus Qhia no yog hluav taws xob