Cov txheej txheem:

Raspberry Pi Kub Logger: 8 Kauj Ruam
Raspberry Pi Kub Logger: 8 Kauj Ruam

Video: Raspberry Pi Kub Logger: 8 Kauj Ruam

Video: Raspberry Pi Kub Logger: 8 Kauj Ruam
Video: Мало кто знает, но Бланка ветеран войны бесконечности 🦸🏻‍♀️ | Бланка и Рома | Shaykin #юмор #шортс 2024, Kaum ib hlis
Anonim
Raspberry Pi Kub Logger
Raspberry Pi Kub Logger

Nov yog cov lus qhia txhawm rau txhim kho qhov ntsuas kub yooj yim siv tus nqi $ 5.00 I2C ntsuas kub. Cov ntaub ntawv khaws cia rau hauv SD daim npav thiab tuaj yeem yooj yim nkag mus rau hauv kev ua tau zoo. Yooj yim los ntawm kev hloov lossis ntxiv lwm yam kev ntsuas lwm hom ntaub ntawv kuj tseem tuaj yeem sau tau. Cov khoom siv hauv qab no tau siv rau txoj haujlwm no: Raspberry Pi (tib lub tshuab computer) Kub Sensor (SF-SEN-11931)

Solderless Breadboard Hookup Wires Zagros Raspberry Pi 2 cov khoom siv pib tseem suav nrog txhua yam xav tau rau txoj haujlwm no tshwj tsis yog ntsuas kub!

Kauj Ruam 1: Txhim Kho Qhov Kub Kub Sensor

Hlau Tshaj Qhov Kub Kub Sensor
Hlau Tshaj Qhov Kub Kub Sensor

Ua ntej tshaj, cov kab laug sab laug los yog cov xov hlau txuas rau lub sensor. Peb siv lub taub hau yog li nws yuav tuaj yeem yooj yim ntsaws lub sensor rau hauv lub khob cij.

Ua cov kev txuas hauv qab no mus rau Raspberry Pi GPIO chaw nres nkoj. Qhov txuas ADD0 rau hauv av txiav txim siab lub cuab yeej I2C chaw nyob. Ntau tshaj ib lub cim tuaj yeem txuas nrog I2C npav, tab sis lawv txhua tus yuav tsum muaj qhov chaw nyob tshwj xeeb. Sensor RPi GPIO VCC +3.3V SDA SDA SCL SCND GND GND ADD0 GND (nco qhov no teev I2C chaw nyob ntaus ntawv) ALT N/C NCO NTSOOV: Tsis txhob txuas lub VCC mus rau +5VDC, qhov no yuav ua rau lub tsev puas tsuaj

Kauj Ruam 2: Pab I2C Bus

Pab kom lub npav I2C
Pab kom lub npav I2C

*** Cov ntawv tshiab yuav tsis xav tau cov theem no. Yog tias cov ntaub ntawv tsis muaj, txav mus rau theem tom ntej.

Ua ntej lub tsheb npav I2C yuav tsum tau qhib.

Muaj ob txoj hauv kev los pab kom lub npav I2C

Thawj zaug thiab yooj yim tshaj plaws yog ua nws nrog cov khoom siv raspi-teeb tsa.

Siv qhov hais kom ua sudo raspi-teeb tsa los pib ua haujlwm.

Xaiv qhov Advanced Option kom qhib lub npav.

Qhov thib ob, tab sis txoj hauv kev nyuaj dua yog ua nws tus kheej

Txhawm rau ua qhov no, kho cov ntaub ntawv teeb tsa /etc/modprobe.d/raspi-blacklist.conf Siv cov lus txib: sudo nano /etc/modprobe.d/raspi-blacklist.conf Tam sim no hloov cov ntaub ntawv txheem los ntawm:# blacklist spi thiab i2c los ntawm lub neej ntawd (ntau tus neeg siv tsis xav tau lawv) blacklist spi-bcm2708 blacklist i2c-bcm2708 Txog qhov no: # blacklist spi thiab i2c los ntawm lub neej ntawd (ntau tus neeg siv tsis xav tau lawv) blacklist spi-bcm2708 #blacklist i2c-bcm2708

Kauj ruam 3: Hloov kho Config.txt

Hloov kho Config.txt
Hloov kho Config.txt

Khiav cov lus txib hauv qab no los hloov kho config.txt

sudo nano /boot /config.txt

Ntxiv cov kab hauv qab no rau hauv cov ntawv:

dtparam = i2c1 = rau

dtparam = i2c_arm = rau

Kauj Ruam 4: Teem I2C Module kom thauj khoom ntawm khau raj

Teeb I2C Module kom thauj khoom ntawm khau raj
Teeb I2C Module kom thauj khoom ntawm khau raj

I2C tus qauv yuav tsum tau teeb tsa thaum Raspberry Pi pib. Ua qhov no los ntawm kev kho cov ntaub ntawv /etc /modules. Cov lus txib hauv qab no tuaj yeem siv los kho cov ntaub ntawv no: sudo nano /etc /modules Ntxiv kab hauv qab no mus rau qhov kawg ntawm cov ntawv: i2c-bcm2708 i2c-dev

Kauj ruam 5: Nruab I2C Pob

Nruab I2C Pob
Nruab I2C Pob

Nruab i2c-cov cuab yeej thiab sej-smbus pob kom ua tiav I2C teeb tsa: Cov lus txib hauv qab no tuaj yeem siv los teeb tsa pob: sudo apt-tau nruab i2c-cov cuab yeej sudo apt-tau nruab sej-smbus Thaum kawg ntxiv tus neeg siv pi (lossis xijpeem tus ID nkag mus xav tau) rau I2C nkag pab pawg. Cov lus txib hauv qab no tuaj yeem siv los ua kom tiav qhov no: sudo adduser pi i2c Siv cov lus txib hauv qab no kom pom cov cuab yeej txuas nrog I2C npav: i2cdetect -y 1 Nco tseg: siv cov lus txib hauv qab no yog tias koj siv tus qauv A Raspberry Pii2cdetect -y0 I2C chaw nyob (hauv hexadecimal) ntawm qhov ntsuas kub yuav tsum tshwm yog tias txuas tau zoo.

Kauj Ruam 6: Datalogger Program

Datalogger Txoj Haujlwm
Datalogger Txoj Haujlwm

Thauj khoom thiab ua haujlwm piv txwv siv cov lus txib hauv qab no: nab hab sej temp_logger.py Cov piv txwv txoj haujlwm yooj yim heev: Nws nyeem qhov ntsuas kub los ntawm qhov ntsuas kub txhua txhua 60 vib nas this thiab teev nws mus rau cov ntawv sau (Tempdata.txt)

Kauj Ruam 7: Saib Cov Ntaub Ntawv

Saib Cov Ntaub Ntawv
Saib Cov Ntaub Ntawv

Siv cov lus txib hauv qab no los saib cov ntaub ntawv raw: nano tempdata.txt Luam cov ntaub ntawv mus rau USB tsav thiab nws tuaj yeem yooj yim raug xa mus rau hauv Excel:

Kauj Ruam 8: Kev Sau Npe Tom Qab

Log Tom Qab
Log Tom Qab

Txhawm rau khiav lub logger hauv keeb kwm yav dhau (nws yuav ua haujlwm tom qab koj tawm). Siv cov lus txib hauv qab no: sudo python temp_logger.py & (Txoj Kev Txheeb Ze) Muaj cov xwm txheej uas cov lus txib saum toj no tuaj yeem ua yuam kev, xws li Python: qhib tsis tau cov ntaub ntawv 'temp_logger.py': [Errno 2] tsis muaj cov ntaub ntawv ntawd lossis cov npe

Qhov no yooj yim txhais tau tias koj yuav tsum tau siv txoj hauv kev tsis meej, uas txhais tau tias koj yuav tsum qhia qhov chaw ntawm cov ntawv los ntawm cov hauv paus hauv paus. Ib txoj hauv kev yooj yim los ua qhov no yog txhawm rau nyem rau ntawm koj cov ntaub ntawv temp_logger.py, luam txoj hauv kev thiab muab tso rau hauv koj lub davhlau ya nyob twg thiab tom qab ntawd ntaus "nab nab" nyob rau ntawm nws.

Nov yog qhov kuv hais kom ua zoo li cas; nab nab /home/pi/Desktop/temp_logger.py

Pom zoo: