สารบัญ:

เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน: 6 ขั้นตอน
เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน: 6 ขั้นตอน

วีดีโอ: เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน: 6 ขั้นตอน

วีดีโอ: เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน: 6 ขั้นตอน
วีดีโอ: Robot Control of 6 Axis via Smartphone การควบคุมแขนกล 6 แกนผ่านสมาร์ทโฟน 2024, กรกฎาคม
Anonim
เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน
เกม Robotic Arm - ตัวควบคุมสมาร์ทโฟน

สวัสดี !

มาแล้วเกมฤดูร้อนแสนสนุก: The Robotic Arm ควบคุมด้วยสมาร์ทโฟน !!

ดังที่คุณเห็นในวิดีโอ คุณสามารถควบคุม Arm ด้วยจอยสติ๊กบนสมาร์ทโฟนของคุณได้

คุณยังสามารถบันทึกรูปแบบที่หุ่นยนต์จะทำซ้ำแบบวนซ้ำเพื่อทำงานซ้ำๆ เป็นตัวอย่าง แต่ลายนี้ปรับเปลี่ยนได้ตามใจชอบ !!!!

มีความคิดสร้างสรรค์ !

ขั้นตอนที่ 1: วัสดุ

วัสดุ
วัสดุ

คุณสามารถดูวัสดุที่คุณต้องการได้ที่นี่

คุณจะต้องเสียค่าใช้จ่ายประมาณ 50 ยูโรเพื่อสร้างแขนหุ่นยนต์นี้ ซอฟต์แวร์และเครื่องมือสามารถถูกแทนที่ได้ แต่ฉันใช้มันสำหรับโครงการนี้

ขั้นตอนที่ 2: 3D พิมพ์แขนหุ่นยนต์

3D พิมพ์แขนหุ่นยนต์
3D พิมพ์แขนหุ่นยนต์
3D พิมพ์แขนหุ่นยนต์
3D พิมพ์แขนหุ่นยนต์
3D พิมพ์แขนหุ่นยนต์
3D พิมพ์แขนหุ่นยนต์

Robotic Arm ถูกพิมพ์ 3 มิติ (ด้วย prusa i3) ของเรา

ต้องขอบคุณเว็บไซต์ "HowtoMechatronics.com" ที่ทำให้ไฟล์ STL ของเขายอดเยี่ยมในการสร้างแขน 3 มิติ

จะใช้เวลาประมาณ 20 ชั่วโมงในการพิมพ์ชิ้นงานทั้งหมด

ขั้นตอนที่ 3: การตัดต่อแบบอิเล็กทรอนิกส์

การตัดต่ออิเล็กทรอนิกส์
การตัดต่ออิเล็กทรอนิกส์

การตัดต่อจะแบ่งเป็น 2 ส่วนคือ

ชิ้นส่วนอิเล็กทรอนิกส์ที่ Arduino เชื่อมต่อกับเซอร์โวโดย Digital Pins และกับอุปกรณ์ Bluetooth (Rx, Tx)

ส่วนจ่ายไฟที่เซอร์โวขับเคลื่อนด้วยเครื่องชาร์จโทรศัพท์ 2 เครื่อง (สูงสุด 5V, 2A)

ขั้นตอนที่ 4: แอปพลิเคชันสมาร์ทโฟน

แอปพลิเคชันสมาร์ทโฟน
แอปพลิเคชันสมาร์ทโฟน

แอปพลิเคชันถูกสร้างขึ้นบน App inventor 2. เราใช้ 2 Joystick เพื่อควบคุม 4 Servos และอีก 2 ปุ่มเพื่อควบคุม Grip สุดท้าย

เราเชื่อมต่อ Arm และ Smartphone เข้าด้วยกันโดยใช้โมดูล Bluetooth (HC-06)

สุดท้ายโหมดประหยัดช่วยให้ผู้ใช้บันทึกตำแหน่งแขนได้ถึง 9 ตำแหน่ง

จากนั้นแขนจะเข้าสู่โหมดอัตโนมัติ ซึ่งเขาจะทำซ้ำตำแหน่งที่บันทึกไว้

ขั้นตอนที่ 5: รหัส Arduino

รหัส Arduino
รหัส Arduino
รหัส Arduino
รหัส Arduino

// 08/19 - แขนกลควบคุมด้วยสมาร์ทโฟน

#รวม #define TRUE จริง #define FALSE เท็จ //********************** ประกาศ ***************** ***********

