Cov txheej txheem:

MPU6050-Accelerometer+Gyroscope Sensor Basics: 3 Kauj Ruam
MPU6050-Accelerometer+Gyroscope Sensor Basics: 3 Kauj Ruam

Video: MPU6050-Accelerometer+Gyroscope Sensor Basics: 3 Kauj Ruam

Video: MPU6050-Accelerometer+Gyroscope Sensor Basics: 3 Kauj Ruam
Video: 14 | Measure angles with the MPU6050 accelerometer 2024, Kaum ib hlis
Anonim
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics
MPU6050-Accelerometer+Gyroscope Sensor Basics

MPU6050 yog qhov ntsuas tau zoo heev.

Mpu 6050 yog IMU: Chav ntsuas inertial (IMU) yog cov cuab yeej siv hluav taws xob uas ntsuas thiab tshaj tawm lub cev tshwj xeeb lub zog, tus lej kaum, thiab qee zaum kev taw qhia ntawm lub cev, siv kev sib xyaw ua ke ntawm lub ntsuas, ntsuas lub ntsej muag.

Nws yog 6 axis ntaus ntawv

3 ntawm txoj kab tuaj yeem ntsuas nrawm thiab lwm 3 yog rau kev ntsuas nrawm nrawm.

Siv qhov nrawm thiab nrawm nrawm nws tuaj yeem tau txais qhov kwv yees raug qhov tseeb ntawm lub kaum ntse ntse

Hauv qhov kev qhia no peb yuav tshawb nrhiav seb peb yuav siv MPU6050 nrog lub tsev qiv ntawv li cas kom yooj yim dua.

Khoom siv

  1. Arduino pawg thawj coj saib
  2. PIB 6050
  3. Jumper xov hlau
  4. Cov qhob cij

Kauj ruam 1: Ua kom tiav Circuit Court

Ua kom tiav Circuit Court
Ua kom tiav Circuit Court

Lub sensor siv tus txheej txheem hu ua I2c txhawm rau sib txuas lus nrog Arduino kom xa nws qhov txiaj ntsig.

Tus lej A4 tau siv rau SCL- lub moos txuas thiab yuav tsum txuas nrog SCL ntawm lub ntsuas thiab, A5 rau SDA-Serial cov ntaub ntawv kab.

Vcc txuas nrog 5v thiab Gnd txuas nrog hauv av

Kauj ruam 2: Coding

Coding
Coding

#ncig #ncig

Ua ntej kuv pib, lub tsev qiv ntawv no tsis tau sau los ntawm kuv, kuv tsuas yog xav tias nws yog qhov yooj yim tshaj plaws nyob ntawd thiab nyiam siv nws.

Cov no yog cov ntawv header ^^, wire.h yog siv los tsim kev sib txuas lus i2c

MPU6050 mpu6050 (Hlau);

nov peb lub npe peb lub gyroscope, lossis tsim ib qho khoom rau cov uas muaj kev lom zem nrog OOPs.

void teeb tsa () {

Serial.begin (9600); Hlau.begin (); mpu6050.begin (); mpu6050.calcGyroOffsets (muaj tseeb); }

Thaum xub thawj peb xam cov offsets txij li txhua qhov kev nyeem lub kaum sab xis yuav tsum hwm nrog thawj qhov kev taw qhia.

void voj () {

mpu6050.update (); Serial.print ("angleX:"); Serial.print (mpu6050.getAngleX ()); Serial.print ("\ tangleY:"); Serial.print (mpu6050.getAngleY ()); Serial.print ("\ tangleZ:"); Serial.println (mpu6050.getAngleZ ()); }

Txhua tus muab rau peb ntsuas ntawm lub kaum sab xis.

Kauj Ruam 3: Lwm Yam Haujlwm

Lub tsev qiv ntawv muaj lwm txoj haujlwm

zoo li:

mpu6050.getTemp () // muab qhov kub (tsis yog qhov tseeb)

mpu6050.getAccX () // Tawm nrawm hauv X kev taw qhia

(cov haujlwm zoo sib xws yog mpu6050.getAccY (), mpu6050.getAccZ ())

mpu6050.getGyroX () // Angular acceleration txog x axis

(cov haujlwm zoo sib xws yog mpu6050.getGyroY (), mpu6050.getGyroZ ())

Pom zoo: