Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Khoos phis tawj khoos phis tawj
- Kauj Ruam 2: Thawj Xeev
- Kauj ruam 3: Python Script
- Kauj ruam 4: Trick-or-Treat Dashboard
Video: Pumpkin Pi Trick-or-Treat Tracker: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Los ntawm elizabethnaFollow Ntxiv los ntawm tus sau:
Nrhiav rau txoj haujlwm Xus sai uas muaj txiaj ntsig ntau txoj hauv kev ntau dua ib qho? Xav muab Pi Zero WH rau siv zoo? Xav tias zoo li siv cov ntaub ntawv los txiav txim siab npaum li cas cov khoom qab zib koj yuav xav tau rau xyoo tom ntej?
Npaj txhij los tsim Pumpkin Pi Trick-or-Treat Tracker! Doubling raws li kev kho kom zoo nkauj thiab cov neeg taug qab, qhov Pi-in-a-Pumpkin hloov xim thiab ntws thaum pom cov lus tsa suab. Pib los ntawm qhov tsis txaus ntseeg, txoj haujlwm no yuav tsum tsis txhob coj koj ntau dua ib tag hmo los ua ke - tsuas yog lub sijhawm rau Xus!
Khoom siv
- Pi Zero WH nrog SD Card
- PIR Tsab ntawv tsa suab Sensor
- RGB LED
- 220 ohm resistors
- (3) Tie Lines (F/F, M/F, M/M)
- Roj Teeb Portable
- Taub dag dag
Kauj ruam 1: Khoos phis tawj khoos phis tawj
Thaum koj muaj koj li Pi thiab khiav, peb yuav tsum txuas nrog lub suab sensor & LEDs. Nco ntsoov tias koj Pi tsis txuas nrog lub hwj chim ntawm qhov no.
Peb lub suab txav txav xav kom peb txuas nws mus rau 3.3V lub zog, hauv av, thiab tus lej pin. Kuv txuas 3.3V tus pin tus pin rau tus pin 1 ntawm Pi, Ground sensor tus pin rau tus pin 6 ntawm Pi, thiab Cov Ntaub Ntawv sensor tus pin rau tus pin 16 ntawm Pi. Thawj daim duab qhia pom kev sib txuas tag nrho rau Pi thiab lub suab txav.
LEDs yog qhov ua kom yuam kev me ntsis ntau dua li qhov ntsuas lub zog vim tias lawv xav tau lub zog tiv thaiv kom ua haujlwm tau zoo yam tsis ua rau lawv lossis Pi. Kuv siv peb 220 ohm resistors tab sis 220 thiab 330 ohm resistors feem ntau siv nrog LEDs.
Txhawm rau xaim txhua yam koj tuaj yeem yog:
- Muab cov ceg LED tso rau ntawm cov neeg tawm tsam thiab tom qab ntawd khiav cov xov hlau mus rau Pi
- Siv lub khob cij thiab khi kab kom txuas txhua yam
- Siv cov hlua khi thiab kab xev hluav taws xob txuas txhua yam (zoo li kuv tau ua).
Peb yuav txuas peb LED mus rau tus pin 11, 13, thiab 15. Qhov no yog qhov ua rau me ntsis me dua li cov lus tsa suab sensor, txawm li cas los xij, vim hais tias ob txhais ceg ntawm LED sib raug rau cov xim tshwj xeeb! Cov ceg ntev yog GND; thiab, ntawm kuv LED tsawg kawg, ob txhais ceg mus Liab, GND, Xiav, Ntsuab. Kuv txuas Blue rau Pi tus pin 11, Ntsuab rau Pi tus pin 13, thiab Liab rau Pi tus pin 15. Daim duab thib ob qhia txog qhov kev sib txuas zaum kawg.
Kauj Ruam 2: Thawj Xeev
Tseeb peb tuaj yeem pom thaum cov lus tsa suab pom nrog LED, tab sis peb yuav taug qab pes tsawg tus neeg dag-lossis-tus kws kho mob poob los nyiag peb cov khoom qab zib?
Peb tab tom yuav kwj mus rau lub dashboard txhua lub sijhawm pib pib thiab nres tsis pom. Txij li lub dashboard no nkag tau yooj yim los ntawm txhua qhov chaw nrog kev sib txuas hauv is taws nem, peb tuaj yeem saib xyuas nyob deb seb puas muaj ib tus neeg tuaj txog ntawm lub qhov rooj/khoom qab zib.
Kauj Ruam 1: Sau npe rau Thawj Lub Xeev Tus Kheej Mus rau https://iot.app.initialstate.com thiab tsim tus lej tshiab.
Kauj ruam 2: Nruab ISStreamer
Txhim Kho Thawj Lub Xeev Python module rau koj li Raspberry Pi. Ntawm qhov hais kom ua sai sai (tsis txhob hnov qab SSH rau hauv koj tus Pi thawj), khiav cov lus txib hauv qab no:
$ cd/tsev/pi/
$ / curl -sSL https://get.initialstate.com/python -o -| sudo tsoo
Kauj Ruam 3: Ua qee Automagic
Tom qab Kauj Ruam 2 koj yuav pom qee yam zoo ib yam li cov hauv qab no tso rau ntawm qhov screen:
pi@raspberrypi ~ $ / curl -sSL https://get.initialstate.com/python -o -| sudo tsoo
Lo lus zais: Pib ISStreamer Python Kev teeb tsa yooj yim! Qhov no yuav siv ob peb feeb los teeb tsa, rub qee lub kas fes:) Tab sis tsis txhob hnov qab rov qab los, Kuv yuav muaj lus nug tom qab! Pom yooj yim_install: setuptools 1.1.6 Pom pip: pip 1.5.6 los ntawm /Library/Python/2.7/site-packages/pip-1.5.6- py2.7.egg (sej 2.7) pip loj version: 1 pip me me version: 5 ISStreamer pom, hloov kho… Yuav tsum tau hloov kho tshiab tas li: ISStreamer hauv /Library/Python/2.7/site-packages Tu tu… Koj puas xav tau automagically tau txais ib qho piv txwv tsab ntawv? [y/N] Koj xav khaws qhov piv txwv nyob qhov twg? [lub neej ntawd:./is_example.py] Thov xaiv qhov Xeev Lub Xeev app uas koj siv: 1. app.initialstate.com 2. [TSHIAB!] iot.app.initialstate.com Nkag mus xaiv 1 lossis 2: Nkag mus rau iot.app.initialstate.com tus neeg siv lub npe: Nkag mus rau iot.app.initialstate.com lo lus zais:
Thaum hais kom ua kom tau txais cov ntawv piv txwv, ntaus y. Qhov no yuav tsim cov ntawv xeem uas peb tuaj yeem ua haujlwm kom ntseeg tau tias peb tuaj yeem xa cov ntaub ntawv mus rau Lub Xeev Pib. Qhov txuas ntxiv tom ntej yuav nug qhov twg koj xav khaws cov piv txwv ntawv. Koj tuaj yeem xaiv hom kev cai hauv nroog lossis ntaus nkag mus lees txais qhov chaw nyob tsis raug. Thaum kawg, koj yuav raug nug tias Thawj Lub Xeev app twg koj tab tom siv. Yog tias koj nyuam qhuav tsim ib tus as khauj, xaiv qhov kev xaiv 2, sau koj lub npe siv thiab tus password. Tom qab ntawd qhov kev teeb tsa yuav ua tiav.
Kauj ruam 4: Nkag Nkag Mus
Cia peb saib qhov piv txwv tsab ntawv uas tau tsim. $ nano is_example.py On kab 15, koj yuav pom kab uas pib nrog streamer = Streamer (bucket_…. Kab ntawv no tsim cov ntaub ntawv tshiab thoob lub npe “Python Stream Piv txwv” thiab cuam tshuam nrog koj tus lej nyiaj. access_key =”…” qhov ntsuas ntawm tib kab ntawv ntawd. Cov ntawv ntev thiab cov lej yog koj li Tus Thawj Coj Hauv Xeev tus lej nkag. mus rau "kuv teeb tsa", koj yuav pom tus yuam sij nkag tau zoo nyob hauv qab ntawm nplooj ntawv hauv qab "Streaming Access Keys".
Txhua lub sijhawm koj tsim cov ntaub ntawv kwj, tus yuam sij nkag mus yuav ncaj qha cov ntaub ntawv xa mus rau koj tus lej nyiaj (yog li tsis txhob faib koj tus yuam sij rau leej twg).
Kauj Ruam 5: Khiav Tus Qauv
Khiav cov ntawv xeem kom paub tseeb tias peb tuaj yeem tsim cov ntaub ntawv xa mus rau koj Tus Thawj Xeev tus as khauj. Khiav cov hauv qab no:
$ python is_example.py
Kauj Ruam 6: Nyiaj tau los
Rov qab mus rau koj lub Xeev Thawj tus lej hauv koj lub vev xaib. Ib lub thoob cov ntaub ntawv tshiab hu ua "Python Stream Piv txwv" yuav tsum tau tshwm nyob rau sab laug hauv koj lub txee rau khoom (koj yuav tau rov ua nplooj ntawv tshiab). Nyem rau ntawm lub thoob no thiab tom qab ntawd nyem rau ntawm Waves icon kom pom cov ntaub ntawv ntsuas.
Kauj ruam 3: Python Script
Tsim ib tsab ntawv thiab qhib cov ntawv sau nrog cov lus txib hauv qab no:
nano vistors.py
Luam thiab hla cov cai los ntawm no mus rau hauv koj tus ntawv sau.
Ua ntej peb sim ua dab tsi, peb yuav tsum tau kho ob peb qhov kev tshuaj xyuas thiab tshuaj xyuas seb muaj dab tsi tshwm sim hauv peb tsab ntawv.
ntshuam RPi. GPIO ua GPIO
los ntawm lub sijhawm ntshuam pw ntawm ISStreamer. Streamer ntshuam Streamer # Qhia rau Pi tias peb yuav siv nws cov lej lej GPIO.setmode (GPIO. BCM) # Pins uas D1 thiab LED txuas nrog PIN = 23 XEEB = 17 GREEN = 27 RED = 22 # Qhia kom meej peb cov lus tsa suab sensor tus pin li input GPIO.setup (PIN, GPIO. IN) # Qhia meej peb cov pins LED raws li tso tawm GPIO.setup (RED, GPIO. OUT) GPIO.output (RED, 0) GPIO.setup (GREEN), GPIO. OUT) GPIO.output (GREEN, 0) GPIO.setup (XEEB, GPIO. OUT) GPIO.output (XEEB, 0)
Kab 1-21 yog rau kev pib ua. Ua ntej peb ntshuam Pi's GPIO interface thiab txoj hauv kev kom tsaug zog peb tsab ntawv. Tom qab ntawd peb ntshuam Thawj Lub Xeev streamer uas peb tau teeb tsa ntawm nplooj ntawv dhau los.
GPIO.setmode qhia meej qhov lej uas peb siv rau tus pin. Ntau dua qhov chaw nyob, peb tab tom siv Pi tus lej lej. Raws li hauv peb daim duab ua ntej, cov pins peb tau xaiv yog 23, 17, 27, thiab 22. Tom qab ntawd peb teeb tsa tus pin txav mus raws li cov tswv yim thiab LED pins raws li tso tawm.
# Thawj lub xeev thoob lub npe (tso tawm)
BUCKET_NAME = ": jack_o_lantern: Trick or Treat Tracker" # Thawj lub xeev thoob qhov tseem ceeb (zais) BUCKET_KEY = "trickortreat" # Thawj lub xeev nkag mus yuam kev ACCESS_KEY = "Your_Access_Key" # Cov lej sib txawv uas ua kom peb tsis kwj tawm tias muaj lossis tsis tau tsab ntawv tsa suab ob zaug ua ke # Qhov no txuag ntawm kev xa cov xwm txheej thiab ua lub zog twb tau lawmRecordedMotion = Tsis raug lawmRecordedNoMotion = tsis tseeb counter = 0 # Pib pib Lub Xeev Pib Pib Streamer streamer = Streamer (bucket_name = BUCKET_NAME, bucket_key = BUCKET_KEY, access_key = ACCESS_KEY) # Qhib thiab teeb tsa LED mus rau daj GPIO.output (RED, 1) GPIO.output (GREEN, 1)
Kab 23-41 yog qhov tseem ceeb vim tias peb tau pib ua ntej Lub Xeev pib thiab teeb tsa LED kom daj. Muab koj Tus Thawj Xib Fwb nkag mus rau tus lej ntawm kab 28.
# Loop tsis muaj hnub kawg
thaum muaj tseeb: # Yog tias lub suab ntsuas ntsuas rub siab (pom cov lus tsa suab): yog GPIO.input (PIN) == 1: luam "Tsab ntawv tsa suab pom" # Yog tias peb tseem tsis tau tshaj tawm: yog tias tsis tauRecordedMotion: counter = counter + 1 # Teem LED rau liab GPIO.output (RED, 1) GPIO.output (GREEN, 0) # Kwj rau Thawj Lub Xeev streamer.log (": dab: lossis: chocolate_bar:?", ": Chocolate_bar: Sijhawm Rau Kev Kho!") streamer.log (": khoom qab zib: Tib neeg tshaib plab?: khoom qab zib:", txee) streamer.flush () twbRecordedMotion = Muaj tseeb lawmRecordedNoMotion = Tsis tseeb: # Pauv tsab ntawv rau 1 thib ob pw tsaug zog (1) ntxiv: luam tawm "Tsis pom lub suab pom" # Yog tias peb tseem tsis tau tshaj tawm: yog tias tsis tauRecordedNoMotion: # Teeb LED rau daj GPIO.output (RED, 1) GPIO.output (GREEN, 1) # Stream to Initial State streamer.log (": dab: lossis: chocolate_bar:? ",": no_pedestrians: Tsis Muaj Ib Tus Nyob Ib Leeg ") streamer.flush () twbRecordedNoMotion = Muaj tseeb lawmRecordedMotion = Tsis tseeb: # Pauv tsab ntawv rau 1 thib ob pw tsaug zog (1)
Kab 43-77 yog cov nqaij ntawm txoj cai. Yog tias tsab ntawv tsa suab tau tshawb pom tsab ntawv yuav tshuaj xyuas seb "Lub Sijhawm Rau Kev Kho!" twb tau tshaj tawm. Yog tias nws tsis tau, nws tau xa mus rau Lub Xeev Pib thiab LED tau teeb liab; yog tias nws muaj, tsab ntawv tos 1 thib ob thiab tom qab ntawv nyeem los ntawm lub suab txav dua. Tib yam mus rau yog tias tsis pom muaj cov lus tsa suab.
Nws yog lub sijhawm los sim cov cai tawm! Nco ntsoov tias koj tau khaws koj cov ntaub ntawv kho nrog koj tus lej nkag nkag tau ntxiv ntawm kab 28, thiab tom qab ntawd nkag mus rau hauv lub davhlau ya nyob twg:
nab hab sej cov neeg tuaj saib.py
Koj yuav tsum pom LED tuaj thiab "Tsis pom lub suab pom" pib luam tawm rau kab hais kom ua. Sim viav vias koj txhais tes hla lub suab ntsuas - koj yuav tsum tam sim no pom lub teeb liab thiab "Tsab ntawv tsa suab pom" pib luam ntawv!
Tam sim no txhawm rau txheeb xyuas tias peb nyeem tau raug xa mus rau Thawj Lub Xeev.
Kauj ruam 4: Trick-or-Treat Dashboard
Lub taub hau hla mus rau Thawj Lub Xeev thiab tshawb xyuas koj lub dashboard! Koj yuav tsum pom lub thoob hu ua "? Trick or Treat Tracker". Tuav koj txhais tes ze ntawm lub suab ntsuas thiab saib nws hloov tshiab!
Kuv lub dashboard suav nrog 2 Cov Ntsiab Lus Cov vuas tso tawm tus nqi kawg thiab Histogram ntawm cov xwm txheej suav kom kuv tuaj yeem pom lub sijhawm twg lub ntsuas tau tshwm sim.
Nov yog qee yam los xav txog:
- Tej zaum koj yuav xav faib cov suav ntawm "Tib neeg tshaib plab" los ntawm 2 suav nrog qhov tseeb tias tib tus neeg yuav hla mus rau pem hauv ntej ntawm lub suab ntsuas ntawm ob zaug - ntawm lawv txoj kev mus rau koj lub qhov rooj thiab ntawm lawv txoj kev rov qab. Koj tuaj yeem ua qhov no nrog Cov Sijhawm Qhia Sijhawm tiag tiag siv cov zauv "= lej.round (([Tib neeg tshaib plab?]/2), 0)".
- Koj tuaj yeem sim ntsuas qhov rhiab ntawm koj lub suab sensor zoo li yog thiab muab nws tso rau ntawm koj txoj kev taug kev raws li. Kuv hais kom khaws nws kom deb txaus ntawm lub qhov rooj uas nws tsis ua rau thaum ib tus neeg sawv ntawm lub qhov rooj.
- Koj tseem tuaj yeem teeb tsa ntawv ceeb toom qhia koj tias ib tus neeg tab tom los.
- Xaiv cov duab keeb kwm yav dhau los muab rau koj lub dashboard me ntsis tus neeg txaus ntshai!
Pom zoo:
Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: 6 Kauj Ruam
Desktop COVID19 Tracker Nrog Moos! Raspberry Pi Powered Tracker: Peb paub tias peb tuaj yeem tuag txhua lub sijhawm, txawm tias kuv tuaj yeem tuag thaum sau cov ntawv no, tom qab tag nrho, kuv kuv, koj, peb txhua tus yog neeg tuag. Tag nrho lub ntiaj teb tau tshee vim yog COVID19 muaj thoob qhov txhia chaw. Peb paub yuav tiv thaiv qhov no li cas, tab sis hav! peb paub yuav thov li cas thiab vim li cas thiaj thov ntuj, peb puas ua
Movie Tracker - Raspberry Pi Powered Theatrical Release Tracker: 15 Cov Kauj Ruam (nrog Duab)
Movie Tracker - Raspberry Pi Powered Theatrical Release Tracker: Movie Tracker yog cov duab clapperboard, Raspberry Pi -powered Release Tracker. Nws siv TMDb API los luam daim ntawv tshaj tawm, lub npe, hnub tso tawm thiab cov lus pom ntawm cov yeeb yaj kiab yuav los tom ntej hauv koj cheeb tsam, nyob rau lub sijhawm tshwj xeeb ncua sijhawm (piv txwv li kev ua yeeb yaj kiab tso tawm lub lim tiam no) ntawm
"Khawv Koob" Luav hauv Lub Koob Yees Duab Trick: 7 Kauj Ruam (nrog Duab)
"Khawv Koob" Luav hauv Lub Hnab Liab Liab: Yog li ntawm no yog "khawv koob" dag. Luav ua los ntawm cov dej khov zaum saum lub kaus mom ua khawv koob. Tus luav dej khov yaj ploj mus thiab ploj mus ib txhis … lossis yog vim li cas hauv tus kws yees duab lub kaus mom nws tau qhia tawm muaj daim duab ntawm tus luav zoo li nws muaj r
Cool Itunes Trick - VISUALIZER: 7 Kauj Ruam
Cool Itunes Trick - VISUALIZER: Kuv yuav qhia koj yuav ua li cas tso vizualizer ntawm Itunes. Visualizer yog qhov txias tshaj plaws thiab koj tuaj yeem tswj hwm nws
GIMP: 2 Layer Dialogs Trick: 5 Kauj Ruam
GIMP: 2 Layer Dialogs Trick: Ntawm no, koj yuav kawm paub teeb tsa GIMP li cas kom muaj txiaj ntsig luam cov txheej ntawm cov duab. Qhov no yuav tsim nyog thaum ua haujlwm ntawm cov ntsiab lus nyuaj. (Kuv tau siv ob daim duab paub daws teeb rau qhov yooj yim txawm hais tias)