Cov txheej txheem:

Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots: 9 Cov Kauj Ruam
Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots: 9 Cov Kauj Ruam

Video: Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots: 9 Cov Kauj Ruam

Video: Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots: 9 Cov Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots
Kuaj Koj Internet Ceev Siv Raspberry Pi + Ubidots

Raspberry Pi tau dhau los ua cov cuab yeej siv dav siv tsis yog rau kev tsim qauv thiab lub hom phiaj kev kawm, tab sis kuj yog rau kev tsim khoom lag luam hauv cov lag luam.

Dhau li Pi qhov loj me, tus nqi qis, thiab ua haujlwm tau zoo Linux OS, nws tseem tuaj yeem cuam tshuam nrog lwm yam khoom siv los ntawm GPIO pins (Cov Hom Phiaj Dav Dav Nkag/Ourput Pins) tso cai rau koj ua kom zoo siv cov cuab yeej khoos phis tawj tsis tas yuav yog tus kws tshaj lij hauv cov khoom siv hluav taws xob.

Ua raws kab ntawv no koj yuav kawm paub ntsuas koj li internet nrawm siv Raspberry Pi thiab xa qhov ntsuas mus rau Ubidots huab los tsim kev ceeb toom rau kev saib xyuas koj li internet txuas txhua hnub!

Kauj ruam 1: Yuav tsum tau ua

Txhawm rau ua kom tiav qhov kev qhia no, koj yuav xav tau:

  • Raspberry Pi txuas nrog Is Taws Nem
  • Ubidots tus account - lossis - STEM License

Kauj ruam 2: Teeb

Phau ntawv qhia no xav tias koj li Raspberry Pi tau teeb tsa thiab twb txuas nrog Is Taws Nem lawm. Yog tias tsis teeb tsa koj tuaj yeem ua sai sai siv phau ntawv qhia pib sai no los ntawm Raspberry Pi Foundation.

NCO TSEG: Yog tias koj siv WiFi dongle, peb hais qhia siv Wicd los tswj koj li kev txuas WiFi.

Kauj Ruam 3: Txuas NanoPi rau Ubidots Siv Python

Txuas NanoPi rau Ubidots Siv Python
Txuas NanoPi rau Ubidots Siv Python

Nrog koj Raspberry Pi txuas nrog internet, txheeb xyuas tus IP chaw nyob uas tau muab rau pawg thawj coj saib xyuas siv ssh hauv koj lub khoos phis tawj davhlau ya nyob twg:

ssh pi@{IP_Address_assigned}

Tus neeg siv lub npe: piPassword: raspberry

Raws li koj tuaj yeem pom cov duab saum toj no, koj nkag mus tau zoo, thiab tus neeg siv tam sim no yog pi@raspberrypi.

Tam sim no cia hloov kho qee pob khoom thiab teeb tsa pip, Python tus thawj tswj hwm pob ntawv:

sudo apt-tau hloov tshiab> sudo apt-tau hloov tshiab

sudo apt-tau nruab python-pip sej-dev tsim-qhov tseem ceeb

Nruab ib lub tsev qiv ntawv hauv qab no:

  • thov: kom ua HTTP thov los ntawm Python rau Ubidots
  • pyspeedtest: txhawm rau ntsuas Internet nrawm los ntawm Python

pip teeb tsa thov pyspeedtest

Cov Lus Qhia Pro: Cov Lus Nug thiab Cov Teeb Meem Teeb Meem - Yog tias koj tau txais kev tso cai teeb tsa thaum txhim kho pob khoom xav tau, hloov tus neeg siv hom rau hauv paus siv cov lus txib hauv qab no:

sudo ua

Kauj ruam 4: Tam sim no Nws yog Lub Sijhawm rau Code

Tam sim no Nws yog Lub Sijhawm rau Code!
Tam sim no Nws yog Lub Sijhawm rau Code!
Tam sim no Nws yog Lub Sijhawm rau Code!
Tam sim no Nws yog Lub Sijhawm rau Code!

Tsim cov ntawv Python hauv koj lub computer lub davhlau ya nyob twg:

nano ubi_speed_tester.py

Thiab theej cov cai muab hauv kab lus no. Nco ntsoov hloov koj tus lej Ubidots tus lej cim hauv qhov thov URL. Yog tias koj tsis paub yuav ua li cas kom tau txais koj li Ubidots Token, thov saib kab lus hauv qab no:

Nrhiav koj TOKEN los ntawm koj tus lej Ubidots

Tam sim no cia peb sim cov ntawv:

python ubi_speed_tester.py

Yog ua haujlwm tau zoo koj yuav pom lub cuab yeej tshiab hauv koj tus lej Ubidots nrog peb qhov hloov pauv: Rub tawm, Upload, thiab Ping.

Kauj Ruam 5: Yeem Cov Kauj Ruam: Hloov Npe Cov Ntaus thiab Cov Hloov

Yeem Cov Kauj Ruam: Hloov Npe Cov Ntaus thiab Cov Hloov
Yeem Cov Kauj Ruam: Hloov Npe Cov Ntaus thiab Cov Hloov

Cov npe ntawm cov kev hloov pauv tau tsim yog zoo ib yam li cov ntawv API, uas yog IDs siv los ntawm API. Qhov no tsis txhais tau tias lawv lub npe tsis tuaj yeem hloov pauv, yog li kuv pom zoo hloov cov npe ntawm cov cuab yeej thiab cov hloov pauv kom lawv ua phooj ywg. Txhawm rau paub yuav hloov pauv koj lub npe hloov pauv li cas, saib kab lus hauv qab no:

Yuav hloov kho Lub Npe Lub Npe thiab lub npe hloov pauv li cas

Koj tseem tuaj yeem ntxiv cov chav nyob rau txhua qhov sib txawv.

Kauj Ruam 6: Tsim Crontab los Sau Tsab Ntawv Txhua N Nthuav Tawm

Tsim Crontab kom khiav Tsab Ntawv Txhua N Nthuav Tawm
Tsim Crontab kom khiav Tsab Ntawv Txhua N Nthuav Tawm

Tam sim no uas peb tau sim tsab ntawv, peb tuaj yeem teeb tsa nws kom ua haujlwm tau txhua txhua N feeb. Rau lub hom phiaj no peb yuav siv Linux Cron cov cuab yeej rau kev ua haujlwm tau zoo.

1.- Ua cov ntaub ntawv ua tiav hauv koj lub computer lub davhlau ya nyob twg:

chmod a+x ubi_speed_tester.py

2.- Tsim kom muaj crontab:

Rau qee qhov laj thawj, qhov hais kom ua "crontab -e" tsis ua haujlwm ntawm lub npov, yog li kev ua haujlwm ib puag ncig yog teeb tsa cron manually nrog cov lus txib hauv qab no:

sudo apt-tau nruab cron

ces ntaus:

crontab -e

thiab ntxiv kab:

* * * * * nab hab sej /home/pi/ubi_speed_tester.py

khiav tsab ntawv txhua feeb.

3- Rov pib dua thiab Tshawb xyuas koj cov ntaub ntawv hauv Ubidots

Txhawm rau rov pib dua Raspberry Pi koj yuav tsum siv ua hauv paus, rau hom no:

sudo ua

Tom qab ntawd, ntaus cov lus txib hauv qab no kom rov pib dua Raspberry Pi:> rov pib dua

Tos ib pliag thiab tom qab ntawd mus rau Ubidots kom pib pom cov txiaj ntsig hloov tshiab txhua feeb

Kauj Ruam 7: Ubidots Dashboard

Ubidots Dashboard
Ubidots Dashboard

Tam sim no koj cov ntaub ntawv nyob hauv Ubidots, koj tuaj yeem tsim dashboards thiab cov xwm txheej siv koj cov ntaub ntawv. Nov yog ib qho piv txwv:

Bar daim ntawv widget

Txhawm rau pom ntau ntxiv txog Ubidots Dashboards, saib Chaw Pabcuam.

Kauj Ruam 8: Kev ceeb toom ntawm qeeb/tsis muaj Is Taws Nem

Kev ceeb toom ntawm qeeb/tsis muaj Is Taws Nem
Kev ceeb toom ntawm qeeb/tsis muaj Is Taws Nem
Kev ceeb toom ntawm qeeb/tsis muaj Is Taws Nem
Kev ceeb toom ntawm qeeb/tsis muaj Is Taws Nem

Txhawm rau saib xyuas koj li internet nrawm thaum nyob deb, peb tau ntxiv qee qhov xwm txheej los ceeb toom rau tus neeg siv: yog Is Taws Nem qeeb lossis lossis yog tias tsis muaj Internet.

  • Tus Txheej Txheem Raws Li Tus Nqi (Internet qeeb)
  • Kev Ua Haujlwm Raws Li Txheej Txheem (Internet tsis ua haujlwm)

Txhawm rau pom ntau ntxiv txog Ubidots Cov Txheej Txheem, txheeb xyuas kab lus Pabcuam no kom paub meej ntxiv.

Kauj Ruam 9: Xaus

Kuv tsuas yog ob peb feeb koj tau tsim qhov yooj yim DIY Internet Speed Tester. Tam sim no muab koj Raspberry Pi tso rau hauv qhov chaw nyab xeeb tom qab koj lub router thiab tsis txhob xav tias koj li Internet nrawm dua.

Zoo siab hacking:)

Pom zoo: