Cov txheej txheem:
- Kauj Ruam 1: Daim Ntawv Teev Npe
- Kauj ruam 2: Npaj Pi Npaj
- Kauj Ruam 3: Ua Koj Li Twitter App
- Kauj Ruam 4: Ua tiav Qhov Software
- Kauj Ruam 5: Npaj TEEV Txuas
- Kauj Ruam 6: Txhim Kho Koj Li Relay
- Kauj Ruam 7: Txuas Txuas Txuas mus rau Pi
- Kauj ruam 8:
Video: Shockbot: 8 Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Raspberry Pi + hluav taws xob tam sim no lub paj hlwb stimulator + Twitter = Shock-bot
Nws yog Xyoo Tshiab Xyoo yog li kuv tau txiav txim siab xaim xov tooj nrog TEES (Kev hloov pauv hluav taws xob cov hlab paj hlwb) ntaus ntawv los ntawm kev xa mus rau raspberry pi thiab tom qab ntawd sau cov ntawv nab nab uas ntsuas kuv li Twitter pub rau hashtag #happynewyear. Txhua lub sijhawm nws pom #happynewyear, nws ua rau kuv poob siab! GREAT IDEA, YOG!?!?
Lub sijhawm los tshuaj xyuas cov npe khoom:
Kauj Ruam 1: Daim Ntawv Teev Npe
Nov yog yam koj yuav xav tau rau txoj haujlwm no
✔ Raspberry Pi
E TSO Ntaus ntawv
Ay Relay Breakout
✔ Twitter Account
✔ Hlau
Tsis tas li, Tsis txhob ua qhov no yog tias koj muaj teeb meem plawv!
Kauj ruam 2: Npaj Pi Npaj
Ua ntej, Kuv xav tias koj paub nrog siv Raspberry Pi los ntawm SSH yog li peb yuav pib los ntawm kev hloov kho Pi
SSH rau hauv koj tus Pi thiab khiav
sudo apt-tau hloov tshiab
thiab
sudo apt-tau hloov tshiab
yog li peb tuaj yeem pib nrog qhov hloov tshiab Pi. Tam sim no peb yuav tsum tau txais ob peb pob los nruab.
Khiav cov lus txib no txhawm rau rub tawm txhua pob khoom xav tau rau txoj haujlwm no:
sudo apt-tau nruab nruab sej-pip
sudo pip nruab twython
Kauj Ruam 3: Ua Koj Li Twitter App
Tam sim no peb yuav mus rau Twitter
Mus ntsib apps.twitter.com thiab sau npe lossis nkag mus yog tias koj twb muaj tus as khauj lawm.
Thaum koj tau kos npe rau hauv, nyem rau ntawm koj tus neeg siv lub cim, thiab xaiv "Kuv Cov Ntawv Thov".
Nyem rau ntawm "Tsim daim ntawv thov tshiab" khawm, ua daim ntawv hais txog koj daim ntawv thov. Sau lub npe thiab cov lus piav qhia. Rau "Lub Vev Xaib," koj tuaj yeem tso txhua yam uas zoo li raug cai. Hauv qab ntawm nplooj ntawv, nyem rau ntawm lub npov kom pom zoo rau cov lus, thiab nyem rau "Tsim koj li Twitter app" khawm.
Tam sim no koj yuav tsum tsim tus lej nkag mus los ntawm txhaj rau "Tsim kuv nkag token" khawm hauv qab ntawm qhov screen. Luam theej "Tus yuam sij neeg siv khoom," "Tus neeg siv khoom zais," "Nkag mus rau tus lej," thiab "Nkag mus rau tus lej zais." Koj yuav xav tau cov no rau tsab ntawv shockbot.py.
Kauj Ruam 4: Ua tiav Qhov Software
Rov qab mus rau Pi kom ua cov ntawv nab nab.
Peb yuav ua cov npe rau peb txoj haujlwm los ntawm kev ntaus:
sudo mkdir shockbot
Tsiv mus rau hauv phau ntawv teev npe tshiab no los ntawm kev ntaus ntawv
cd shockbot
Tam sim no peb yuav ua cov ntawv Python.
Siv qhov hais kom ua
nano sockbot.py
qhib cov ntawv nyeem editor.
Luam cov ntawv Python. Nco ntsoov tias koj ntxiv rau hauv koj cov ntaub ntawv token uas koj tau txais thaum tsim Twitter app.
ntshuam sijhawm ntshuam RPi. GPIO li GPIO los ntawm twython ntshuam TwythonStreamer
# Tshawb nrhiav cov ntsiab lus
TERMS = '#yourhashtag'
# GPIO tus lej tus lej ntawm LED
LED = 22 hli
# Twitter daim ntawv pov thawj kev lees paub
APP_KEY = 'YOUR_APP_KEY' APP_SECRET = 'YOUR_APP_SECRET' OAUTH_TOKEN = 'YOUR_TOKEN' OAUTH_TOKEN_SECRET = 'YOUR_TOKEN_SECRET'
# Teeb kev hu rov qab los ntawm Twython Streamer
chav BlinkyStreamer (TwythonStreamer): def on_success (tus kheej, cov ntaub ntawv): yog 'ntawv' hauv cov ntaub ntawv: luam cov ntaub ntawv ['ntawv']. encode ('utf-8') luam GPIO.output (LED, GPIO. HIGH) lub sijhawm. pw tsaug zog (1) GPIO.output (LED, GPIO. LOW)
# Teeb GPIO raws li tso tawm
GPIO.setmode (GPIO. BOARD) GPIO.setup (LED, GPIO. OUT) GPIO.output (LED, GPIO. LOW)
# Tsim streamer
sim: kwj = BlinkyStreamer (APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) stream.statuses.filter (khiav = TERMS) tshwj tsis yog KeyboardInterrupt: GPIO.cleanup ()
Txij ntawm no mus, koj xav teeb koj li Twitter lo lus tseem ceeb. Kuj teem sijhawm. sijhawm pw tsaug zog rau lub sijhawm koj xav kom poob siab.
Txuag thiab tawm
Qhov ntawd ua tiav qhov software ib feem ntawm txoj haujlwm no
*Txoj cai no tau pab txhawb rau Sparkfun tutorials project los ntawm ShawnHymel. Peb tau rov txhim kho nws kom ua rau peb lub cuab yeej.
Kauj Ruam 5: Npaj TEEV Txuas
Lub sijhawm kom tshem tawm TEES thiab xa tawm thiab hack qee yam khoom siv
The T. E. N. S. cov cuab yeej muaj ob lub ncoo nkag rau sab saum toj, peb tsuas yog xav tau ib qho. Nqa ib txheej ntawm cov ntaub qhwv thiab rub cov xov hlau sib nrug mus txog 4 lossis 5 ntiv tes los ntawm lub ntsaws.
Ua raws cov xaim nrog lub txuas liab nyob saum thiab txiav nws ze rau hauv qab qhov uas nws ntsaws rau hauv lub cuab yeej. Kuv tau siv lub taub hau taub hau rau qhov kawg ntawm txhua lub xov hlau.
Kauj Ruam 6: Txhim Kho Koj Li Relay
Coj koj qhov kev sib kis tawm mus thiab txuas lub ntsaws sab ntawm cov xaim txiav mus rau hauv "Common" davhlau ya nyob twg ntawm kev xa xov.
Txuas lub ncoo sab ntawm cov xaim txiav rau hauv "Feem ntau Qhib" lub davhlau ya nyob twg. Koj tuaj yeem siv lub ntsuas ntsuas ntau los nrhiav qhov no yog tias koj qhov txuas tsis muaj cov cim rau ntawm nws. Ntawm qhov qis hluav taws xob sab ntawm kev xa tawm, txuas xov hlau mus rau Lub Hwj Chim, Hauv Paus, thiab Cov Piav Qhia.
Kauj Ruam 7: Txuas Txuas Txuas mus rau Pi
Lub Hwj Huam thiab Hauv av pins yuav txuas rau lub zog thiab Hauv av ntawm Pi thiab Cov Cim yuav txuas rau tus pin 22 ntawm Pi. Google tshawb nrhiav tus pinouts kom phim tus qauv Pi koj siv.
Pop lub roj teeb rau hauv koj TEES thiab qhov ntawd ua tiav kho vajtse.
Kauj ruam 8:
Tig rau T. E. N. S. thiab muab cov ntaub qhwv rau ntawm koj lub xub pwg thiab npaj kom pib cov ntawv nab nab
Ntawm koj Pi hauv koj phau ntawv teev npe shockbot khiav
sudo python shockbot.py
los ntawm phau ntawv teev npe shockbot.
Tam sim no zaum rov qab thiab tos. Koj yuav xav pib nrog cov chaw qis thiab tsoo lawv. Koj tseem tuaj yeem cuam tshuam nrog cov cuab yeej teeb tsa kom tau txais qhov txiaj ntsig xav tau.
Cov haujlwm no yog muab rau kev kawm nkaus xwb. Tsuas yog rov ua qhov no ntawm koj tus kheej txoj kev pheej hmoo. Kuv tsis yog lub luag haujlwm yog tias koj mus rau hauv tsev kaw neeg lossis tuag!
Pom zoo:
YADPF (YET Lwm Tus Duab Duab Duab): 7 Kauj Ruam (nrog Duab)
YADPF (YET Lwm Tus Duab Duab Duab): Kuv paub qhov no tsis yog khoom tshiab, Kuv paub, Kuv tau pom qee qhov ntawm cov haujlwm no ntawm no, tab sis kuv ib txwm xav tsim kuv tus kheej cov duab thav duab. Txhua daim duab thav duab kuv tau pom yog qhov zoo, tab sis kuv tab tom nrhiav lwm yam, Kuv tab tom nrhiav qhov zoo nkauj tiag tiag
Kev Tsim Qauv Duab Duab/Duab Duab Duab: 4 Kauj Ruam
Kev Tsim Qauv Duab Duab/Duab Duab Duab: Nyob zoo txhua tus, Hauv qhov kev qhia no, Kuv yuav qhia koj cov txheej txheem ntawm yuav ua li cas thiaj tsim 3D qauv siv cov duab digital. Cov txheej txheem hu ua Photogrammetry, tseem hu ua Image-Based Modeling (IBM). Tshwj xeeb, hom txheej txheem no tau siv los rov ua dua
Cov Duab Duab Duab thiab Cov Duab 1: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Cubes thiab Cov Duab 1: Thaum sim nrog qee cov ntoo ntoo thiab cov duab los qhia, kuv pom ob peb txoj hauv kev los ua cov voos thiab lwm yam duab los ntawm cov khoom siv yooj yim. Los ntawm kev muab cov no los ua Cov Ntawv Qhia, Kuv vam tias yuav txhawb nqa kev ua si thiab kev kawm. Kev hloov pauv ntawm qhov kev qhia no
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: 4 Cov Kauj Ruam (nrog Duab)
Cov Duab Duab Duab Duab, WiFi Txuas - Raspberry Pi: Nov yog txoj hauv kev yooj yim heev thiab tus nqi qis mus rau cov duab thav duab digital - nrog qhov zoo ntawm kev ntxiv /tshem cov duab hla WiFi ntawm 'nyem thiab luag' siv (pub dawb) xa cov ntaub ntawv . Nws tuaj yeem siv tau los ntawm qhov me me £ 4.50 Pi Zero. Koj tseem tuaj yeem hloov pauv