Cov txheej txheem:

Motion Tracking Siv MPU-6000 thiab Particle Photon: 4 Cov Kauj Ruam
Motion Tracking Siv MPU-6000 thiab Particle Photon: 4 Cov Kauj Ruam

Video: Motion Tracking Siv MPU-6000 thiab Particle Photon: 4 Cov Kauj Ruam

Video: Motion Tracking Siv MPU-6000 thiab Particle Photon: 4 Cov Kauj Ruam
Video: Qhiab Siv AI Motion Capture for iclone 2024, Kaum ib hlis
Anonim
Image
Image

MPU-6000 yog 6-Axis Motion Tracking Sensor uas muaj 3-Axis accelerometer thiab 3-Axis gyroscope kos rau hauv. Qhov ntsuas no muaj peev xwm taug qab qhov tseeb ntawm qhov chaw thiab qhov chaw ntawm ib yam khoom hauv lub dav hlau 3-dimensional. Nws tuaj yeem ua haujlwm hauv cov kab ke uas xav tau kev tshuaj xyuas txoj haujlwm mus rau qhov siab tshaj plaws.

Hauv qhov kev qhia no kev cuam tshuam ntawm MPU-6000 sensor module nrog particle photon tau piav qhia. Txhawm rau nyeem qhov tseem ceeb ntawm kev nrawm thiab tig lub kaum ntse ntse, peb tau siv cov khoom me me nrog I2c adapter. Qhov I2C adapter ua rau kev txuas mus rau lub ntsuas qhov ntsuas tau yooj yim thiab ntseeg tau ntau dua.

Kauj Ruam 1: Yuav Tsum Kho Vajtse:

Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse
Yuav tsum tau kho vajtse

Cov ntaub ntawv xav tau los ua kom tiav peb txoj haujlwm suav nrog cov hauv qab no hais txog cov khoom siv kho vajtse:

1. MPU-6000

2. Particle Photon

3. I2C Cable

4. I2C Shield rau particle photon

Kauj ruam 2: Khoos phis tawj sib txuas:

Kho vajtse Hookup
Kho vajtse Hookup
Kho vajtse Hookup
Kho vajtse Hookup

Tshooj khoos phis tawj sib txuas ntu piav qhia qhov txuas txuas txuas uas xav tau ntawm lub sensor thiab cov duab photon. 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:

MPU-6000 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 3: Txoj Cai rau Tsab Ntawv Teev Npe:

Txoj Cai rau Kev Tshawb Fawb
Txoj Cai rau Kev Tshawb Fawb

Cia peb pib nrog cov lej me me tam sim no.

Thaum siv lub ntsuas qhov ntsuas nrog arduino, peb suav nrog application.h thiab lub tsev qiv ntawv spark_wiring_i2c.h. "application.h" thiab lub tsev qiv ntawv spark_wiring_i2c.h muaj cov haujlwm uas pab txhawb kev sib txuas lus i2c ntawm lub sensor thiab cov khoom me me.

Tag nrho cov cai hauv qab no tau muab rau hauv qab no kom yooj yim ntawm tus neeg siv:

#suav nrog #suav nrog // MPU-6000 I2C chaw nyob yog 0x68 (104) #define Addr 0x68 int xGyro = 0, yGyro = 0, zGyro = 0, xAccl = 0, yAccl = 0, zAccl = 0; teeb tsa tsis muaj dab tsi () {// Teeb tsa qhov sib txawv Particle.variable ("i2cdevice", "MPU-6000"); Particle.variable ("xAccl", xAccl); Particle.variable ("yAccl", yAccl); Particle.variable ("zAccl", zAccl); Particle.variable ("xGyro", xGyro); Particle.variable ("yGyro", yGyro); Particle.variable ("zGyro", zGyro); // Initialise I2C kev sib txuas lus li Master Wire.begin (); // Initialise serial kev sib txuas lus, teeb baud tus nqi = 9600 Serial.begin (9600); // Pib I2C kis tau tus mob Wire.beginTransmission (Addr); // Xaiv gyroscope teeb tsa npe Wire.write (0x1B); // Qhov ntsuas tag nrho = 2000 dps Wire.write (0x18); // Nres I2C kev xa xov Wire.endTransmission (); // Pib I2C kis tau tus mob Wire.beginTransmission (Addr); // Xaiv qhov ntsuas qhov ntsuas tus lej sau npe Wire.write (0x1C); // Tag nrho qhov ntsuas ntau = +/- 16g Hlau.write (0x18); // Nres I2C kev xa xov Wire.endTransmission (); // Pib I2C kis tau tus mob Wire.beginTransmission (Addr); // Xaiv lub zog tswj hwm sau npe Wire.write (0x6B); // PLL nrog xGyro siv Wire.write (0x01); // Nres I2C kev xa xov Wire.endTransmission (); ncua (300); } void loop () {unsigned int cov ntaub ntawv [6]; // Pib I2C kis kab mob.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write (0x3B); // Nres I2C kev xa xov Wire.endTransmission (); // Thov 6 bytes ntawm cov ntaub ntawv Wire.requestFrom (Addr, 6); // Nyeem 6 byte ntawm cov ntaub ntawv yog (Wire.available () == 6) {data [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 (); } ncua (800); // Hloov cov ntaub ntawv xAccl = ((data [1] * 256) + data [0]); yog (xAccl> 32767) {xAccl -= 65536; } yAccl = ((cov ntaub ntawv [3] * 256) + cov ntaub ntawv [2]); yog (yAccl> 32767) {yAccl -= 65536; } zAccl = ((cov ntaub ntawv [5] * 256) + cov ntaub ntawv [4]); yog (zAccl> 32767) {zAccl -= 65536; } ncua (800); // Pib I2C kis tau tus mob Wire.beginTransmission (Addr); // Xaiv cov ntaub ntawv sau npe Wire.write (0x43); // Nres I2C kev xa xov Wire.endTransmission (); // Thov 6 bytes ntawm cov ntaub ntawv Wire.requestFrom (Addr, 6); // Nyeem 6 byte ntawm cov ntaub ntawv yog (Wire.available () == 6) {data [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 (); } // Hloov cov ntaub ntawv xGyro = ((data [1] * 256) + data [0]); yog (xGyro> 32767) {xGyro -= 65536; } yGyro = ((cov ntaub ntawv [3] * 256) + cov ntaub ntawv [2]); yog (yGyro> 32767) {yGyro -= 65536; } zGyro = ((cov ntaub ntawv [5] * 256) + cov ntaub ntawv [4]); yog (zGyro> 32767) {zGyro -= 65536; } // Cov ntaub ntawv tso tawm rau dashboard Particle.publish ("Kev nrawm hauv X-Axis:", Txoj hlua (xAccl)); ncua (1000); Particle.publish ("Acceleration in Y-Axis:", String (yAccl)); ncua (1000); Particle.publish ("Acceleration in Z-Axis:", String (zAccl)); ncua (1000); Particle.publish ("X-Axis ntawm kev sib hloov:", Txoj hlua (xGyro)); ncua (1000); Particle.publish ("Y-Axis ntawm kev sib hloov:", Txoj hlua (yGyro)); ncua (1000); Particle.publish ("Z-Axis ntawm kev sib hloov:", Txoj hlua (zGyro)); ncua (1000); }

Particle.variable () muaj nuj nqi tsim cov kev hloov pauv kom khaws cov zis tawm ntawm lub sensor thiab Particle.publish () muaj nuj nqi qhia cov zis ntawm lub dashboard ntawm lub xaib.

Cov zis sensor tau pom hauv daim duab saum toj no rau koj siv.

Kauj Ruam 4: Cov ntawv thov:

Cov ntawv thov
Cov ntawv thov

MPU-6000 yog lub suab ntsuas lub suab ntsuas, uas pom nws daim ntawv thov hauv kev sib cuam tshuam ntawm cov xov tooj ntawm tes thiab ntsiav tshuaj. Hauv cov xov tooj ntawm tes cov cuab yeej no tuaj yeem ua haujlwm hauv cov ntawv thov xws li kev hais lus taw tes rau kev siv thiab tswj lub xov tooj, txhim kho kev ua si, ua kom muaj kev muaj tiag, ua kom pom cov duab pom thiab pom, thiab taug kev thiab tsheb nqaj hlau. MotionTracking thev naus laus zis tuaj yeem hloov kho lub xov tooj thiab cov ntsiav tshuaj rau hauv cov cuab yeej ntse 3D uas tuaj yeem siv rau hauv cov ntawv thov xws li kev saib xyuas kev noj qab haus huv thiab kev tawm dag zog mus rau cov kev pabcuam raws qhov chaw.

Pom zoo: