Cov txheej txheem:

Gyro Sensor Tswj Platform rau Maze Puzzle: 3 Kauj Ruam
Gyro Sensor Tswj Platform rau Maze Puzzle: 3 Kauj Ruam

Video: Gyro Sensor Tswj Platform rau Maze Puzzle: 3 Kauj Ruam

Video: Gyro Sensor Tswj Platform rau Maze Puzzle: 3 Kauj Ruam
Video: Sensor Fusion for eHealth: Lec. 05 - Applications of Kalman Filters in eHealth 2024, Kaum ib hlis
Anonim
Gyro Sensor Tswj Platform rau Maze Puzzle
Gyro Sensor Tswj Platform rau Maze Puzzle

Cov lus qhia no tau tsim los ua kom tiav ntawm txoj haujlwm xav tau ntawm Kev Kawm hauv University of South Florida (www.makecourse.com)"

Qhov haujlwm yooj yim no tau tshoov siab los ntawm lub platform ntsuas tus kheej uas siv cov lus tawm tswv yim los ntawm lub ntsuas qhov ntsuas. Txheeb nws yog tias koj tsis tau ua dua.

Txoj haujlwm siv Arduino UNO - Yooj yim rau siv lub microcontroller uas koj tuaj yeem tau txais los ntawm cov vev xaib yuav khoom online! Hauv cov lus qhia no, Kuv yuav qhia koj li cas koj tuaj yeem ua rau koj tus kheej lub phiaj xwm ua kom tig tau lub ntsej muag - los ntawm cov txheej txheem tsim mus rau qhov chaw xa khoom, 3D luam ntawv cov ntaub ntawv, sib dhos, thiab ua haujlwm. Ua raws thiab cia peb mus tom ntej!

Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw

Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw
Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw
Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw
Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw
Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw
Cov Cheeb Tsam Yuav Tsum Tau thiab 3D Luam Qhov Chaw

Cov npe ntawm cov khoom siv rau txoj haujlwm:

1. Arduino UNO Microcontroller.

2. Breadboard nrog jumper xov hlau.

3. Ib lub thawv.

4. Circular platform

5. Muaj.

6. Links - 3 Tsis muaj

7. A Base rau mounting peb servos.

8. Gyro/Accelerometer sensor. (MPU6050)

9.1sq mm xov hlau (500cm) - 4 Tsis muaj

10. 3mm dia hlau pob.

Feem ntau ntawm cov khoom siv rau txoj haujlwm yog luam tawm 3D thiab kuv tau txuas nrog stl. cov ntaub ntawv npaj rau luam ntawv.

Sib sau ua ke txhua qhov raws li qhia hauv cov duab. Kev tshawb nrhiav yog kub-glued rau lub platform ncig kom zoo li hauv daim duab. Peb qhov kev pabcuam yuav tsum tau kub kub rau ntawm 3D luam tawm hauv paus uas tau teeb tsa ntawm lub hau ntawm lub npov. Lub thawv muaj Arduino UNO thiab Breadboard sib sau ua ke raws li qhia hauv daim duab. Kev teeb tsa breadboard yuav tham txog hauv cov kauj ruam tom ntej.

Tom qab sib sau ua ke, tsab ntawv kawg yuav tsum zoo li hauv daim duab kawg.

Kauj ruam 2: Teeb Breadboard

Teeb Breadboard
Teeb Breadboard
Teeb Breadboard
Teeb Breadboard
Teeb Breadboard
Teeb Breadboard

Tom qab sib dhos, Arduino, Accelerometer sensor, servos tau txuas nrog raws li tau piav qhia hauv qab no.

Txoj kab zoo thiab tsis zoo ntawm lub khob cij txuas nrog 5V thiab GND ntawm Arduino feem. Lub ntsuas tau txuas nrog Arduino siv ib nrab ntawm cov xov hlau uas yuav tsum tau muab txuas rau lub ntsuas xws li VCC thiab GND pins ntawm lub ntsuas kom txuas nrog +ve thiab -ve ntsia ntawm lub khob cij. SCL thiab SDA tus pin ntawm lub ntsuas kom txuas nrog A5 thiab A4 analog pins ntawm Arduino. PWM tus pin ntawm peb tus neeg pabcuam tau txuas nrog 2, 3, 4 tus pin ntawm Arduino feem thiab +ve thiab -ve pins ntawm txhua qhov kev pabcuam tau txuas nrog +ve thiab -ve txoj kab ntawm lub khob cij. nrog rau qhov no, peb kev sib txuas tau ua tiav.

Kauj Ruam 3: Txoj Cai rau Txoj Haujlwm

koj tuaj yeem rub tawm MPU6050 thiab Servo cov tsev qiv ntawv los ntawm Is Taws Nem thiab siv nws rau txoj haujlwm. Sau thiab xa cov cai hauv qab no mus rau Arduino thiab txoj haujlwm tau npaj tiav. Qaij lub sensor thiab koj tuaj yeem pom qhov tshawb nrhiav tig rau tib txoj kev! Nws yuav siv qee lub sijhawm los daws qhov kev sib dhos vim nws nyuaj me ntsis tab sis nws lom zem ua si nrog.

#suav nrog

#suav nrog

#suav nrog

Servo Tsav 1;

Servo Tsav 2;

Servo Tsav 3;

MPU6050 sensor;

int servoPos1 = 90;

int servoPos2 = 90;

int servoPos3 = 90;

int16_t ax, ay, az;

int16_t gx, gy, gz;

void teeb tsa ()

{

Servo1.attach (2);

Servo2.attach (3);

Servo3.attach (4);

Hlau.begin ();

Serial.begin (9600);

}

void lub voj ()

{

sensor.getMotion6 (& ax, & ay, & az, & gx, & gy, & gz);

ax = map (ax, -17000, 17000, 0, 180);

ay = daim ntawv qhia (ay, -17000, 17000, 0, 180);

Serial.print ("ax =");

Serial.print (taus);

Serial.print ("yog =");

Serial.println (ay);

yog (ax <80 && ay <80) {

Servo1.write (servoPos1 ++);

Servo2.write (servoPos2--);

Servo3.write (servoPos3--); }

yog tias (ax 120) {

Servo1.write (servoPos1--);

Servo2.write (servoPos2 ++);

Servo3.write (servoPos3--); }

yog (ax> 120 && ay> 0) {

Servo1.write (servoPos1--);

Servo2.write (servoPos2--);

Servo3.write (servoPos3 ++); }

yog (ax == 90 && ay == 90) {

Servo1.write (0);

Servo2.write (0);

Servo3.write (0);

}

}

Pom zoo: