Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Kev Kho Vajtse Txuas
- Kauj ruam 2: Pab kom I2C Interface
- Kauj Ruam 3: Nruab Adafruit Python Library rau OLED Display Module
- Kauj ruam 4: System Saib Python Script
- Kauj ruam 5: Khiav Stats.py ntawm Startup
Video: Raspberry Pi Monitoring System Via OLED Display Module: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv qhov kev qhia no kuv yuav piav qhia yuav teeb tsa 0.96 nti OLED zaub module rau qhia cov ntaub ntawv txheej txheem ntawm Raspberry Pi 4 Model B siv nws I2C interface.
Khoom siv
Yuav tsum tau kho vajtse:
- Raspberry Pi 4 Qauv B.
- 128 × 64 OLED zaub module (SSD1306)
- Txuas Txuas
Kauj Ruam 1: Kev Kho Vajtse Txuas
Hauv qab no yog kev sib txuas ntawm OLED module nrog Raspberry Pi 4 Qauv B:
- SDA ==> GPIO 2 (tus pin 3)
- SCL ==> GPIO 3 (tus pin 5)
- VCC ==> 3.3V (tus pin 1)
- GND ==> GND (pin 14)
Kauj ruam 2: Pab kom I2C Interface
I2C interface yog neeg xiam oob khab yog li koj xav tau los pab nws. Koj tuaj yeem ua qhov no hauv cov cuab yeej raspi-teeb tsa ntawm kab hais kom ua los ntawm kev khiav:
sudo raspi-teeb tsa
- Ib qho screen xiav yuav tshwm. Tam sim no xaiv qhov kev xaiv cuam tshuam.
- Tom qab qhov no, peb yuav tsum xaiv I2C xaiv.
- Tom qab qhov no, peb yuav tsum xaiv Yog thiab nias nkag mus thiab tom qab ntawd ua tiav.
- Tom qab qhov no, peb yuav tsum tau rov pib dua Raspberry Pi los ntawm kev ntaus hauv qab cov lus txib:
sudo rov pib dua
Cov tsev qiv ntawv hauv qab no tej zaum yuav raug teeb tsa tab sis khiav cov lus txib no ib qho kom ntseeg tau tias:
sudo apt-tau nruab python-smbus
sudo apt-tau nruab i2c-cuab yeej
Txhawm rau nrhiav cov npe khoom siv txuas nrog I2C npav ntawm Raspberry Pi koj tuaj yeem siv cov lus txib hauv qab no:
sudo i2cdetect -y 1
Ntawm cov laus Raspberry Pi ntaus cov lus txib hauv qab no:
sudo i2cdetect -y 0
Nov yog qhov tso tawm kuv pom ntawm kuv Raspberry Pi 4 Qauv B:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: - - - - - - - - - - - -3c - - -
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Nws tau qhia tias lub cuab yeej tau kuaj pom nrog qhov chaw nyob ntawm 0x3c. Nov yog qhov chaw nyob hex tsis zoo rau hom cuab yeej no.
Kauj Ruam 3: Nruab Adafruit Python Library rau OLED Display Module
Txhawm rau teeb tsa lub tsev qiv ntawv peb yuav clone Adafruit git chaw cia khoom.
git clone
Thaum ua tiav mus rau lub tsev qiv ntawv cov npe:
cd Adafruit_Python_SSD1306
thiab teeb tsa lub tsev qiv ntawv rau Python 2:
sudo python setup.py nruab
lossis rau Python 3:
sudo python3 setup.py nruab
Kauj ruam 4: System Saib Python Script
Nkag mus rau hauv cov piv txwv piv txwv:
cd piv txwv
Hauv daim nplaub tshev no koj yuav tsum pom cov ntawv piv txwv:
stats.py
sej 3 stats.py
Los ntawm lub neej ntawd nws qhia txog kev siv nco, siv disk, CPU thauj khoom thiab tus IP chaw nyob. Tsis tas li, b-ua ntej ntawm txhua kab tuaj yeem pom.
Nws yuav hloov kho me ntsis txhawm rau tshem tawm b-ua ntej thiab ntxiv CPU kub ntawm Raspberry Pi 4 Qauv B ib yam.
cmd = "hostname -I | txiav -d / '\' -f1"
yuav raug hloov los ntawm cov kab hauv qab no:
cmd = "hostname -I | txiav -f 2 -d ''"
Cov cai no zoo meej rau khau raj thaum koj xav nrhiav koj li Raspberry Pi tus IP chaw nyob rau SSH lossis VNC.
Cov kab hauv qab no yuav raug ntxiv los qhia CPU kub ntawm OLED zaub module:
cmd = "vcgencmd ntsuas_temp | txiav -f 2 -d '='"
temp = subprocess.check_output (cmd, plhaub = Tseeb)
Hauv qab cov cai tau hloov kho kom tshem tawm 'b' tus cwj pwm los ntawm OLED zaub.
draw.text ((x, saum), "IP:" + str (IP, 'utf-8'), font = font, sau = 255) kos.text ((x, saum + 8), str (CPU, 'utf-8') + "" + str (temp, 'utf-8'), font = font, fill = 255) kos.text ((x, saum + 16), str (MemUsage, 'utf-8')), font = font, fill = 255) draw.text ((x, top+25), str (Disk, 'utf-8'), font = font, fill = 255)
Thaum kawg, koj yuav tsum pom qee yam zoo ib yam li cov hauv qab no ntawm OLED zaub:
Kauj ruam 5: Khiav Stats.py ntawm Startup
Koj tuaj yeem yooj yim ua nws yog li qhov haujlwm no ua haujlwm txhua lub sijhawm koj khau raj koj Raspberry Pi.
Txoj kev nrawm tshaj plaws thiab yooj yim tshaj plaws yog muab tso rau hauv /etc/rc.local. Khiav cov lus txib hauv qab no ntawm lub davhlau ya nyob twg:
sudo nano /etc/rc.local
Scroll cia, thiab ua ntej tawm kab 0 kab, sau cov hauv qab no:
sudo nab hab sej /home/pi/stats.py &
- Txuag thiab tawm.
- Rov pib dua kom paub tseeb tias lub vijtsam tuaj txog ntawm khau raj!
Pom zoo:
Sau rau OLED Display Via Bluetooth: 6 Kauj Ruam
Sau ntawv mus rau OLED Zaub Via Bluetooth: Txoj haujlwm no tau tshoov siab thiab rov ua dua ntawm Arduino LCD Display Control ntawm BluetoothIntroduction: Hauv txoj haujlwm no, peb yuav ua "Bluetooth OLED." Dab tsi peb tab tom ua hauv qhov tsim qauv no yog txuas Arduino rau OLED thiab Bluetooth modu
ET Smart Baby Monitoring System: 10 Kauj Ruam
ET Smart Baby Monitoring System: ET Smart Baby Monitoring System yog lub kaw lus uas muaj lub hom phiaj txhawm rau ntxiv kev yooj yim rau niam txiv lossis tus saib xyuas saib xyuas menyuam. Kev saib xyuas yuav taug qab tus menyuam qhov kub thiab yog tias dhau mus ib txwm, SMS yuav xa mus rau niam txiv lossis tsheb
Arduino thiab Raspberry Pi Powered Pet Monitoring System: 19 Cov Kauj Ruam (nrog Duab)
Arduino thiab Raspberry Pi Powered Pet Monitoring System: Tsis ntev los no thaum so, peb paub tias tsis muaj kev sib txuas nrog peb tus tsiaj Beagle. Tom qab qee qhov kev tshawb fawb, peb pom cov khoom lag luam uas muaj lub koob yees duab zoo li qub uas tso cai rau ib tus saib xyuas thiab sib tham nrog ib tus tsiaj. Cov kab ke no muaj qee cov txiaj ntsig b
Ua Koj Tus Kheej PH THIAB SALINITY MONITORING SYSTEM Nrog LED Qhia: 4 Kauj Ruam
Ua Koj Tus Kheej PH THIAB SALINITY MONITORING SYSTEM NROG LED INDICATORS: Hauv txoj haujlwm no, peb yuav ua pH thiab salinity/conductivity xyuas nrog cov ntsuas LED. Cov ntsuas pH thiab salinity los ntawm Atlas Scientific tau siv. Kev ua haujlwm yog ntawm I2C raws tu qauv thiab nyeem tau nthuav tawm ntawm Arduino cov ntawv xov xwm
RF Module 433MHZ - Ua Tus Txais thiab Tshaj Tawm Los ntawm 433MHZ RF Module Tsis Muaj Ib Lub Tshuab Hluav Taws Xob: 5 Kauj Ruam
RF Module 433MHZ | Ua Tus Txais thiab Tshaj Tawm Los ntawm 433MHZ RF Module Tsis Muaj Ib Lub Tshuab Hluav Taws Xob: Koj puas xav xa cov ntaub ntawv wireless? yooj yim thiab tsis muaj microcontroller xav tau? Ntawm no peb mus, hauv cov lus qhia no kuv yuav qhia koj li yooj yim rf transmitter thiab tus txais tau npaj los siv! Hauv cov lus qhia no koj yuav tuaj yeem xa thiab tau txais cov ntaub ntawv siv