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: Arduino Nano-MMA8452Q 3-Axis 12-ntsis/8-ntsis Digital Accelerometer Tutorial: 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 qauv qhia nrog Arduino nano.
Kauj Ruam 1: Yam Koj Xav Tau..
1. Arduino Nano
2. MMA8452Q
3. I²C Cable
4. I²C Shield rau Arduino Nano
Kauj Ruam 2: Kev Sib Txuas:
Siv daim I2C daim thaiv rau Arduino Nano thiab maj mam thawb nws hla tus pin ntawm Nano.
Tom qab ntawd txuas ib kawg ntawm I2C cable rau MMA8452Q sensor thiab lwm qhov kawg rau I2C daim ntaub thaiv.
Kev sib txuas tau qhia hauv daim duab saum toj no.
Kauj ruam 3: Code:
Tus lej arduino rau MMMA8452Q tuaj yeem rub tawm los ntawm peb qhov chaw cia khoom github- DCUBE Store.
Nov yog qhov txuas.
Peb suav nrog tsev qiv ntawv Wire.h los pab txhawb I2c kev sib txuas lus ntawm lub sensor nrog Arduino board.
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.
// MMA8452Q
// Tus lej no yog tsim los ua haujlwm nrog MMA8452Q_I2CS I2C Mini Module.
#suav nrog
// MMA8452Q I2C chaw nyob yog 0x1C (28)
#define Ntxiv 0x1C
void teeb tsa ()
{
// Pib I2C kev sib txuas lus li MASTER
Hlau.begin ();
// Initialise Serial Communication, teeb baud tus nqi = 9600
Serial.begin (9600);
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv tswj sau npe
Hlau.write (0x2A);
// StandBy hom
Hlau.write (0x00);
// Nres I2C Kev Kis
Wire.endTransmission ();
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv tswj sau npe
Hlau.write (0x2A);
// Hom nquag
Hlau.write (0x01);
// Nres I2C Kev Kis
Wire.endTransmission ();
// Pib I2C Kev Kis
Wire.beginTransmission (Addr);
// Xaiv tswj sau npe
Hlau.write (0x0E);
// Teeb tsa kom +/- 2g
Hlau.write (0x00);
// Nres I2C Kev Kis
Wire.endTransmission ();
ncua (300);
}
void lub voj ()
{
unsigned int cov ntaub ntawv [7];
// Thov 7 bytes ntawm cov ntaub ntawv
Wire.requestFrom (Addr, 7);
// Nyeem 7 bytes ntawm cov ntaub ntawv
// staus, xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
yog (Wire.available () == 7)
{
cov ntaub ntawv [0] = Wire.read ();
cov ntaub ntawv [1] = Wire.read ();
cov ntaub ntawv [2] = Wire.read ();
cov ntaub ntawv [3] = Wire.read ();
cov ntaub ntawv [4] = Wire.read ();
cov ntaub ntawv [5] = Wire.read ();
cov ntaub ntawv [6] = Wire.read ();
}
// Hloov cov ntaub ntawv mus rau 12-ntsis
int xAccl = ((data [1] * 256) + data [2]) / 16;
yog (xAccl> 2047)
{
xAccl -= 4096;
}
int yAccl = ((cov ntaub ntawv [3] * 256) + cov ntaub ntawv [4]) / 16;
yog (yAccl> 2047)
{
yAccl -= 4096;
}
int zAccl = ((cov ntaub ntawv [5] * 256) + cov ntaub ntawv [6]) / 16;
yog (zAccl> 2047)
{
zAccl -= 4096;
}
// Cov ntaub ntawv tso tawm rau tus saib xyuas
Serial.print ("Ua kom nrawm hauv X-Axis:");
Serial.println (xAccl);
Serial.print ("Kev nrawm hauv Y-Axis:");
Serial.println (yAccl);
Serial.print ("Ua kom nrawm hauv Z-Axis:");
Serial.println (zAccl);
ncua (500);
}
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:
Arduino Accelerometer Tutorial: Tswj Lub Nkoj Nkoj Siv Servo Motor: 5 Kauj Ruam
Arduino Accelerometer Tutorial: Tswj Lub Nkoj Nkoj Siv Servo Motor: Accelerometer sensors tam sim no nyob rau hauv feem ntau ntawm peb cov smartphones los muab rau lawv ntau yam kev siv thiab muaj peev xwm uas peb siv txhua hnub, yam tsis tau paub tias tus lav paub nws yog tus ntsuas. Ib qho ntawm cov peev xwm no yog kev tswj hwm
CubeSat Accelerometer Tutorial: 6 Kauj Ruam
CubeSat Accelerometer Tutorial: Cubeat yog ib hom me me ntawm lub hnub qub rau kev tshawb fawb chaw uas yog ua los ntawm ntau ntau ntawm 10x10x10 cm cubic units thiab qhov hnyav tsis ntau tshaj 1.33 kilograms ib chav. Cubesats pab kom muaj ntau lub hnub qub xa mus rau qhov chaw thiab
Arduino Nano thiab Visuino: Hloov Ua Ntej Los Ntawm Lub Cev Los Ntawm Accelerometer thiab Gyroscope MPU6050 I2C Sensor: 8 Kauj Ruam (nrog Duab)
Arduino Nano thiab Visuino: Hloov Ua Ntej Los Ntawm Lub Accelerometer thiab Gyroscope MPU6050 I2C Sensor: Ib pliag dhau los kuv tau tshaj tawm cov lus qhia yuav ua li cas koj tuaj yeem txuas MPU9250 Accelerometer, Gyroscope thiab Compass Sensor rau Arduino Nano thiab teeb tsa nws nrog Visuino kom xa cov ntaub ntawv pob thiab tso saib nws ntawm Scope thiab Visual Instruments.The Accelerometer xa X, Y
Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: 11 Kauj Ruam
Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: MPU9250 yog ib qho ntawm kev ua tau zoo tshaj plaws ua ke Accelerometer, Gyroscope thiab Compass cov ntsuas me me tam sim no muaj. Lawv muaj ntau qhov ua tau zoo tshaj plaws, suav nrog kev lim qis dhau, tshawb pom lub suab, thiab txawm tias cov txheej txheem tshwj xeeb tuaj yeem ua haujlwm
Accelerometer & Gyro Tutorial: 3 Kauj Ruam
Accelerometer & Gyro Tutorial: Taw qhia Phau ntawv qhia no yog npaj rau txhua tus neeg nyiam siv Accelerometers thiab Gyroscopes ntxiv rau ua ke cov cuab yeej IMU (Inertial Measurement Unit) hauv lawv cov khoom siv hluav taws xob Peb yuav npog: Qhov ntsuas ntsuas ntsuas yog dab tsi?