Cov txheej txheem:
- Kauj Ruam 1: BMG160 Txheej Txheem:
- Kauj Ruam 2: Yam Koj Xav Tau..
- Kauj Ruam 3: Khoos Phis Tawj Hookup:
- Kauj Ruam 4: 3-Axis Gyroscope Measurement Siv Java Code:
- Kauj Ruam 5: Cov ntawv thov:
Video: Kev cuam tshuam ntawm 3-Axis Gyroscope Sensor BMG160 Nrog Raspberry Pi: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv lub ntiaj teb niaj hnub no, ntau dua ib nrab ntawm cov tub ntxhais hluas thiab menyuam yaus nyiam ua si thiab txhua tus neeg uas nyiam nws, txaus siab los ntawm cov txuj ci ntawm kev ua si paub qhov tseem ceeb ntawm kev nkag siab zoo hauv qhov no. Peb kuj tseem xav tsis thoob los ntawm tib yam thiab tsuas yog coj nws mus rau ntawm cov laug cam, peb xav txog kev ua haujlwm ntawm lub ntsuas hluav taws xob ntsuas hluav taws xob uas tuaj yeem ntsuas tus nqi ib leeg ntawm ib yam khoom. Yog li, lub ntsuas ntsuas peb tau coj los daws cov haujlwm yog BMG160. BMG160 yog 16-ntsis, digital, triaxial, gyroscope sensor uas tuaj yeem ntsuas tus lej nyob hauv peb chav nyob ib puag ncig.
Hauv qhov kev qhia no, peb yuav los qhia txog kev ua haujlwm ntawm BMG160 nrog Raspberry pi, siv Java ua cov lus programming.
Kho vajtse uas koj yuav xav tau rau lub hom phiaj no yog raws li hauv qab no:
1. BMG160
2. Raspberry Pi
3. I2C Cable
4. I2C Shield rau Raspberry Pi
5. Ethernet Cable
Kauj Ruam 1: BMG160 Txheej Txheem:
Ua ntej tshaj plaws peb xav paub koj nrog cov yam ntxwv tseem ceeb ntawm lub ntsuas qhov ntsuas uas yog BMG160 thiab cov txheej txheem kev sib txuas lus uas nws ua haujlwm.
BMG160 yog qhov tseem ceeb 16-ntsis, digital, triaxial, gyroscope sensor uas tuaj yeem ntsuas tus nqi kaum. Nws muaj peev xwm suav tus lej nyob hauv peb chav nyob ib puag ncig, x-, y- thiab z-axis, thiab muab cov cim teeb tsa sib xws. Nws tuaj yeem sib tham nrog raspberry pi board siv I2C kev sib txuas lus raws tu qauv. Cov qauv tshwj xeeb no tau tsim los kom tau raws li qhov xav tau rau cov neeg siv khoom siv nrog rau lub hom phiaj kev lag luam.
Cov txheej txheem kev sib txuas lus uas lub sensor ua haujlwm yog I2C. I2C sawv cev rau kev sib koom ua ke. Nws yog cov txheej txheem kev sib txuas lus uas kev sib txuas lus tau tshwm sim los ntawm SDA (cov ntaub ntawv xov xwm) thiab SCL (cov xov tooj). Nws tso cai txuas ntau yam khoom siv tib lub sijhawm. Nws yog ib qho ntawm cov txheej txheem kev sib txuas lus yooj yim tshaj plaws thiab muaj txiaj ntsig tshaj plaws.
Kauj Ruam 2: Yam Koj Xav Tau..
Cov ntaub ntawv uas peb xav tau kom ua tiav peb lub hom phiaj suav nrog cov khoom siv hauv qab no:
1. BMG160
2. Raspberry Pi
3. I2C Cable
4. I2C Shield Rau Raspberry Pi
5. Ethernet Cable
Kauj Ruam 3: Khoos Phis Tawj Hookup:
Tshooj khoos phis tawj sib txuas ntu piav qhia qhov txuas txuas uas xav tau ntawm lub ntsuas cua thiab raspberry pi. Ua kom muaj kev sib txuas raug yog qhov tseem ceeb xav tau thaum ua haujlwm ntawm ib qho system rau qhov xav tau cov zis. Yog li, qhov xav tau kev sib txuas yog raws li hauv qab no:
BMG160 yuav ua haujlwm dhau I2C. Nov yog qhov piv txwv kab hluav taws xob daim duab, qhia txog yuav ua li cas xaim txhua lub interface ntawm lub sensor.
Tawm-ntawm-lub thawv, lub rooj tsavxwm tau teeb tsa rau I2C interface, zoo li peb pom zoo siv qhov kev sib txuas no yog tias koj tsis ntseeg lwm yam. Txhua yam koj xav tau yog plaub lub xov hlau!
Tsuas yog plaub qhov kev sib txuas xav tau Vcc, Gnd, SCL thiab SDA tus pin thiab cov no txuas nrog kev pab ntawm I2C cable.
Cov kev sib txuas no tau qhia hauv cov duab saum toj no.
Kauj Ruam 4: 3-Axis Gyroscope Measurement Siv Java Code:
Qhov zoo ntawm kev siv raspberry pi yog, uas yog muab rau koj qhov kev hloov pauv ntawm cov lus programming uas koj xav tau los teeb tsa lub rooj tsav xwm txhawm rau txhawm rau cuam tshuam lub sensor nrog nws. Kev siv cov txiaj ntsig zoo ntawm pawg thawj coj no, peb tab tom qhia ntawm no nws txoj haujlwm hauv Java. Java code rau BMG160 tuaj yeem rub tawm los ntawm peb lub zej zog github uas yog Dcube Store Community.
Ntxiv rau qhov yooj yim ntawm cov neeg siv, peb tab tom piav qhia cov cai ntawm no ib yam nkaus: Raws li thawj kauj ruam ntawm kev coding koj yuav tsum rub tawm lub tsev qiv ntawv pi4j thaum java, vim hais tias lub tsev qiv ntawv no txhawb nqa cov haujlwm siv hauv txoj cai. Yog li, txhawm rau rub lub tsev qiv ntawv koj tuaj yeem mus ntsib qhov txuas hauv qab no:
pi4j.com/install.html
Koj tuaj yeem luam qhov ua haujlwm java code rau lub ntsuas no los ntawm no kuj:
ntshuam com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice;
ntshuam com.pi4j.io.i2c. I2CFactory;
ntshuam java.io. IOException;
pej xeem chav BMG160
{
pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua args ) cuam tshuam zam
{
// Tsim I2C npav
I2CBus tsheb npav = I2CFactory.getInstance (I2CBus. BUS_1);
// Tau txais I2C ntaus ntawv, BMG160 I2C chaw nyob yog 0x68 (104)
I2CDevice ntaus ntawv = bus.getDevice (0x68);
// Xaiv thaj tsam sau npe
// Kho qhov ntsuas ntau, 2000 dps
device.write (0x0F, (byte) 0x80);
// Xaiv bandwidth rau npe
// Bandwidth 200 Hz
device.write (0x10, (byte) 0x04);
Xov.sleep (500);
// Nyeem 6 bytes ntawm cov ntaub ntawv
// xGyro lsb, xGyro msb, yGyro lsb, yGyro msb, zGyro lsb, zGyro msb
byte cov ntaub ntawv = tshiab byte [6];
device.read (0x02, cov ntaub ntawv, 0, 6);
// Hloov cov ntaub ntawv
int xGyro = ((data [1] & 0xFF) * 256 + (data [0] & 0xFF));
yog (xGyro> 32767)
{
xGyro -= 65536;
}
int yGyro = ((cov ntaub ntawv [3] & 0xFF) * 256 + (data [2] & 0xFF));
yog (yGyro> 32767)
{
yGyro -= 65536;
}
int zGyro = ((cov ntaub ntawv [5] & 0xFF) * 256 + (cov ntaub ntawv [4] & 0xFF));
yog (zGyro> 32767)
{
zGyro -= 65536;
}
// Cov ntaub ntawv tso tawm rau lub vijtsam
System.out.printf ("X-Axis ntawm kev sib hloov: %d %n", xGyro);
System.out.printf ("Y-axis ntawm kev sib hloov: %d %n", yGyro);
System.out.printf ("Z-axis ntawm kev sib hloov: %d %n", zGyro);
}
}
Lub tsev qiv ntawv uas txhawb nqa i2c kev sib txuas lus ntawm lub sensor thiab pawg thawj coj yog pi4j, nws ntau pob khoom I2CBus, I2CDevice thiab I2CFactory pab tsim kom muaj kev sib txuas.
ntshuam com.pi4j.io.i2c. I2CBus; ntshuam com.pi4j.io.i2c. I2CDevice; ntshuam com.pi4j.io.i2c. I2CFactory; ntshuam java.io. IOException;
Ib feem ntawm txoj cai no ua rau lub ntsuas ntsuas ntsuas tus lej los ntawm kev sau cov lus txib tshwj xeeb uas siv sau () ua haujlwm thiab tom qab ntawd cov ntaub ntawv raug nyeem siv siv nyeem () ua haujlwm.
// Xaiv ntau yam rau npe // Kho kom raug ntau qhov ntau, 2000 dps device.write (0x0F, (byte) 0x80); // Xaiv bandwidth register // Bandwidth 200 Hz device.write (0x10, (byte) 0x04); Xov.sleep (500);
// Nyeem 6 bytes ntawm cov ntaub ntawv
// xGyro lsb, xGyro msb, yGyro lsb, yGyro msb, zGyro lsb, zGyro msb byte cov ntaub ntawv = tshiab byte [6]; device.read (0x02, cov ntaub ntawv, 0, 6);
Cov ntaub ntawv tau txais los ntawm lub ntsuas hluav taws xob tau hloov pauv mus rau qhov tsim nyog siv los ntawm kev siv cov hauv qab no:
int xGyro = ((cov ntaub ntawv [1] & 0xFF) * 256 + (data [0] & 0xFF)); yog (xGyro> 32767) {xGyro -= 65536; } int yGyro = ((cov ntaub ntawv [3] & 0xFF) * 256 + (data [2] & 0xFF)); yog (yGyro> 32767) {yGyro -= 65536; } int zGyro = ((data [5] & 0xFF) * 256 + (data [4] & 0xFF)); yog (zGyro> 32767) {zGyro -= 65536; }
Cov zis tau luam tawm siv System.out.println () ua haujlwm, hauv cov qauv hauv qab no.
System.out.println ("X-Axis ntawm Kev Hloov: %d %n", xGyro); System.out.println ("Y-axis ntawm Kev Hloov: %d %n", yGyro); System.out.println ("Z-axis ntawm Kev Sib Hloov: %d %n", zGyro);
Qhov tso tawm ntawm lub ntsuas hluav taws xob tau qhia hauv daim duab saum toj no.
Kauj Ruam 5: Cov ntawv thov:
BMG160 muaj ntau qhov kev thov hauv cov khoom siv xws li xov tooj ntawm tes, tib neeg siv tshuab sib txuas. Qhov ntsuas qhov ntsuas no tau tsim los kom tau raws li qhov xav tau rau cov neeg siv khoom siv xws li kev ruaj ntseg duab (DSC thiab lub koob yees duab-xov tooj), kev ua si thiab taw tes. Nws kuj tseem ua haujlwm hauv cov kab ke uas xav tau kev paub piav tes piav taw thiab cov kab ke siv hauv kev qhia sab hauv tsev.
Pom zoo:
Nagging Neeg Hlau ® - Kev cuam tshuam ntawm Kev Ceev Ntawm Lub Neej: 7 Kauj Ruam (nrog Duab)
Nagging Neeg Hlau ® | Kev cuam tshuam ntawm Kev Ceev Ntawm Lub Neej: Txoj hauv kev yooj yim tshaj plaws kom paub tseeb tias koj npau taws txhua hnub. Nagging Robot® muaj qhov kev daws teeb meem. Nagging Robot® Annooy® 900The Annooy® 900 tau ua tib zoo xeeb nrog kev txiav txim siab thev naus laus zis DIY los ua rau tib neeg ntxhov siab. los ntawm Daniel Locatelli thiab TzuYing Chen Ntau lub zog
Kev cuam tshuam kev nkag siab, SPS-30, Particulate Matter Sensor Nrog Arduino Duemilanove Siv I2C Hom: 5 Kauj Ruam
Kev cuam tshuam txog kev nkag siab, SPS-30, Particulate Matter Sensor Nrog Arduino Duemilanove Siv I2C Hom: Thaum kuv tab tom saib mus rau cuam tshuam SPS30 sensors, Kuv pom tau tias feem ntau qhov chaw yog rau Raspberry Pi tab sis tsis ntau rau Arduino. Kuv siv sijhawm me ntsis los ua lub sensor ua haujlwm nrog Arduino thiab kuv txiav txim siab tshaj tawm kuv qhov kev paub ntawm no kom nws tuaj yeem
Arduino cuam tshuam nrog Ultrasonic Sensor thiab Kev Sib Txuas Kub Kub Sensor: 8 Kauj Ruam
Arduino cuam tshuam nrog Ultrasonic Sensor thiab Kev Sib Ntsib Kub Kub Sensor: Niaj hnub no, Cov Tsim, Cov tsim tawm xav tau Arduino rau kev txhim kho sai ntawm cov qauv ntawm cov phiaj xwm. Arduino yog lub platform siv hluav taws xob qhib raws qhov yooj yim-rau-siv-kho vajtse thiab software. Arduino muaj zej zog neeg siv zoo heev. Hauv qhov haujlwm no
Kev cuam tshuam ib qho Arduino nrog Lub Xov Tooj Ntawm Tes: 6 Cov Kauj Ruam (nrog Duab)
Kev cuam tshuam ib qho Arduino Nrog Lub Xov Tooj: Thaum siv Arduino, nws yuav ua rau muaj kev thab plaub heev uas tsis tuaj yeem siv nws tsuas yog vim tias koj tsis muaj lub khoos phis tawj muaj. Tej zaum Windows lossis Mac OS tsis sib xws, koj tsis muaj lub khoos phis tawj tag nrho lossis koj tsuas yog xav tau kev ywj pheej ntau ntxiv rau
Tus Cuam Tshuam Cuam Tshuam (ntsuas phoo Cam Cuam Tshuam Cuam Tshuam): 4 Cov Kauj Ruam
Solder Saver (txhav tas Cam Cuam Tshuam Cuam Tshuam): "Yuav ua li cas kuv thiaj yuav tsum qhia ua ntej Cov Lus Qhia no?" Kuv nug kuv tus kheej. Zoo li, txij li thaum pib ntawm lub sijhawm, tus txiv neej muaj qhov xav kom lo lo rau hauv tus cwj mem thiab tshaj tawm cov duab online. Zoo, Kuv tau txiav txim siab luv luv delving rau hauv keeb kwm loj dua ntawm tus cwj mem yaj, b