Cov txheej txheem:

Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: 11 Kauj Ruam
Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: 11 Kauj Ruam

Video: Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: 11 Kauj Ruam

Video: Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor Nrog Visuino: 11 Kauj Ruam
Video: Arduino Nano: Accelerometer Gyroscope Compass MPU9250 I2C Sensor with Visuino 2024, Kaum ib hlis
Anonim
Image
Image

MPU9250 yog ib qho ua tau zoo tshaj plaws ua ke Accelerometer, Gyroscope thiab Compass cov ntsuas me me tam sim no muaj. Lawv muaj ntau yam ua tau zoo, suav nrog kev lim qis dhau, tshawb pom cov lus pom, thiab txawm tias cov txheej txheem tshwj xeeb tuaj yeem ua haujlwm tau. Muaj ze li ntawm 130 tus neeg sau npe txawm li cas los xij, nrog ntau qhov chaw, lawv kuj nyuaj heev rau ua haujlwm nrog los ntawm cov cai.

Ob peb lub lis piam dhau los GearBest tau zoo txaus los pub dawb MPU9250 tus qauv los txhawb kev txhawb nqa ntxiv rau nws hauv Visuino. Nws siv 2 lub lis piam ntawm kev ua haujlwm hnyav, tab sis thaum kawg kuv tsis tsuas yog muaj kev txhawb nqa rau MPU9250 siv, tab sis kuv kuj tau ntxiv Kev Ua Kom Ncaj Ncees rau Lub Hloov Hloov, Ua Ntxiv (Thawj thiab Thib Ob Qhov Kev Txiav Txim), thiab Kalman lim dej uas tuaj yeem siv nrog nws txhawm rau txhim kho qhov tseeb

Nov yog thawj qhov kev qhia ntawm MPU9250 kev txhawb nqa tshiab hauv Visuino, thiab nws qhia tau hais tias nws yooj yim npaum li cas los siv nws nrog Visuino. Hauv Cov Lus Qhia hauv qab no kuv yuav qhia koj yuav ua li cas koj tuaj yeem siv Kev Hloov Kho Kom Ncaj Ncees hloov pauv, Ua kom sib haum thiab Kalman lim dej thiab tau txais txiaj ntsig zoo tiag tiag los ntawm koj lub ntsuas qhov ntsuas.

Kauj Ruam 1: Cheeb Tsam

Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
  1. Ib lub rooj sib tham ntawm Arduino (Kuv siv Arduino Nano, vim tias kuv muaj ib qho, tab sis lwm qhov yuav zoo xwb)
  2. Ib qho MPU9250 Sensor Module (hauv kuv cov ntaub ntawv pub dawb los ntawm GearBest)
  3. 4 Poj niam-Poj niam jumper xov hlau

Kauj Ruam 2: Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino

Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
Txuas MPU9250 Accelerometer Gyroscope Compass rau Arduino
  1. Txuas 5V VCC Fais Fab (Hlau liab), Hauv av (Hlau dub), SDA (Ntsuab hlau), thiab SCL (Hlau xaim), mus rau MPU9250 Module (Duab 1)
  2. Txuas lwm qhov kawg ntawm Cov Av Hauv av (Cov xaim dub) rau hauv av pin ntawm Arduino board (Daim duab 2)
  3. Txuas lwm qhov kawg ntawm 5V VCC Fais fab hlau (Liab hlau) mus rau 5V fais fab tus pin ntawm Arduino board (Daim duab 2)
  4. Txuas lwm qhov kawg ntawm SDA xaim (Green wire) rau SDA/Analog tus pin 4 ntawm Arduino Nano board (Daim duab 2)
  5. Txuas lwm qhov kawg ntawm SCL xaim (Hlau xaim) mus rau SCL/Analog tus pin 5 ntawm Arduino Nano board (Daim duab 2)
  6. Daim duab 3 qhia qhov twg yog Av, 5V Fais Fab, SDA/Analog pin 4, thiab SCL/Analog pin 5, tus pin ntawm Arduino Nano

Kauj Ruam 3: Pib Visuino, thiab Xaiv Arduino Board Type

Pib Visuino, thiab Xaiv Arduino Board Type
Pib Visuino, thiab Xaiv Arduino Board Type
Pib Visuino, thiab Xaiv Arduino Board Type
Pib Visuino, thiab Xaiv Arduino Board Type

