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 MMA8452Q 3-Axis 12-ntsis/8-ntsis Digital Accelerometer Python Qhia: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
MMA8452Q yog lub ntse, lub zog qis, peb-axis, muaj peev xwm, lub tshuab ntsuas hluav taws xob micromachined nrog 12 qhov kev daws teeb meem. Cov neeg siv hloov pauv tau cov kev xaiv ua haujlwm tau muab nrog kev pab cuam ntawm lub zog ua haujlwm hauv lub nrawm, teeb tsa tau rau ob qho cuam tshuam tus pin. Nws muaj cov neeg siv xaiv tau cov nplai ntawm g 2g/± 4g/± 8g nrog cov qib siab lim lim cov ntaub ntawv nrog rau cov ntaub ntawv tsis lim dej muaj lub sijhawm tiag. 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. MMA8452Q
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 kawg ntawm I2C cable rau MMA8452Q 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 MMA8452Q tuaj yeem rub tawm los ntawm peb qhov chaw cia khoom github- Tswj Txhua Yam Hauv Lub Zos
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.
# MMA8452Q
# Txoj cai no yog tsim los ua haujlwm nrog MMA8452Q_I2CS I2C Mini Module.
ntshuam smbus
lub sij hawm ntshuam
# Tau I2C npav
npav = smbus. SMBus (1)
# MMA8452Q chaw nyob, 0x1C (28)
# Xaiv Tswj npe, 0x2A (42)
# 0x00 (00) StandBy hom
bus.write_byte_data (0x1C, 0x2A, 0x00)
# MMA8452Q chaw nyob, 0x1C (28)
# Xaiv Tswj npe, 0x2A (42)
# 0x01 (01) Hom nquag
bus.write_byte_data (0x1C, 0x2A, 0x01)
# MMA8452Q chaw nyob, 0x1C (28)
# Xaiv Configuration register, 0x0E (14)
# 0x00 (00) Teeb ntau yam rau +/- 2g
bus.write_byte_data (0x1C, 0x0E, 0x00)
sijhawm.s pw (0.5)
# MMA8452Q chaw nyob, 0x1C (28)
# Nyeem cov ntaub ntawv rov qab los ntawm 0x00 (0), 7 bytes
# Cov xwm txheej sau npe, X-Axis MSB, X-Axis LSB, Y-Axis MSB, Y-Axis LSB, Z-Axis MSB, Z-Axis LSB
cov ntaub ntawv = bus.read_i2c_block_data (0x1C, 0x00, 7)
# Hloov cov ntaub ntawv
xAccl = (data [1] * 256 + data [2]) / 16
yog xAccl> 2047:
xwm -4096
yAccl = (data [3] * 256 + data [4]) / 16
Yog tias yAccl> 2047:
yAccl -= 4096 z
Accl = (cov ntaub ntawv [5] * 256 + cov ntaub ntawv [6]) / 16
yog zAccl> 2047:
txz -4096
# Cov ntaub ntawv tso tawm rau lub vijtsam
luam "Kev nrawm hauv X-Axis: %d" %xAccl
luam "Kev nrawm hauv Y-Axis: %d" %yAccl
luam "Kev nrawm hauv Z-Axis: %d" %zAccl
Kauj Ruam 4: Cov ntawv thov:
MMA8452Q muaj ntau daim ntawv thov suav nrog E-Compass applications, Static orientation detection uas koom nrog Portrait/Landscape, Up/Down, Left/Right, Back/Front position identification, Notebook, e-reader, and Laptop Tumble and Freefall Detection, Real-time kev txheeb xyuas kev taw qhia suav nrog kev muaj tiag virtual thiab kev ua si 3D cov neeg siv txoj haujlwm tawm tswv yim, Kev tshuaj xyuas lub sijhawm tiag tiag xws li kev ntsuas tus lej ntsuas, ntsuas kev poob qis rau HDD, tuag-suav nrog GPS thaub qab thiab ntau ntxiv.
Pom zoo:
Cov Lus Qhia Qhia: 3 Kauj Ruam
Cov Lus Qhia Ua Ntej: Xijpeem koj ua haujlwm, nws taug kev, taug kev, caij tsheb kauj vab lossis txawm tias tsav tsheb, koj tuaj yeem sau cov kev uas koj taug. Tom qab ntawd koj tuaj yeem faib cov kev no nrog phooj ywg thiab tsev neeg. Ib qho ntxiv, koj tuaj yeem siv txoj hauv kev kaw tseg los ntxiv qhov chaw rau txhua daim duab uas koj tuaj yeem h
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 - TMD26721 Infrared Digital Proximity Detector Python Qhia: 4 Kauj Ruam
Raspberry Pi-TMD26721 Infrared Digital Proximity Detector Python Tutorial: TMD26721 yog lub tshuab hluav taws xob infrared digital sib thooj uas muab qhov ua tiav kev txheeb ze sib xws thiab digital interface logic hauv ib qho 8-pin nto mount module. qhov tseeb Ib tus prox
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