Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau..
- Kauj Ruam 2: Kev Sib Txuas:
- Kauj ruam 3: Code:
- Kauj Ruam 4: Cov ntawv thov:
Video: Raspberry Pi - MPL3115A2 Precision Altimeter Sensor Java Qhia: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
MPL3115A2 ntiav MEMS lub siab ntsuas nrog I2C interface los muab cov ntaub ntawv Siab/Qhov Siab thiab Kub. Cov txiaj ntsig sensor tau digitized los ntawm kev daws teeb meem siab 24-ntsis ADC. Kev ua haujlwm sab hauv tshem tawm cov haujlwm them nyiaj los ntawm tus tswv tsev MCU. Nws muaj peev xwm txheeb xyuas qhov hloov pauv tsuas yog 0.05 kPa uas sib npaug rau 0.3m hloov pauv qhov siab. Nov yog nws qhov ua piv txwv nrog raspberry pi siv java code.
Kauj Ruam 1: Yam Koj Xav Tau..
1. Raspberry Pi
2. MPL3115A2
3. I²C Cable
4. I²C Shield rau Raspberry Pi
5. Ethernet Cable
Kauj Ruam 2: Kev Sib Txuas:
Siv daim I2C daim thaiv rau raspberry pi thiab maj mam thawb nws hla gpio pins ntawm raspberry pi.
Tom qab ntawd txuas ib qho kawg ntawm I2C cable rau MPL3115A2 sensor thiab lwm qhov kawg rau I2C daim ntaub thaiv.
Kuj txuas Ethernet cable rau pi lossis koj tuaj yeem siv WiFi module.
Kev sib txuas tau qhia hauv daim duab saum toj no.
Kauj ruam 3: Code:
Tus lej java rau MPL3115A2 tuaj yeem rub tawm los ntawm peb qhov chaw cia khoom github- DCUBE Store.
Nov yog qhov txuas rau tib yam:
github.com/DcubeTechVentures/MPL3115A2/tree/master/Java
Peb tau siv pi4j tsev qiv ntawv rau java code, cov kauj ruam rau nruab pi4j ntawm raspberry pi tau piav qhia ntawm no:
pi4j.com/install.html
Koj tseem tuaj yeem luam cov cai los ntawm no, nws tau muab raws li hauv qab no:
// Faib nrog daim ntawv tso cai yuav dawb.
// Siv nws txhua txoj hauv kev uas koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm.
NPE 31115A2
// Cov cai no tau tsim los ua haujlwm nrog MPL3115A2_I2CS I2C Mini Module muaj los ntawm
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 kawm MPL3115A2
{
pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua args ) cuam tshuam zam
{
// Tsim I2C npav
I2CBus Bus = I2CFactory.getInstance (I2CBus. BUS_1);
// Tau txais I2C ntaus ntawv, MPL3115A2 I2C chaw nyob yog 0x60 (96)
I2CDevice ntaus ntawv = Bus.getDevice (0x60);
// Xaiv tswj sau npe
// Hom ua haujlwm, OSR = 128, hom ntsuas ntsuas
device.write (0x26, (byte) 0xB9);
// Xaiv cov ntaub ntawv teeb tsa sau npe
// Cov ntaub ntawv npaj cov xwm txheej tau qhib rau qhov siab, siab, kub
ntaus ntawv.write (0x13, (byte) 0x07);
// Xaiv tswj sau npe
// Hom ua haujlwm, OSR = 128, hom ntsuas ntsuas
device.write (0x26, (byte) 0xB9);
Xov.sleep (1000);
// Nyeem 6 bytes ntawm cov ntaub ntawv los ntawm chaw nyob 0x00 (00)
// xwm txheej, tHeight msb1, tHeight msb, tHeight lsb, temp msb, tem lsb
byte cov ntaub ntawv = tshiab byte [6];
device.read (0x00, cov ntaub ntawv, 0, 6);
// Hloov cov ntaub ntawv mus rau 20-ntsis
int tHeight = (((data [1] & 0xFF) * 65536) + ((data [2] & 0xFF) * 256) + (data [3] & 0xF0)) / 16);
int temp = ((cov ntaub ntawv [4] * 256) + (data [5] & 0xF0)) / 16;
ob qhov siab = tHeight / 16.0;
ob cTemp = (temp / 16.0);
ob fTemp = cTemp * 1.8 + 32;
// Xaiv tswj sau npe
// Hom ua haujlwm, OSR = 128, hom ntsuas cua
ntaus ntawv.write (0x26, (byte) 0x39);
Xov.sleep (1000);
// Nyeem 4 bytes ntawm cov ntaub ntawv los ntawm chaw nyob 0x00 (00)
// xwm txheej, pres msb1, pres msb, pres lsb
device.read (0x00, cov ntaub ntawv, 0, 4);
// Hloov cov ntaub ntawv mus rau 20-ntsis
int pres = (((cov ntaub ntawv [1] & 0xFF) * 65536) + ((data [2] & 0xFF) * 256) + (data [3] & 0xF0)) / 16;
ob npaug siab = (pres / 4.0) / 1000.0;
// Cov ntaub ntawv tso tawm rau lub vijtsam
System.out.printf ("Siab: %.2f kPa %n", siab);
System.out.printf ("Qhov siab: %.2f m %n", qhov siab);
System.out.printf ("Kub hauv Celsius: %.2f C %n", cTemp);
System.out.printf ("Kub hauv Fahrenheit: %.2f F %n", fTemp);
}
}
Kauj Ruam 4: Cov ntawv thov:
Kev siv ntau yam ntawm MPL3115A2 suav nrog Kev Raug Siab Tshaj Plaws, Smartphones/Tablets, Kev Siv Hluav Taws Xob Tus Kheej thiab lwm yam.
Pom zoo:
Raspberry Pi - TSL45315 Ambient Light Sensor Java Qhia: 4 Kauj Ruam
Raspberry Pi - TSL45315 Ambient Light Sensor Java Qhia: TSL45315 yog lub teeb pom kev zoo ib puag ncig digital. Nws kwv yees tib neeg qhov muag teb raws ntau yam teeb pom kev zoo. Cov cuab yeej muaj peb lub sijhawm xaiv ua ke thiab muab ncaj qha 16-ntsis lux tso tawm ntawm I2C tsheb npav sib cuam tshuam. Cov cuab yeej siv
2019 FRC Sau Ntawv Qhia Txog Kev Cob Qhia Tsav Tsheb (Java): 5 Kauj Ruam
2019 FRC Sau Ntawv Qhia Txog Kev Cob Qhia Tsav Tsheb yooj yim (Java): Cov lus qhia no YUAV TSHUAJ TUG DATE! Txawm hais tias nws tsis dhau los tseem muaj qee yam uas koj tuaj yeem kawm txog nws zoo li yuav ua li cas thiaj ua tau cov chav kawm thiab sau cov cai
Raspberry Pi A1332 Precision Hall - Effect Angle Sensor Java Qhia: 4 Kauj Ruam
Raspberry Pi A1332 Precision Hall - Effect Angle Sensor Java Qhia: A1332 yog 360 ° tsis muaj kev sib cuag siab daws teeb meem programmable sib nqus lub ntsej muag txoj haujlwm sensor. Nws yog tsim los rau cov tshuab siv I2C interface. Nws tau tsim los ntawm Lub Vertical Hall (CVH) thev naus laus zis thiab cov txheej txheem microprocessor uas tuaj yeem tsim tau
Kuv Me Me Whoop: Daim Ntawv Qhia Whoop + Cov Lus Qhia thiab Cov Lus Qhia: 8 Kauj Ruam
Kuv Me Me Whoop: Daim Ntawv Qhia Whoop + Cov Lus Qhia thiab Cov Lus Qhia: Kev Ceeb Toom: Tam sim no koj tab tom nkag mus rau kuv thawj qhov kev qhia, thiab koj yuav ntsib ntau yam kev ruam thiab tsis muaj phiaj xwm thiab/lossis txuj ci. Paub txog qhov no yog kuv tus kheej Tiny Whoop teeb tsa uas kuv siv txhua hnub, yog li kuv xav tias kuv yuav qhia nws. Nws yog phooj ywg mus ncig (tsis muaj
Yuav Ua Li Cas Ua Tus Qhia Qhia thiab Qhia: 8 Kauj Ruam
Yuav Ua Li Cas Nthuav Qhia Qhia thiab Qhia: Nov yog phau ntawv qhia rau kev ua Qhia Qhia thiab Qhia. Nws yog qhov tseem ceeb tshaj plaws ntawm cov xwm txheej muaj nyob rau Hnub Friday, Peb Hlis 9, 2007, tab sis kuj tseem yog qhov tshwm sim yav dhau los ntawm qhov xwm txheej no, Squid Labs Lub Teeb Pom Kev Zoo. Lub hom phiaj ntawm Kev Qhia thiab Xov Tooj