Txhawm rau pib ua haujlwm rau Arduino, koj yuav tsum muaj Arduino IDE teeb tsa los ntawm no:

Nco ntsoov tias koj nruab 1.6.7 lossis siab dua, txwv tsis pub Cov Lus Qhia no yuav tsis ua haujlwm!

Visuino: https://www.visuino.com kuj tseem yuav tsum tau teeb tsa.

  1. Pib Visuino raws li qhia hauv daim duab thawj
  2. Nyem rau ntawm "Cov cuab yeej" khawm ntawm Arduino tivthaiv (Daim duab 1) hauv Visuino
  3. Thaum cov lus sib tham tshwm, xaiv Arduino Nano raws li qhia hauv daim duab 2

Kauj Ruam 4: Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheebtsam

Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
Hauv Visuino: Ntxiv thiab Txuas MPU9250 Cheeb Tsam
  1. Ntaus "mpu" hauv lub thawv lim ntawm Cov Cuab Yeej Cuab Yeej ces xaiv "Accelerometer Gyroscope Compass MPU9250 I2C" tivthaiv (Daim duab 1), thiab tso rau hauv qhov chaw tsim (Daim duab 2)
  2. Txuas tus "Tawm" tus pin ntawm AccelerometerGyroscopeCompass1 tivthaiv mus rau "Hauv" tus pin ntawm I2C channel ntawm Arduino tivthaiv (Daim duab 3)

Kauj Ruam 5: Hauv Visuino: Ntxiv thiab Txuas Pob Pob Cheeb Tsam

Hauv Visuino: Ntxiv thiab Txuas Cov Pob Khoom Txuas
Hauv Visuino: Ntxiv thiab Txuas Cov Pob Khoom Txuas
Hauv Visuino: Ntxiv thiab Txuas Cov Pob Khoom Txuas
Hauv Visuino: Ntxiv thiab Txuas Cov Pob Khoom Txuas

Txhawm rau xa tag nrho cov ntaub ntawv cov ntaub ntawv hla cov chaw nres nkoj los ntawm Arduino peb tuaj yeem siv Packet tivthaiv los ntim cov channel ua ke, thiab tso saib lawv hauv Scope thiab Gauges hauv Visuino:

  1. Ntaus "pob" hauv Lub Lim Lim ntawm Lub Cuab Yeej Cuab Yeej ces xaiv "Pob" cov khoom siv (Daim duab 1), thiab tso nws rau hauv thaj chaw tsim
  2. Txuas "Out" tus pin tso tawm ntawm Packet1 tivthaiv rau "Hauv" tus pin nkag ntawm "Serial [0]" channel ntawm "Arduino" tivthaiv (Daim duab 2)

Kauj Ruam 6: Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Tiv Thaiv thiab Qhia Lawv Lub Npe

Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
Hauv Visuino: Ntxiv 7 Binary Analog Elements rau Pob Ntawv Txheej Txheem thiab Qhia Lawv Lub Npe
  1. Nyem rau ntawm "Cov cuab yeej" khawm ntawm Packet1 tivthaiv (Daim duab 1)
  2. Hauv "Elements" tus kws kho mob xaiv lub "Binary Analog" lub ntsiab lus, thiab tom qab ntawd nyem rau ntawm "+" khawm (Daim duab 2) ntxiv cov khoom sib piv
  3. Hauv Tus Kws Tshuaj Ntsuam Xyuas teeb tsa "Lub Npe" cov khoom ntawm Analog Element rau "Compass (X)" (Daim duab 3)
  4. Hauv "Elements" tus kws kho mob xaiv lub "Binary Analog" keeb kwm ntawm sab xis, thiab tom qab ntawd nyem rau "+" khawm ntawm sab laug kom ntxiv lwm qhov sib piv
  5. Hauv Tus Kws Tshuaj Ntsuam Xyuas teeb tsa lub npe "Npe" ntawm cov khoom sib piv tshiab rau "Compass (Y)" (Daim duab 4)
  6. Hauv "Elements" tus kws kho mob xaiv lub "Binary Analog" keeb kwm ntawm sab xis, thiab tom qab ntawd nyem rau "+" khawm ntawm sab laug kom ntxiv lwm qhov sib piv
  7. Hauv Tus Kws Tshuaj Ntsuam Xyuas teeb tsa "Lub Npe" cov khoom ntawm cov khoom sib piv rau "Compass (Z)" (Daim duab 5)
  8. Rov ua cov kauj ruam tib yam ntxiv 7 ntxiv Binary Analog ntsiab lus hu ua "Accelerometer (X)", "Accelerometer (Y)", "Accelerometer (Z)", "Gyroscope (X)", "Gyroscope (Y)", "Gyroscope (Z) "thiab" Tus pas ntsuas kub "(Daim duab 6)

Kauj Ruam 7: Hauv Visuino: teeb tsa Kev Pom Kev Pom Zoo ntawm Pob Ntawv Ntim rau Tus Ntsuas Kub

Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub
Hauv Visuino: Kho Kho Kom Pom Kev Pom Zoo ntawm Pob Ntim Ntim rau Tus pas ntsuas kub

Visuino los ntawm lub neej ntawd tuaj yeem tso saib cov khoom sib piv los ntawm cov khoom ntim hauv cov ntsuas. Nws yog qhov zoo txawm li cas los tso tawm qhov ntsuas kub hauv tus pas ntsuas kub. Visuino tso cai kev hloov kho ntawm txoj kev sib piv cov ntsiab lus tau tshwm sim.

  1. Hauv Elements editor, xaiv qhov kawg Analog lub npe hu ua "Thermometer" (Daim duab 1)
  2. Hauv Tus Kws Tshuaj Ntsuam Xyuas xaiv lub cuab yeej "Ntsuas" thiab nyem rau ntawm "xub nqis" khawm ntawm nws tus nqi (Daim duab 1)
  3. Los ntawm lub thawv nco cia xaiv "Tus pas ntsuas kub" (Daim duab 2)
  4. Hauv Tus Kws Saib Xyuas Lub Hom Phiaj nthuav cov cuab yeej "Ntsuas", tom qab ntawv "Nplai" cov khoom ntiag tug (Daim duab 3)
  5. Hauv Tus Kws Tshuaj Ntsuam Xyuas teeb tsa tus nqi ntawm "Auto" sub-property ntawm "Scale" mus rau qhov tsis tseeb (Daim duab 3) Qhov no yuav txwv tsis pub pib ntsuas rau tus pas ntsuas kub
  6. Hauv Tus Kws Tshuaj Ntsuam Xyuas teeb tsa "Max" cov khoom muaj nqis ntawm "Nplai" rau 100 (Daim duab 4) Qhov no yuav teeb tsa tus pas ntsuas kub kom muaj qhov ntsuas ntawm 0 txog 100

Kauj Ruam 8: Hauv Visuino: Qhia Kom Paub Pob Pob Tshwj Xeeb

Hauv Visuino: Txheeb cais Pob Pob Tshwj Xeeb
Hauv Visuino: Txheeb cais Pob Pob Tshwj Xeeb
Hauv Visuino: Txheeb cais Pob Pob Tshwj Xeeb
Hauv Visuino: Txheeb cais Pob Pob Tshwj Xeeb

Kom paub tseeb tias Visuino yuav pom qhov pib ntawm pob ntawv, peb yuav tsum muaj lub cim tshwj xeeb. Cov ntawv ntim khoom siv tshwj xeeb cov txheej txheem los xyuas kom meej tias lub cim cim npe tsis tshwm nyob hauv cov ntaub ntawv.

  1. Xaiv Packet1 tivthaiv (Daim duab 1)
  2. Hauv Tus Kws Saib Xyuas Lub Hom Phiaj nthuav cov cuab yeej "Head Marker" (Daim duab 1)
  3. Hauv Tus Kws Tshuaj Ntsuam Xyuas nyem rau ntawm "…" khawm (Daim duab 1)
  4. Hauv Bytes editor ntaus qee tus lej, piv txwv 55 55 (Daim duab 2)
  5. Nyem rau ntawm lub pob OK kom paub meej thiab kaw tus editor

Kauj Ruam 9: Hauv Visuino: Txuas MPU9250 Cheeb Tsam mus rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom

Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
Hauv Visuino: Txuas MPU9250 Cheeb Tsam rau Cov Ntsiab Lus ntawm Pob Ntawv Sib Koom
  1. Nyem rau hauv "Tawm" lub thawv uas muaj tus pin ntawm "Compass" ntawm AccelerometerGyroscopeCompass1 tivthaiv kom pib txuas txhua tus Pins tawm ib zaug (Duab 1)
  2. Tsiv tus nas hla "Hauv" tus pin ntawm "Elements. Compass (X)" keeb kwm ntawm Packet1 tivthaiv. Lub Visuino yuav cia li kis cov xov hlau kom lawv yuav txuas tau raug mus rau lwm tus pin (Daim duab 1)
  3. Nyem rau hauv "Tawm" lub thawv uas muaj tus pin ntawm "Accelerometer" ntawm AccelerometerGyroscopeCompass1 tivthaiv kom pib txuas txhua tus Pin tawm ib zaug (Duab 2)
  4. Tsiv tus nas hla "Hauv" tus pin ntawm "Elements. Accelerometer (X)" ntawm Packet1 tivthaiv. Lub Visuino yuav cia li kis cov xov hlau kom lawv yuav txuas tau raug mus rau lwm tus pin (Daim duab 2)
  5. Nyem rau hauv "Tawm" lub thawv uas muaj cov pins ntawm "Gyroscope" ntawm AccelerometerGyroscopeCompass1 tivthaiv kom pib txuas txhua tus Pins tawm ib zaug (Duab 3)
  6. Tsiv tus nas hla "Hauv" tus pin ntawm "Elements. Gyroscope (X)" lub ntsiab lus ntawm Packet1 tivthaiv. Lub Visuino yuav cia li kis cov xov hlau kom lawv yuav txuas tau raug mus rau cov koob ntxiv (Daim duab 3)
  7. Txuas tus "Tawm" tus pin ntawm "Tus pas ntsuas kub" ntawm AccelerometerGyroscopeCompass1 tivthaiv rau "Hauv" tus pin ntawm "Elements. Thermometer" tus pin nkag ntawm Packet1 tivthaiv (Daim duab 4)

Kauj Ruam 10: Tsim, Ua Ke, thiab Tshaj Tawm Arduino Code

Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
Tsim, Sau, thiab Tso Tawm Arduino Code
  1. Hauv Visuino, Nias F9 lossis nyem rau ntawm lub pob uas qhia ntawm daim duab 1 los tsim Arduino code, thiab qhib Arduino IDE
  2. Hauv Arduino IDE, nyem rau ntawm Upload khawm, txhawm rau sau thiab xa cov cai (Daim duab 2)

Kauj ruam 11: Thiab Ua Si …

Thiab Ua Si …
Thiab Ua Si …
Thiab Ua Si …
Thiab Ua Si …
Thiab Ua Si …
Thiab Ua Si …
  1. Hauv Visuino xaiv ComPort, thiab tom qab ntawd nyem rau ntawm "Format:" drop down box, thiab xaiv Packet1 (Daim duab 1)
  2. Nyem rau ntawm "Txuas" khawm (Daim duab 1)
  3. Yog tias koj xaiv qhov "Scope" tab, koj yuav pom Lub Scope phiaj xwm X, Y, Z qhov tseem ceeb los ntawm Accelerometer, Gyroscope, thiab Compass, ntxiv rau Kub li lub sijhawm (Daim duab 2)
  4. Yog tias koj xaiv lub "Ntsuas" tab, koj yuav pom Tus pas ntsuas kub thiab Gauges qhia tib cov ntaub ntawv (Duab 3)

Koj tuaj yeem pom qhov txuas thiab khiav MPU9250 Accelerometer, Gyroscope thiab Compass sensor ntawm daim duab 4.

Nrog koj zoo siab! Koj tau tsim MPU9250 Accelerometer, Gyroscope thiab Compass ntsuas qhov haujlwm hauv Arduino, nrog Kev Pom Pom Pom Pom.

Ntawm daim duab 5 koj tuaj yeem pom daim duab Visuino tiav.

Kuj txuas nrog yog Visuino qhov haujlwm, uas kuv tau tsim rau qhov Qhia Qhia no. Koj tuaj yeem rub tawm thiab qhib nws hauv Visuino:

Pom zoo: