Cov txheej txheem:

Bandwidth Monitor: 7 Cov Kauj Ruam (nrog Duab)
Bandwidth Monitor: 7 Cov Kauj Ruam (nrog Duab)

Video: Bandwidth Monitor: 7 Cov Kauj Ruam (nrog Duab)

Video: Bandwidth Monitor: 7 Cov Kauj Ruam (nrog Duab)
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Kaum ib hlis
Anonim
Bandwidth Saib
Bandwidth Saib
Bandwidth Saib
Bandwidth Saib
Bandwidth Saib
Bandwidth Saib

Raws li kuv tau nug kuv tus kheej ntau npaum li cas tam sim no tau muab los ntawm kuv ISP (Kuv siv LTE modem rau kev txuas Is Taws Nem), Kuv xav txog qhov ntsuas kab ke bandwidth. Txij li lub kaw lus yuav tsum ua kom me me thiab txuag hluav taws xob, Kuv tau xaiv Raspberry Pi Zero ua lub hauv paus tseem ceeb. Raspberry txuas nrog lub modem ntawm WLAN, yog li WLAN teeb meem tuaj yeem kuaj pom ib yam.

Khoom siv

  • Raspberry Pi Zero WH
  • Waveshare e-ink zaub (2.9inch-e-paper-module)
  • DC-DC hloov pauv (piv txwv li DEBO DCDC 20W)
  • RGB LED (tshem tawm los ntawm lub cuab yeej qub)
  • Laub-khawm
  • Hloov
  • Relais module (piv txwv li 2 Way Relay module2 Way Relay module)
  • Txiv neej txuas + Poj niam txuas (ob leeg haum qhov loj ntawm koj lub modem fais fab mov ntsaws)
  • Cov ntawv luam tawm 3D

Kauj ruam 1: Nta

Nta
Nta
Nta
Nta
Nta
Nta
  • Raspberry Pi Zero tau txuas nrog ntawm WLAN, ntsuas kev nce thiab rub tawm nrawm thiab ua qhov ntsuas ping txhua ib nrab teev. Ib kab hais kom ua version ntawm speedtest.net tau siv los ua lub hauv paus rau kev ntsuas.
  • Qhov tshwm sim ntawm kev ntsuas bandwidth thiab ping tau qhia ntawm e-ink zaub. Lub sijhawm ntsuas kuj tseem pom.
  • Yog tias qhov rub tawm nrawm poob qis dua tus nqi pib txhais, tus xa tawm hloov lub modem tawm thiab nyob rau lub sijhawm luv. Lub modem yog li rov pib dua yam tsis muaj kev hloov kho ntawm lub cuab yeej (tsuas yog lub zog txuas raug cuam tshuam).
  • Ib lub pob nyob rau pem hauv ntej ntawm lub cuab yeej muaj los txhawm rau ntsuas qhov ntsuas qhov ntsuas tus kheej.
  • Qhov ntsuas ntsuas tau muab tso rau ntawm Ubidots Dashboard (IOT Portal). Hauv cov ntsiab lus koj tseem tuaj yeem pom lub sijhawm keeb kwm ntawm qhov ntsuas ntsuas thiab yog vim li cas rau qhov rov pib dua.
  • Hauv IOT Portal koj tseem tuaj yeem pom lub pob kom rov pib dua lub modem.
  • Bandwidth saib xyuas siv lub hwj chim ntawm tus qauv. Tsis xav tau khoom ntxiv. Cov kev cuam tshuam cuam tshuam kev xa cov xa hluav taws xob mus rau lub modem - raspberry tseem tau hloov pauv.

Kauj ruam 2: Kev thaiv kab

Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv
Thaiv

Hauv thawj daim duab koj tuaj yeem pom tus tsim sab hauv ntawm bandwidth saib:

Cov khoom loj yog:

    1. Laub khawm
    2. E-ink Zaub
    3. Raspberry Pi Zero
    4. Relay Module
    5. RGB LED + Resistors (nyob ntawm RGB LED koj siv)
    6. Hloov
    7. DC-DC Hloov
    8. Poj niam txuas

Daim duab thib ob qhia txog cov txheej txheem ntawm cov thaiv. Tus ncej zoo ntawm cov khoom siv hluav taws xob tau pub los ntawm kev hloov mus rau DC-DC qhov hloov hluav taws xob (uas hloov 12V lub zog hluav taws xob ntawm lub router rau 5V rau Raspberry) thiab ntawm kev xa tawm (ntawm tus lej txuas nrog tus pin) rov qab mus rau cov zis txuas. Yog li cov modem tseem tau muab nrog lub zog thaum qhov ntsuas bandwidth raug kaw.