ตัวแทนคำ; // mot envoyé du module Arduino au สมาร์ทโฟน

int chiffre_final = 0; int cmd=3; // ตัวแปร commande du servo moteur (troisième fil (สีส้ม, jaune)) int cmd1=5; // servo1 int cmd2=9; // servo2 int cmd3=10; // servo3 //int cmd4=10; //servo4 int cmd5=11; // ตรึง int activate_saving = 0; เซอร์โว moteur; //บน définit notre servomoteur Servo moeur1; เซอร์โว moteur2; เซอร์โว moteur3; //เซอร์โว moteur4; เซอร์โว moteur5; int step_angle_mini = 4; int step_angle = 3; มุม int, มุม 1, มุม 3, มุม 5, มุม 2;// มุม int pas; int r, r1, r2, r3; ผู้ลงทะเบียนภายใน; ครีบบูลีน = FALSE; บูลีน fin1 = FALSE; บูลีน fin2 = FALSE; บูลีน fin3 = FALSE; บูลีน fin4 = FALSE; คำ w; // ตัวแปร envoyé du สมาร์ทโฟน au โมดูล Arduino int sauvegarde_positions1[5]; int sauvegarde_positions2[5]; int sauvegarde_positions3[5]; int sauvegarde_positions4[5]; int sauvegarde_positions5[5]; int sauvegarde_positions6[5]; int sauvegarde_positions7[5]; int sauvegarde_positions8[5]; int sauvegarde_positions9[5];

// มุม int; // การหมุนมุม (0 a 180)

//********************ติดตั้ง*************************** ******** การตั้งค่าเป็นโมฆะ () { sauvegarde_positions1[0] = sauvegarde_positions1[1] = sauvegarde_positions1[2] = sauvegarde_positions1[3] = sauvegarde_positions1[4] = 0; sauvegarde_positions2[0] = sauvegarde_positions2[1] = sauvegarde_positions2[2] = sauvegarde_positions2[3] = sauvegarde_positions2[4] = 0; sauvegarde_positions3[0] = sauvegarde_positions3[1] = sauvegarde_positions3[2] = sauvegarde_positions3[3] = sauvegarde_positions3[4] = 0; sauvegarde_positions4[0] = sauvegarde_positions4[1] = sauvegarde_positions4[2] = sauvegarde_positions4[3] = sauvegarde_positions4[4] = 0; sauvegarde_positions5[0] = sauvegarde_positions5[1] = sauvegarde_positions5[2] = sauvegarde_positions5[3] = sauvegarde_positions5[4] = 0; sauvegarde_positions6[0] = sauvegarde_positions6[1] = sauvegarde_positions6[2] = sauvegarde_positions6[3] = sauvegarde_positions6[4] = 0; sauvegarde_positions7[0] = sauvegarde_positions7[1] = sauvegarde_positions7[2] = sauvegarde_positions7[3] = sauvegarde_positions7[4] = 0; sauvegarde_positions8[0] = sauvegarde_positions8[1] = sauvegarde_positions8[2] = sauvegarde_positions8[3] = sauvegarde_positions8[4] = 0; sauvegarde_positions9[0] = sauvegarde_positions9[1] = sauvegarde_positions9[2] = sauvegarde_positions9[3] = sauvegarde_positions9[4] = 0; moteur.attach(cmd); // บน relie l'objet au pin de commande moteur1.attach(cmd1); moteur2.attach(cmd2); moteur3.attach(cmd3); // moteur4.attach(cmd4); moteur5.attach(cmd5); moteur.write(6); มุม = 6; moteur1.write(100); มุม 1 = 100; moteur2.write(90); moteur3.write(90); //moteur4.write(12); moteur5.write(90); มุม=6; มุม 1=100; มุม2= 90; มุม3=90; มุม5=90; Serial.begin(9600); // permettra de communiquer au โมดูล Bluetooth } //********************** BOUCLE****************** ***************** วงเป็นโมฆะ () {

// Serial.print (" มุม");

//Serial.print(มุม);Serial.print (" \t");Serial.print(angle1);Serial.print (" \t");Serial.print(angle2);Serial.print (" \t ");Serial.print(มุม3);Serial.print (" \t");Serial.print(angle5);Serial.print (" \n");

//Serial.print("มุม");

int ฉัน; w=recevoir(); // บน va recevoir une data du smartphone, la variable w switch (w) { กรณีที่ 1: TouchDown_Release (); break; กรณีที่ 2: TouchDown_Grab();แตก; กรณีที่ 3: Base_Rotation();break; กรณีที่ 4: Base_AntiRotation();แตก; กรณีที่ 5: Waist_Rotation();break; กรณีที่ 6: Waist_AntiRotation();แตก; กรณีที่ 7: Third_Arm_Rotation();break; กรณีที่ 8: Third_Arm_AntiRotation();break; กรณีที่ 9: Fourth_Arm_Rotation();break; กรณีที่ 10: Fourth_Arm_AntiRotation(); แตก; //กรณีที่ 11: Fifth_Arm_Rotation();break; //กรณีที่ 12: Fifth_Arm_AntiRotation();break; กรณีที่ 21: Serial.print("ปุ่มตัวพิมพ์ 1 ");chiffre_final = 1;sauvegarde_positions1[0] =angle;sauvegarde_positions1[1] =angle1;sauvegarde_positions1[2] =angle2;sauvegarde_positions1[3] =angle3;sauvegarde_positions1 =angle5;Serial.println(sauvegarde_positions1[1]);Serial.println(sauvegarde_positions1[2]);Serial.println(sauvegarde_positions1[3]);Serial.println(sauvegarde_positions1[4]); =มุม5;Serial.println(sauvegarde_positions1[3]);Serial.println(sauvegarde_positions1[4]); หยุดพัก; กรณีที่ 22: chiffre_final = 2;sauvegarde_positions2[0] =angle;sauvegarde_positions2[1] =angle1;sauvegarde_positions2[2] =angle2;sauvegarde_positions2[3] =angle3;sauvegarde_positions2[4] =angle5; หยุดพัก; กรณีที่ 23: chiffre_final = 3;sauvegarde_positions3[0] =angle;sauvegarde_positions3[1] =angle1;sauvegarde_positions3[2] =angle2;sauvegarde_positions3[3] =angle3;sauvegarde_positions3[4] =angle5;break; กรณีที่ 24: chiffre_final = 4;sauvegarde_positions4[0] =angle;sauvegarde_positions4[1] =angle1;sauvegarde_positions4[2] =angle2;sauvegarde_positions4[3] =angle3;sauvegarde_positions4[4] =angle5; หยุดพัก; กรณีที่ 25: chiffre_final = 5;sauvegarde_positions5[0] =angle;sauvegarde_positions5[1] =angle1;sauvegarde_positions5[2] =angle2;sauvegarde_positions5[3] =angle3;sauvegarde_positions5[4] =angle5; หยุดพัก; กรณีที่ 26: chiffre_final = 6;sauvegarde_positions6[0] =angle;sauvegarde_positions6[1] =angle1;sauvegarde_positions6[2] =angle2;sauvegarde_positions6[3] =angle3;sauvegarde_positions6[4] =angle5; หยุดพัก; กรณีที่ 27: chiffre_final = 7;sauvegarde_positions7[0] =angle;sauvegarde_positions7[1] =angle1;sauvegarde_positions7[2] =angle2;sauvegarde_positions7[3] =angle3;sauvegarde_positions7[4] =angle5; หยุดพัก; กรณีที่ 28: chiffre_final = 8;sauvegarde_positions8[0] =angle;sauvegarde_positions8[1] =angle1;sauvegarde_positions8[2] =angle2;sauvegarde_positions8[3] =angle3;sauvegarde_positions8[4] =angle5; หยุดพัก; กรณีที่ 29: chiffre_final = 9;sauvegarde_positions9[0] =angle;sauvegarde_positions9[1] =angle1;sauvegarde_positions9[2] =angle2;sauvegarde_positions9[3] =angle3;sauvegarde_positions9[4] =angle5; หยุดพัก;

กรณีที่ 31: Serial.print("31");activate_saving = 1;chiffre_final = 0; แตก;// BEGIN

กรณีที่ 33: Serial.print("33");activate_saving = 0; แตก;// ปุ่มบันทึกเริ่มต้น: แตก; } if(w == 32) { Serial.print("\nReproduce\nChiffre final: "); Serial.print(chiffre_final); Serial.print("\n Sauvegarde ตำแหน่ง 1: \n"); for(i=0;i<5;i++){ Serial.print(sauvegarde_positions1);Serial.print("\t");} Serial.print("\n ตำแหน่ง Sauvegarde 2: \n"); for(i=0;i<5;i++){ Serial.print(sauvegarde_positions2);Serial.print("\t");} Serial.print("\n ตำแหน่ง Sauvegarde 3: \n"); สำหรับ(i=0;i<5;i++){ Serial.print(sauvegarde_positions3);Serial.print("\t");} สำหรับ (i = 1;i<=chiffre_final;i++) { Serial. พิมพ์ (" \n\n เริ่มต้น \nLoop: "); Serial.print(i);อนุกรม.print("\n"); สวิตช์(i) { กรณีที่ 1: goto_moteur(*(sauvegarde_positions1));delay(200); goto_moteur1(*(sauvegarde_positions1+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions1+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions1+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions1+4));ล่าช้า(200); หยุดพัก; กรณีที่ 2: goto_moteur(*(sauvegarde_positions2));delay(200); goto_moteur1(*(sauvegarde_positions2+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions2+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions2+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions2+4));ล่าช้า(200); หยุดพัก; กรณีที่ 3: goto_moteur(*(sauvegarde_positions3));delay(200); goto_moteur1(*(sauvegarde_positions3+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions3+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions3+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions3+4));ล่าช้า(200); หยุดพัก; กรณีที่ 4: goto_moteur(*(sauvegarde_positions4));delay(200); goto_moteur1(*(sauvegarde_positions4+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions4+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions4+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions4+4));ล่าช้า(200); หยุดพัก; กรณีที่ 5: goto_moteur(*(sauvegarde_positions5));delay(200); goto_moteur1(*(sauvegarde_positions5+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions5+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions5+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions5+4));ล่าช้า(200); หยุดพัก; กรณีที่ 6: goto_moteur(*(sauvegarde_positions6));delay(200); goto_moteur1(*(sauvegarde_positions6+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions6+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions6+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions6+4));ล่าช้า(200); หยุดพัก; กรณีที่ 7: goto_moteur(*(sauvegarde_positions7));delay(200); goto_moteur1(*(sauvegarde_positions7+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions7+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions7+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions7+4));ล่าช้า(200); หยุดพัก; กรณีที่ 8: goto_moteur(*(sauvegarde_positions8));delay(200); goto_moteur1(*(sauvegarde_positions8+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions8+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions8+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions8+4));ล่าช้า(200); หยุดพัก; กรณีที่ 9: goto_moteur(*(sauvegarde_positions9));delay(200); goto_moteur1(*(sauvegarde_positions9+1)); ล่าช้า(200); goto_moteur2(*(sauvegarde_positions9+2));ล่าช้า(200); goto_moteur3(*(sauvegarde_positions9+3)); ล่าช้า(200); goto_moteur5(*(sauvegarde_positions9+4));ล่าช้า(200); หยุดพัก; } Serial.print("\n*********************** FIN REPRODUCE ******************* \NS "); ล่าช้า (500); } } /*Serial.print (" เปิดตัว\n"); Serial.print(sauvegarde_positions1[0]);Serial.print (" \t");Serial.print(sauvegarde_positions1[1]);Serial.print (" \t");Serial.print(sauvegarde_positions1[2]); อนุกรม.print(sauvegarde_positions1[0]); Serial.print (" \t");Serial.print(sauvegarde_positions1[3]);Serial.print (" \t");Serial.print(sauvegarde_positions1[4]);Serial.print (" \n"); Serial.print(sauvegarde_positions2[0]);Serial.print (" \t");Serial.print(sauvegarde_positions2[1]);Serial.print (" \t");Serial.print(sauvegarde_positions2[2]); อนุกรม.print(sauvegarde_positions2[0]); Serial.print (" \t");Serial.print(sauvegarde_positions2[3]);Serial.print (" \t");Serial.print(sauvegarde_positions2[4]);Serial.print (" \n"); Serial.print(sauvegarde_positions3[0]);Serial.print (" \t");Serial.print(sauvegarde_positions3[1]);Serial.print (" \t");Serial.print(sauvegarde_positions3[2]); อนุกรม.print(sauvegarde_positions3[0]); Serial.print (" \t");Serial.print(sauvegarde_positions3[3]);Serial.print (" \t");Serial.print(sauvegarde_positions3[4]);Serial.print (" \n"); Serial.print(sauvegarde_positions4[0]);Serial.print (" \t");Serial.print(sauvegarde_positions4[1]);Serial.print (" \t");Serial.print(sauvegarde_positions4[2]); อนุกรม.print(sauvegarde_positions4[0]); Serial.print (" \t");Serial.print(sauvegarde_positions4[3]);Serial.print (" \t");Serial.print(sauvegarde_positions4[4]);Serial.print (" \n");

Serial.print("\nfin\n");*/

ล่าช้า (100); } //****************************************************************** ******************

คำ recevoir () {// fonction permettant de recevoir l'information du สมาร์ทโฟน

ถ้า (Serial.available ()) { w = Serial.read ();

Serial.flush();

กลับ w; }}

เป็นโมฆะ goto_moteur (int angle_destination)

{ ในขณะที่ (angle_destination angle+step_angle) { Serial.print(" \n --------------* * * * * *------------ ----\NS"); Serial.print("angle_destination = \t "); Serial.print(angle_destination); Serial.print("\n angle1 = \t ");Serial.print(มุม); if(angle_destination angle +step_angle){ angle = angle + step_angle;moteur.write(angle);} ล่าช้า (100); } moteur.write(angle_destination); } เป็นโมฆะ goto_moteur1(int angle_destination) { ในขณะที่ (angle_destination angle1+step_angle) { Serial.print(" \n --------------* * * * * *------- -----------\NS"); Serial.print("angle_destination = \t "); Serial.print(angle_destination); Serial.print("\n angle2 = \t ");Serial.print(มุม1); ถ้า(angle_destination angle1 +step_angle){angle1 += step_angle; moteur1.write(angle1);;} ล่าช้า (100); } moteur1.write(angle_destination); } เป็นโมฆะ goto_moteur2 (int angle_destination) {

ในขณะที่ (angle_destination angle2+step_angle)

{ Serial.print(" \n --------------* * * * * * ------------------\n"); Serial.print("angle_destination = \t "); Serial.print(angle_destination); Serial.print("\n angle3 = \t ");Serial.print(มุม2); ถ้า(angle_destination angle2 +step_angle){angle2+=step_angle; moteur2.write(angle2);} ล่าช้า (100); } moteur2.write(angle_destination); } เป็นโมฆะ goto_moteur3 (int angle_destination) {

ในขณะที่ (angle_destination angle3+step_angle)

{ Serial.print(" \n --------------* * * * * * ------------------\n"); Serial.print("angle_destination = \t "); Serial.print(angle_destination); Serial.print("\n angle4 = \t ");Serial.print(มุม3); ถ้า(angle_destination angle3 +step_angle){angle3+=step_angle; moteur3.write(angle3);} ล่าช้า (100); } moteur3.write(angle_destination); } เป็นโมฆะ goto_moteur5 (int angle_destination) {

ในขณะที่ (angle_destination angle5+step_angle)

{ Serial.print(" \n --------------* * * * * * ------------------\n"); Serial.print("angle_destination = \t "); Serial.print(angle_destination); Serial.print("\n angle5 = \t ");Serial.print(มุม5); ถ้า(angle_destination angle5 +step_angle){angle5+=step_angle; moteur5.write(angle5);} ล่าช้า (100); } moteur5.write(angle_destination); }

ถือเป็นโมฆะ TouchDown_Release () // การปล่อยปุ่มทัชดาวน์

{ ถ้า (มุม 5 < 180) { มุม 5 = มุม 5 + ขั้นตอน_มุม_มินิ; } moteur5.write(angle5); }

ถือเป็นโมฆะ TouchDown_Grab () // ปุ่มทัชดาวน์ Grab

{ ถ้า (มุม 5 > 0) { มุม 5 = มุม 5 ขั้นตอน_มุม_มินิ; } moteur5.write(angle5); } โมฆะ Base_Rotation () { ถ้า (มุม 0) { มุม = มุม-step_angle; } มุมอื่น =0; moteur.write(มุม); } โมฆะ Waist_Rotation () { ถ้า (angle1 20) { angle1 = angle1-step_angle; } มุมอื่น 1 = 20; moteur1.write(มุม1); } เป็นโมฆะ Third_Arm_Rotation () { if (angle2 0) { angle2 = angle2-step_angle; } moteur2.write(มุม2); } เป็นโมฆะ Fourth_Arm_Rotation () { if (angle3 = 0) { angle3 = angle3-step_angle_mini; } moteur3.write(มุม3); }

ขั้นตอนที่ 6: แค่นั้นแหละ

ขอบคุณสำหรับการรับชม ฉันหวังว่าคุณจะชื่นชม!

หากคุณชอบคำแนะนำนี้คุณสามารถเยี่ยมชมเราได้อย่างแน่นอน! =)

แนะนำ: