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 Python Qhia: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
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 tus lej nab npawb.
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 nab npawb nab npawb rau MPL3115A2 tuaj yeem rub tawm los ntawm peb Github chaw cia khoom- DCUBE Store Community.
Nov yog qhov txuas
Peb tau siv SMBus lub tsev qiv ntawv rau sej code, cov kauj ruam rau nruab SMBus ntawm raspberry pi tau piav qhia ntawm no:
pypi.python.org/pypi/smbus-cffi/0.5.1
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 sib txuam.
# MPL3115A2
# Txoj cai no yog tsim los ua haujlwm nrog MPL3115A2_I2CS I2C Mini Module
ntshuam smbus
lub sij hawm ntshuam
# Tau I2C npav
npav = smbus. SMBus (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv tswj npe, 0x26 (38)
# 0xB9 (185) Hom ua haujlwm, OSR = 128, Hom Altimeter
bus.write_byte_data (0x60, 0x26, 0xB9)
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv cov ntaub ntawv teeb tsa sau npe, 0x13 (19)
# 0x07 (07) Cov ntaub ntawv npaj tau tshwm sim qhib rau qhov siab, siab, kub
bus.write_byte_data (0x60, 0x13, 0x07)
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv tswj npe, 0x26 (38)
# 0xB9 (185) Hom ua haujlwm, OSR = 128, Hom Altimeter
bus.write_byte_data (0x60, 0x26, 0xB9)
sijhawm.sleep (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Nyeem cov ntaub ntawv rov qab los ntawm 0x00 (00), 6 bytes
# xwm txheej, lub siab MSB1, lub siab MSB, lub siab LSB, lub sijhawm MSB, lub sijhawm LSB
cov ntaub ntawv = bus.read_i2c_block_data (0x60, 0x00, 6)
# Hloov cov ntaub ntawv mus rau 20-ntsis
tHeight = ((data [1] * 65536) + (data [2] * 256) + (data [3] & 0xF0)) / 16
temp = ((cov ntaub ntawv [4] * 256) + (data [5] & 0xF0)) / 16
qhov siab = tHeight / 16.0
cTemp = qhov kub / 16.0
fTemp = cTemp * 1.8 + 32
# MPL3115A2 chaw nyob, 0x60 (96)
# Xaiv tswj npe, 0x26 (38)
# 0x39 (57) Hom ua haujlwm, OSR = 128, Hom ntsuas cua
bus.write_byte_data (0x60, 0x26, 0x39)
sijhawm.sleep (1)
# MPL3115A2 chaw nyob, 0x60 (96)
# Nyeem cov ntaub ntawv rov qab los ntawm 0x00 (00), 4 bytes
# xwm txheej, pres MSB1, pres MSB, pres LSB
cov ntaub ntawv = bus.read_i2c_block_data (0x60, 0x00, 4)
# Hloov cov ntaub ntawv mus rau 20-ntsis
pres = ((data [1] * 65536) + (data [2] * 256) + (data [3] & 0xF0)) / 16
siab = (pres / 4.0) / 1000.0
# Cov ntaub ntawv tso tawm rau lub vijtsam
sau "Siab: %.2f kPa" %siab
luam "Qhov siab: %.2f m" %qhov siab
luam tawm "Kub hauv Celsius: %.2f C" %cTemp
luam tawm "Kub hauv Fahrenheit: %.2f F" %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 SHT25 Vaum & Kub Sensor Python Qhia: 4 Kauj Ruam
Raspberry Pi SHT25 Vaum & Kub Sensor Python Qhia: SHT25 I2C Vaum thiab Kub Sensor ± 1.8%RH ± 0.2 ° C I2C Mini Module. SHT25 qhov tseeb qhov ntsuas qhov ntsuas cua thiab qhov kub tau dhau los ua tus qauv kev lag luam raws li daim ntawv foos thiab kev txawj ntse, muab kev ntsuas ntsuas, ntsuas qhov ntsuas pom
Raspberry Pi - BH1715 Digital Ambient Light Sensor Python Qhia: 4 Kauj Ruam
Raspberry Pi - BH1715 Digital Ambient Light Sensor Python Tutorial: BH1715 yog digital Ambient Light Sensor nrog I²C tsheb npav sib cuam tshuam. BH1715 feem ntau yog siv kom tau txais cov ntaub ntawv teeb pom kev zoo los kho LCD thiab Keypad lub teeb pom kev zoo rau lub xov tooj ntawm tes. Cov cuab yeej no muaj 16-ntsis kev daws teeb meem thiab txuas ntxiv
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