Qhov ntsuas bandwidth tuaj yeem pib ua haujlwm ntawm lub pob. Ib qho RGB LED tau siv los pom txog ntau lub xeev ua haujlwm.

Qhov kev sib txuas ntawm Raspberry Pi thiab e-ink zaub tsis pom hauv daim duab kos. Txuas cov zaub raws li lub rooj thiab tus pin-tawm saum toj no.

Kauj Ruam 3: Luam Ntawv 3D thiab Tsim Chase

3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa
3D Luam Ntawv thiab Tsim Tsa

Cov hauv qab no xav tau rau rooj plaub (saib daim duab saum toj no):

    1. qis dua
    2. sab saud
    3. pem hauv ntej
    4. rov qab
    5. 4x cog

Txhua ntu tuaj yeem luam tawm yam tsis muaj kev txhawb nqa. Koj kuj tseem tuaj yeem nrhiav cov ntaub ntawv thiab qee qhov ntawm kuv lwm tus qauv ntawm Thingiverse:

Cov zaub tuaj yeem txuas rau ntawm lub vaj huam sib luag pem hauv ntej nrog cov mounts thiab daim kab xev ob npaug. Khawm hloov thiab txuas tus poj niam tau ntsaws rau sab nraub qaum thiab tom qab vaj huam sib luag. Kuv siv 3x20mm ntsia hlau los txuas ob lub tsev nyob ib nrab. Qhov ua siab ntev ntawm qhov zawj rau sab pem hauv ntej thiab nraub qaum yog qhov nruj. Yog tias tsim nyog, cov vaj huam sib luag pem hauv ntej thiab tom qab yuav tsum tau xuab zeb ntawm ntug (sab hauv kom tsis txhob puas qhov chaw).

Kauj Ruam 4: Teeb Kho Raspberry PI

Teeb tsa Raspberry PI
Teeb tsa Raspberry PI
Teeb tsa Raspberry PI
Teeb tsa Raspberry PI

Phau ntawv teeb tsa no yog ua raws kev suav sau ntau cov lus qhia teeb tsa los ntawm ntau qhov chaw (e-Ink zaub manufacturers, …). Rau kuv cov lus qhia tau coj mus rau qhov txiaj ntsig xav tau. Txij li thaum kuv tsis yog Linux tus kws tshaj lij, tsis muaj qhov ua tau zoo lossis zoo ib yam tau ua tiav. Kuv paub tias muaj qhov tseeb zoo dua thiab ua haujlwm tau zoo dua.

Cia peb xav tias koj twb muaj Raspbian teeb tsa ntawm koj Pi (muaj ntau yam qhia paub yuav ua li cas rau nruab qhov haujlwm ua haujlwm yooj yim) thiab koj muaj cov zaub (ntawm miniHDMI), nas thiab keyboard txuas nrog. Kev teeb tsa WLAN txuas mus rau lub router lossis Is Taws Nem yog qhov raug. Tshwj tsis yog tau hais tseg, txhua qhov txheej txheem teeb tsa tau ua hauv lub davhlau ya nyob twg.

Nruab Chaw Taws Teeb (kom nkag tau PI los ntawm koj lub computer):

sudo apt-tau hloov tshiab

sudo apt-tau nruab

nruab xrdp

lossis koj tseem tuaj yeem ua haujlwm tsis tau taub hau ntawm ssh (saib piv txwv li

Hloov Password:

www.raspberrypi.org/forums/viewtopic.php?t=193620

Nruab speedtest:

sudo siv

apt-tau nruab sej-pip

sudo pip nruab speedtest-cli

los sim yog tias kev teeb tsa ua tiav khiav Speedtest hauv lub davhlau ya nyob twg:

speedtest-cli

yog tias txhua yam yog qhov raug koj yuav tsum tau txais qee yam zoo li hauv thawj daim duab saum toj no.

Nruab wiringPI

sudo apt-tau nruab git-core

git clone git: //git.drogon.net/wiringPi

cd kab w

./ tsim

(saib ntxiv

Alternativ:

sudo apt-tau nruab wiringpi

(saib

Nruab BCM2835

(saib

Rub tawm bcm2835-1.60.tar.gz (lossis hloov tshiab dua yog tias muaj)

tar zxvf bcm2835-1.60.tar.gz

cd bcm2835-1.60

./configure

ua

sudo ua daim tshev

sudo ua kom nruab

Nruab ib lub tsev qiv ntawv duab Python

sudo apt-tau nruab nruab sej-duab

Alternativ:

sudo apt-tau nruab python-pil

Pab kom I2C muaj nuj nqi.

Khiav cov lus txib hauv qab no los teeb tsa koj li Raspberry Pi board:

sudo raspi-teeb tsa

Xaiv Cov Txheej Txheem Xaiv-> I2C -> yog, los pib I2C tus tsav tsheb tseem ceeb. Tom qab ntawd koj kuj yuav tsum hloov kho cov ntawv teeb tsa. Khiav cov lus txib hauv qab no los qhib cov ntawv teeb tsa:

sudo nano /thiab /modules

Ntxiv ob kab hauv qab no rau cov ntaub ntawv teeb tsa

i2c-bcm2708

i2c-dev

Saib ntxiv

Pab kom SPI muaj nuj nqi

Khiav cov lus txib hauv qab no los teeb tsa koj li Raspberry Pi board:

sudo raspi-teeb tsa

Xaiv Cov Kev Xaiv Interface-> SPI -> yog, los pib SPI tus tsav tsheb tseem ceeb.

Nruab ib lub fonts ntxiv:

sudo apt-tau nruab ttf-mscorefonts-installer

Rub tawm thiab teeb tsa Fonts (Roboto + Droid)

gksudo ua

pcmanfm

Txhawm rau pib filemanager nrog cov cai hauv paus thiab luam cov ntawv truetype rau hauv nplaub tshev/usr/sib qhia/fonts/truetype

Alternativ:

Luam cov fonts mus rau Downloads nplaub tshev nrog WinSCP (ssh yuav tsum tau qhib kom siv WinSCP)

sudo cp -r/home/pi/Downloads/droid/usr/share/fonts/truetype

sudo cp -r/home/pi/Downloads/roboto/usr/share/fonts/truetype

Koj xav tau cov cai tshwj xeeb kom nkag mus rau daim ntawv tais ceev tseg. Tej zaum muaj txoj hauv kev zoo los ua qhov no (raws li tau hais los saum no Kuv tsis yog Linux tus kws tshaj lij) tab sis ob txoj hauv kev ua haujlwm rau kuv.

Nab hab sej cov ntaub ntawv:

Siv tus filemanger los tsim cov ntawv tshiab "bandwidth_monitor"

Luam tag nrho cov ntaub ntawv rau cov npe bandwidth_monitor

Ua cov ntaub ntawv nab hab sej ua haujlwm tau

chmod +x *.py

chmod +x speedtest-cron.sh

Configure crontab

crontab -e

Crontab yog siv los teem sijhawm rau kev ua haujlwm xws li speedtest txhua 30 feeb. Ntxiv cov kab hauv qab no rau koj lub crontab (saib daim duab thib ob):

@reboot/usr/bin/nab hab sej /home/pi/bandwidth_monitor/post_restart_message.py &

@reboot pw 30 &&/usr/bin/python /home/pi/bandwidth_monitor/poll_test_now_button.py */30 * * * * /home/pi/bandwidth_monitor/speedtest-cron.sh */3 * * * */usr/ bin/nab hab sej /home/pi/bandwidth_monitor/poll_killswitch.py 13 03 * * */usr/bin/nab hab sej /home/pi/bandwidth_monitor/refresh_display.py

Kev piav qhia ntawm cov haujlwm uas tau teem tseg:

  • thaum rov pib dua cov lus rov pib sau rau IOT dashboard
  • ntawm reboot qhov kev ntsuam xyuas kev ntsuam xyuas_now_button tau pib
  • txhua 30 feeb qhov ntsuas ntsuas qhov ntsuas tau ua tiav
  • txhua txhua 3 feeb qhov xwm txheej ntawm khawm rov pib dua (ntawm IOT dashboard) raug tshuaj xyuas
  • ib zaug ib hnub ib qho kev hloov kho tshiab tau pib.

Saib ntu software rau kev piav qhia luv ntawm cov haujlwm.

Kauj ruam 5: Software

Software
Software

Lub software tau faib ua ob peb cov ntaub ntawv / cov haujlwm:

bandwidth_monitor_0_4.py yog qhov haujlwm tseem ceeb uas tau thov los ntawm Crontab txhua txhua ib nrab teev. Nws ua qhov ntsuas bandwidth (ntawm kab lus hais kom ua version ntawm speedtest.net). Thaum kuaj, RGB LED yog xiav. Yog tias qhov bandwidth siab dua qhov xaiv tau pib, tus nqi tau qhia ntawm e-ink zaub (nrog rau lub sijhawm) thiab xa tawm mus rau Ubidots dashboard. Yog tias qhov bandwidth qis dua qhov pib LED tig liab thiab ntsuas rov ua dua tom qab ncua sijhawm luv. Tom qab 3 qhov kev sim tsis zoo qhov kev xa tawm tau qhib thiab yog li lub zog hluav taws xob ntawm lub modem raug cuam tshuam. Pib dua txoj cai (tus nqi = 2) tau sau rau ntu ntu.

poll_killswitch.py nyeem cov xwm txheej ntawm boolean sib txawv ntawm lub dashboard. Yog tias killswitch_state muaj tseeb qhov relais tau qhib lub zog hluav taws xob ntawm lub modem raug cuam tshuam. RGB LED hloov ntsuab thaum lub sij hawm pov npav ntawm tus tua. Tom qab rov pib dua killswitch_state tau teeb tsa cuav thiab nkag mus rau ntu ntu ntawm lub dashboard tau tsim (tus nqi = 1).

poll_test_now_button.py tab tom tos lub pob nyem ntawm lub vaj huam sib luag pem hauv ntej ntawm rooj plaub kom raug nias. Los ntawm kev qhib lub pob, ntsuas ntsuas bandwidth tau ua rau tus kheej. Thaum qhov haujlwm pib (ntawm kev rov pib dua ntawm Raspberry Pi) RGB LED tab tom ntsais liab.

post_restart_message.py sau qhov pib dua tus lej (tus nqi = 3) rau ntu ntu ntawm lub dashboard. Qhov no qhia tias bandwidth saib tau rov pib dua. Thaum lub sijhawm pib ua haujlwm RGB LED teeb ci xiav.

test_LED.py thiab test_relay.py yog cov ntawv yooj yim uas tuaj yeem siv los ntsuas qhov ua haujlwm ntawm RGB LED thiab kev xa tawm.

epdconfig.py thiab epd2in9.py yog cov cuab yeej tsav tsheb rau e-ink zaub muab los ntawm Waveshare.

Txhawm rau tso cai rau cov haujlwm kom nkag mus rau Ubidots dashboard, koj yuav tsum ntxiv koj tus kheej tokens thiab cov cuab yeej lossis cov npe sib txawv (yog tias koj siv cov cim sib txawv). Tshawb nrhiav ntu zoo li qhov pom hauv daim duab saum toj no (hloov XXXXXXXX los ntawm koj tus cim).

Cov ntawv qhia ntxaws ntxaws txog yuav tsim lub dashboard thiab yuav ua li cas sib xyaw lub dashboard rau hauv Python program tuaj yeem pom ncaj qha ntawm Ubidots nplooj ntawv (https://help.ubidots.com/en/) lossis ntawm Google.

Kauj Ruam 6: IOT Dashboard

IOT Dashboard
IOT Dashboard

Lub dashboard tuav los ntawm Ubidots (saib https://ubidots.com) muaj ntau qhov chaw uas tau piav qhia luv luv hauv qab no.

    1. Sijhawm ntu ntawm nce- thiab rub tawm nrawm. Txhua ib nrab teev tus nqi tshiab raug ntxig rau hauv daim duab.
    2. Lub sijhawm kawm ntawm lub sijhawm ntsuas ping. Txhua ib nrab teev tus nqi tshiab tau ntxig rau hauv daim duab.
    3. Lub sijhawm ua ntu zus ntawm qhov nruab nrab rub tawm nrawm. Tus nqi nruab nrab tshaj 24 teev yog xam thiab sau rau daim duab.
    4. Spreadsheet sawv cev ntawm qhov ntsuas tam sim no suav nrog lub sijhawm thwj cim.
    5. Cov chaw taws teeb tswj kom rov pib dua lub modem ntawm Is Taws Nem. Kev nug tshwm sim txhua 3 feeb, piv txwv li nws yuav siv qee lub sijhawm kom txog thaum qhov kev ua tiav tiav.
    6. Nkag ntawm qhov rov pib dua suav nrog qhov laj thawj rau kev rov pib dua (ua rau thaj chaw deb, hloov tawm lossis poob qhov hluav taws xob, poob qis dua qhov tsawg kawg bandwidth)

Cov lus qhia ntxaws ntxaws txog yuav tsim lub dashboard thiab yuav ua li cas sib xyaw lub dashboard rau hauv Python program tuaj yeem pom ncaj qha ntawm Ubidots nplooj ntawv (https://help.ubidots.com/en/) lossis ntawm Google.

Pom zoo: