Cov txheej txheem:
- Kauj ruam 1: Yuav tsum tau ua
- Kauj ruam 2: Teeb Kho Vajtse
- Kauj ruam 3: Teeb Firmware
- Kauj ruam 4: PiCtory Teeb
- Kauj Ruam 5: Xa Cov Ntaub Ntawv mus rau Ubidots
- Kauj Ruam 6: Kev Txhim Kho Cov Ntawv Thov Hauv Tsev
- Kauj Ruam 7: Tau Txais Cov Ntaub Ntawv Los ntawm Ubidots
- Kauj Ruam 8: Cov txiaj ntsig
Video: Txuas Koj RevPi Core + RevPi DIO rau Ubidots: 8 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Revolution Pi yog qhov qhib, hloov pauv, thiab ua haujlwm ruaj khov PC raws li tsim Raspberry Pi thaum ua tau raws li EN61131-2 tus qauv. Nruab nrog Raspberry Pi Compute Module, RevPi Core lub hauv paus tuaj yeem nthuav dav txuas ntxiv siv qhov tsim nyog I/O cov qauv thiab cov qhov rooj nkag mus rau lub zog rau kev tswj hwm lub zog, txheej txheem tshuaj xyuas, tshuab noj qab haus huv thiab ntau ntxiv.
Rev Pi Core yog lub hauv paus rau txhua daim ntawv thov thiab nyob ntawm koj li I/O qhov xav tau nthuav dav cov qauv xws li RevPi DIO, RevPi AIO, RevPi Gates tuaj yeem txuas ua digital, analog, lossis rooj vag modules.
Hauv qhov kev qhia no peb nthuav qhia kev koom ua ke ntawm RevPI DIO kom pom kev thiab tswj cov teeb liab tso rau koj lub tshuab lossis cov ntawv thov nrog Ubidots. RevPi DIO digital I/O module los nrog 14 digital inputs thiab 14 outputs, PWM (puls dav modulation), thiab counter inputs. Txog cov ncauj lus kom ntxaws ntawm kev ua haujlwm rau RevPI DIO, txheeb xyuas Phau Ntawv Qhia Kev Tsim Khoom Pi.
Kauj ruam 1: Yuav tsum tau ua
- Ethernet Cable
- 24 V Fais Fab Khoom
- RevPi Tub Ntxhais
- RevPi DIO
- Ubidots tus account - lossis - STEM License
Kauj ruam 2: Teeb Kho Vajtse
Raws li ib qho cuab yeej tshiab teeb tsa, peb pom zoo kom paub txog RevPi Core + RevPi DIO cov lus qhia pib sai los ntawm Revolution Pi. Tom qab ntawd nco ntsoov tias koj yuav tsum sib sau ua ke RevPi Core + DIO kom raug raws li cov kab lus hauv qab no kom paub meej ntxiv, raws li xav tau.
- Txuas koj RevPi Core rau Ubidots
- Txuas cov qauv
- Mounting modules ntawm txoj kev tsheb nqaj hlau DIN
- Txuas lub hwj huam
- Cov xwm txheej LEDs DIO
- Digital in thiab outputs
- Kev teeb tsa RevPi DIO
- Hloov kho firmware ntawm cov qauv (Jessie)
Thaum koj RevPi Core + RevPi DIO tau teeb tsa, ua haujlwm raug, thiab txuas rau Is Taws Nem, peb tuaj yeem txuas ntxiv nrog Firmware uploads.
Kauj ruam 3: Teeb Firmware
1. Ua ntej peb yuav tsum muaj kev nkag mus rau cov tswv yim thiab cov txiaj ntsig ntawm Revolution Pi. Qhov "python3-revpimodio" module muab txhua qhov nkag mus rau IOs ntawm Revolution Pis, thiab tuaj yeem ua haujlwm tau yooj yim heev nrog Python3.
Raws li cov duab teeb tsa hauv koj RevPi Core siv phau ntawv qhia no txhawm rau txhim kho kom raug. Yog tias koj muaj Jessie Duab ntawm koj lub hauv paus, yooj yim teeb tsa tus qauv los ntawm Kunbus chaw cia khoom khiav cov lus txib hauv qab no hauv RevPi Terminal:
Hloov kho cov pob khoom: sudo apt-tau hloov tshiab
Nruab: sudo apt-tau nruab python3-revpimodio2
Hloov Kho Kev faib tawm (txhua yam): sudo apt-tau hloov dua tshiab
2. Tom ntej no, teeb tsa cov ntawv thov rau sej 3 los ntawm kev ua cov lus txib hauv qab no hauv RevPi Core davhlau ya nyob twg:
sudo apt-tau nruab nruab sej -3 thov
3. Thaum txhua qhov ntawm cov lus txib saum toj no tau ua tiav, txheeb xyuas txhua yam kom raug los ntawm kev qhib Python3 rau hauv koj li RevPi Core davhlau ya nyob twg thiab ntshuam cov qauv uas tau teeb tsa yav tas los. Qhib Python3 los ntawm kev ua cov lus txib hauv qab no rau hauv RevPi Core davhlau ya nyob twg:
nab hab sej 3
Thaum koj tau nkag mus rau Python3, ntshuam cov modules '' revpimodio2 "thiab" thov "raws li qhia hauv qab no:
ntshuam revpimodio2
ntshuam thov
Yog tias tau txais thiab yuam kev cov lus tom qab import tus qauv, txheeb xyuas qhov teeb meem pom thiab sim dua.
Kauj ruam 4: PiCtory Teeb
PiCtory cia koj txuas ntau RevPi cov qauv, ib sab ntawm PiBridge uas txuas lub cev sib txuas nrog cov qauv nrog ib leeg, tsim cov ntaub ntawv teeb tsa. Cov ntaub ntawv yuav tsum qhia rau koj li RevPi Core uas cov qauv yuav tsum tau pom nyob hauv txoj haujlwm twg thiab cov teeb tsa yooj yim uas cov qauv muaj. Txhawm rau kom tau txais lub tswv yim zoo tias nws ua haujlwm li cas saib daim vis dis aus no.
1. Qhib koj lub vev xaib thiab nkag mus rau IP chaw nyob ntawm koj RevPi Cores hauv qhov chaw nyob ntawm koj tus browser. Tom qab ntawd, koj yuav pom lub qhov rai nkag mus, txhawm rau nkag mus rau lub npe siv thiab tus password uas tau hais qhia. Cov ntaub ntawv pov thawj nkag mus tuaj yeem pom nyob ntawm koj RevPi.
- lub npe siv: admin
- lo lus zais: Koj yuav pom nws ntawm daim ntawv nplaum ntawm ib sab ntawm koj RevPi Core.
Tom qab ntawd, nkag mus rau ntu "APPS".
2. Txhawm rau pib nrog PiCtory teeb tsa, nias lub pob ntsuab hu ua "START".
3. Los ntawm cov cuab yeej teev npe xaiv cov version ntawm koj li RevPi Core thiab muab nws tso rau hauv cov txheej txheem teeb tsa. Tom qab ntawd, muab RevPi DIO ntawm sab xis ntawm RevPi Core. Nco ntsoov txuas RevPi Core mus rau sab xis ntawm koj RevPi Core siv PiBridge.
CEEB TOOM TSEEM CEEB: Txoj haujlwm ntawm cov qauv uas tau muab hauv PiCtory teeb tsa yuav tsum yog tib lub luag haujlwm hauv ntiaj teb lub cev kom tuaj yeem tsim cov ntawv teeb tsa kom raug.
3. Tam sim no koj muaj cov txheej txheem xav tau muab rau hauv cov phiaj xwm teeb tsa, cia txheeb xyuas lub npe ntawm cov koob uas peb yuav siv hauv qab no. Koj yuav pom ob tus lej piv txwv muab, ib qho yog rau xa tus nqi los ntawm kev nyeem cov ntaub ntawv ntawm RevPi DIO, thiab lwm qhov yog rau kev tswj hwm qhov tshwm sim ntawm RevPi DIO.
Cov tswv yim uas peb yuav siv yog Kev Nkag Mus 1, saib saum toj no rau tus pin-out daim duab
Los ntawm Tus Nqe Tus Kheej, txheeb xyuas yog tias lub npe raug xaiv rau Kev Nkag Mus 1 yog "I_1" raws li tau qhia ntawm daim duab hauv qab no, yog tias tsis thov thov muab rau nws. Yog tias koj hla cov kauj ruam no tus lej firmware yuav plam nyeem tus lej no.
Cov zis uas peb tab tom yuav siv yog Output 1, saib saum toj no rau tus pin-out daim duab
Los ntawm Tus Nqe Tus Kheej, txheeb xyuas lub npe uas tau muab rau Output 1 yog "O_1" raws li tau qhia hauv daim duab hauv qab no, yog tias tsis thov thov muab rau nws. Yog tias koj hla cov kauj ruam no tus lej firmware yuav plam qhov tso tawm no thiab koj yuav tsis tuaj yeem rov tswj tau.
Kauj Ruam 5: Xa Cov Ntaub Ntawv mus rau Ubidots
1. Txhawm rau pib sau koj lub khoos phis tawj, tsim cov ntawv Python hauv RevPi Core davhlau ya nyob twg. Peb yuav siv nano editor, txhawm rau tsim tsab ntawv tshiab. Txhawm rau ua qhov no khiav cov lus txib hauv qab no:
nano ubidots_revpi.py
Raws li koj yuav pom, lub nano editor davhlau ya nyob twg yuav cia li populate thiab koj tuaj yeem pib koj tus lej.
2. Luam thiab Paste tus qauv piv txwv hauv qab no rau hauv nano editor. Thaum dhau los, muab koj li Ubidots Token qhov uas tau qhia hauv tsab ntawv. Siv ntawm no txhawm rau pab nrhiav koj li Ubidots token.
Hauv cov qauv piv txwv no peb yuav tau nyeem Cov Lus Taw Qhia 1 (I_1) ntawm RevPi DIO module kom xa nws cov xwm txheej mus rau Ubidots huab kom muaj peev xwm saib xyuas thiab tsim lub tswb raws nws cov ntaub ntawv qhov txiaj ntsig tau txais.
NCO TSEG: Txhawm rau txuag tsab ntawv rau hauv nano editor - nias Ctrl+o, lees paub lub npe cov ntaub ntawv kom sau (ubidots_revpi_di.py) thiab nias nkag mus. Txhawm rau kaw nano editor nias Ctrl+x.
3. Tam sim no cia peb sim cov ntawv. Khiav tsab ntawv uas tau tsim yav tas los hauv RevPi davhlau ya nyob twg:
python3 ubidots_revpi_di.py
Thaum tsab ntawv pib ua haujlwm, koj yuav pom qhov xwm txheej ua tiav cov lus teb los ntawm Ubidots Server.
4. Mus rau koj tus lej Ubidots thiab txheeb xyuas cov ntaub ntawv tau txais. Koj yuav pom lub cuab yeej tshiab tau txais kev tsim nyob hauv ntu Ntaus nrog lub cuab yeej lub npe yog MAC chaw nyob ntawm koj RevPi Core. Khaws nyeem rau kev hloov npe.
Tsis nyiam MAC chaw nyob raws li koj lub cuab yeej lub npe hauv koj lub Ubidots zaub? Tsis txhob txhawj! Koj tuaj yeem hloov lub npe mus rau tus phooj ywg zoo dua, tab sis daim ntawv lo ntawm lub cuab yeej yuav nyob twj ywm raws li MAC chaw nyob kom tsis txhob poob siab tias lub cuab yeej twg yog qhov twg. Siv rau Ubidots Chaw Pabcuam rau ntau ntxiv ntawm Cov Ntawv Cim Ntaus thiab Cov Npe Lub Npe hloov pauv hauv Ubidots.
Nyem rau ntawm ib qho khoom siv twg hauv koj Cov Khoom seem kom pom qhov txawv txav tau raug kaw thiab xa mus rau Ubidots los ntawm peb cov qauv firmware. Raws li koj tuaj yeem pom, peb cov qauv piv txwv tau muab cov lus tsa suab-ntsuas qhov sib txawv.
Kauj Ruam 6: Kev Txhim Kho Cov Ntawv Thov Hauv Tsev
Tam sim no qhov xwm txheej ntawm koj cov tswv yim tau hloov kho hauv koj tus lej Ubidots. Cia peb pib ua si nrog Ubidots nta los tsim thiab xa koj daim ntawv thov. Hauv qhov kev qhia no peb yuav xa ib Lub Tsev Counter rau cov thawv txav hla txoj kab khoom
Thaum xub thawj, peb tab tom tsim lub qhov rai sib txawv uas tso cai rau peb suav qhov nruab nrab, siab kawg, yam tsawg kawg, suav, thiab suav ntawm lwm qhov sib txawv; qhov no qhov txawv txav yav tas los tsim (tsab ntawv tsa suab ntes). Txog phau ntawv qhia no, peb yuav suav qhov suav ntawm qhov sib txawv ntawm qhov ntsuas-ntsuas txhua feeb kom paub tias muaj pes tsawg lub thawv raug kuaj pom thaum lawv hla raws kab khoom.
Txhawm rau tsim qhov sib txawv, nyem "Ntxiv Hloov pauv". Tom qab ntawd, xaiv "Rolling Window":
Tam sim no xaiv cov cuab yeej tsim> suab-ntes> suav> txhua 1 feeb kom tiav nias tseg. Tom qab ntawd muab lub npe xav tau los ntawm koj, hauv qhov no, peb lub npe peb li "thawv".
Tam sim no peb paub tias muaj pes tsawg lub thawv peb lub ntsuas tau pom, peb tuaj yeem tsim qhov xwm txheej raws li "cov thawv" sib txawv kom ceev nrog kev tsim khoom thiab ceeb toom yog tias cov khoom poob qab.
Peb lub hom phiaj tsim khoom yog 10 "thawv" ib feeb. Txhawm rau tswj lub hom phiaj no, RevPi yuav tsum txheeb xyuas 10 lub thawv tsawg kawg ib feeb. Txhawm rau ceeb toom rau kev tsim khoom poob peb yuav yooj yim tsim kev ceeb toom qhia rau peb paub thaum tsawg dua 10 lub thawv raug kuaj pom.
Mus rau ntu ntu ntawm koj tus lej Ubidots thiab nias "Ntxiv Cov Txheej Txheem". Tom qab ntawd, xaiv lub cuab yeej thiab qhov sib txawv, thiab muab qhov xwm txheej ntawm qhov xwm txheej. Hauv qhov no, yog tias cov thawv sib txawv tsawg dua 10 teeb tsa qhov xwm txheej. Tam sim no tias cov kev txwv ntawm koj qhov xwm txheej tau teeb tsa, muab qhov kev ua uas koj xav tau. Kuv teeb tsa qhov xwm txheej nrog kev ua e-mail. Thiab raws li koj tuaj yeem pom saum toj no, thaum qhov xwm txheej tshwm sim Kuv tau txais cov lus saum toj no.
CEEB TOOM CEEB TOOM: Cov cai tau hais los saum toj no tsuas yog nyeem cov lus nkag 1 yam tsis tsim kev teeb tsa lub teeb tsa. Raws li cov cuab yeej siv, ntxiv kev teeb tsa ntawm lub sensor rau hauv cov cai raws li xav tau.
Kauj Ruam 7: Tau Txais Cov Ntaub Ntawv Los ntawm Ubidots
Hauv daim ntawv thov piv txwv no peb tab tom tswj qhov kev tso tawm ntawm RevPi DIO module kom tuaj yeem qhib/OFF lub teeb los ntawm Ubidots huab.
1. Txhawm rau tuaj yeem tswj hwm qhov tsim tawm ntawm Ubidots sib txawv koj yuav tsum tsim nws ua ntej qhov sib txawv. Nkag mus rau koj lub cuab yeej RevPi thiab tsim qhov hloov pauv tshiab los ntawm kev xaiv "Ntxiv Kev Hloov pauv" thiab nias "Default". Tom qab ntawd, muab nws lub npe "teeb". Thaum lub cuab yeej tsim kom raug.
2. Mus rau koj lub ntsiab Ubidots Dashboard thiab tsim kev tswj hwm tus widget. Nyem rau qhov daj ntxiv rau (+) lub cim thiab ua raws cov kev xaiv ntawm lub vijtsam kom nthuav tawm cov tshiab dashboard widgets. Xaiv Tswj> Hloov> RevPICore (MACAddress)> lub teeb (qhov sib txawv tsuas yog tsim)> Ua tiav. Tom qab tsim koj lub widget tshiab, Dashboard yuav rov qhib thiab muaj neeg nyob nrog koj lub teeb tshiab tswj lub cuab yeej.
Qhov "tswj" qhov khoom siv no yuav xa nws cov xwm txheej mus rau RevPi DIO cov zis los tswj cov xwm txheej ntawm lub teeb lossis lwm yam khoom siv txuas nrog rau Output 1.
3. Tsim tsab ntawv nab nab tshiab siv nano editor. Txhawm rau ua qhov no khiav cov lus txib hauv qab no hauv RevPi davhlau ya nyob twg:
nano ubidots_revpi_do.py
4. Thov luam thiab muab cov qauv coj ua no tso rau hauv nano editor. Thaum dhau los, muab koj li Ubidots Token qhov uas tau qhia hauv tsab ntawv. Siv ntawm no txhawm rau pab nrhiav koj li Ubidots token.
Hauv cov qauv piv txwv no peb yuav tswj hwm qhov tsim tawm ntawm RevPi DIO module kom tuaj yeem qhib/OFF lub teeb los ntawm Ubidots huab
NCO TSEG: Txhawm rau txuag tsab ntawv rau hauv nano editor - nias Ctrl+o, lees paub lub npe cov ntaub ntawv kom sau (ubidots_revpi_di.py) thiab nias nkag mus. Txhawm rau kaw nano editor nias Ctrl+x.
5. Tam sim no cia peb sim cov ntawv. Khiav tsab ntawv yav dhau los tsim hauv RevPi davhlau ya nyob twg:
python3 ubidots_revpi_do.py
Thaum tsab ntawv pib khiav, koj yuav pom lub teeb pom xwm txheej cov lus.
6. Tam sim no hloov qhov xwm txheej ntawm "Tswj" widget los ntawm koj lub Ubidots Dashboard thiab pom qhov xwm txheej ntawm RevPI DIO cov zis.
Kauj Ruam 8: Cov txiaj ntsig
Tsuas yog ob peb feeb koj tau koom ua ke RevPi Core + RevPi DIO nrog Ubidots, tau txais cov ntaub ntawv los ntawm koj cov kab xa khoom rau suav suav, tsim daim ntawv thov los taug qab thiab ceeb toom koj txog kev tsim khoom, thiab tswj lub teeb ntawm koj lub Hoobkas pem teb - tag nrho los ntawm kev siv RevPi Core + DIO nrog Ubidots. Txhawm rau kawm paub ntau ntxiv lossis nthuav tawm Cov Txheej Txheem Kev Lag Luam tshiab rau kev tshuaj xyuas lossis tswj hwm, txheeb xyuas tag nrho cov npe ntawm RevPi nthuav dav cov qauv.
Pom zoo:
Txuas Koj RevPi Core rau Ubidots: 5 Kauj Ruam
Txuas Koj RevPi Core rau Ubidots: Revolution Pi yog qhib, hloov kho, thiab ua haujlwm ruaj khov PC raws li tsim Raspberry Pi thaum ua tau raws li EN61131-2 tus qauv. Nruab nrog Raspberry Pi Compute Module, RevPi Core lub hauv paus tuaj yeem nthuav dav txuas ntxiv siv qhov tsim nyog