Obsah:

Robotická paže - Smartphone Controller: 6 kroků
Robotická paže - Smartphone Controller: 6 kroků

Video: Robotická paže - Smartphone Controller: 6 kroků

Video: Robotická paže - Smartphone Controller: 6 kroků
Video: The Duel: Timo Boll vs. KUKA Robot 2024, Červenec
Anonim
Robotic Arm Game - Smartphone Controller
Robotic Arm Game - Smartphone Controller

Ahoj !

Tady zábavná letní hra: Robotické rameno ovládané chytrým telefonem !!

Jak vidíte na videu, můžete rameno ovládat některými joysticky na smartphonu.

Můžete také uložit vzor, který bude robot reprodukovat ve smyčce, aby mohl například provádět některé opakující se úkoly. Ale tento vzor je modulovatelný, jak si přejete !!!!

Být kreativní !

Krok 1: Materiály

Materiály
Materiály

Zde vidíte materiál, který potřebujete.

Postavení této robotické paže vás bude stát přibližně 50 EUR. Software a nástroje lze vyměnit, ale já jsem je použil pro tento projekt.

Krok 2: 3D tisk robotické paže

3D tisk robotické paže
3D tisk robotické paže
3D tisk robotické paže
3D tisk robotické paže
3D tisk robotické paže
3D tisk robotické paže

Robotické rameno bylo vytištěno 3D (s naší prusa i3).

Díky webové stránce „HowtoMechatronics.com“jsou jeho soubory STL skvělé pro vybudování 3D paže.

Vytištění všech kusů bude trvat přibližně 20 hodin.

Krok 3: Elektronická montáž

Elektronická montáž
Elektronická montáž

Montáž je rozdělena na 2 části:

Elektronická část, kde je arduino připojeno k servům pomocí digitálních pinů a se zařízením Bluetooth (Rx, Tx).

Napájecí část, kde jsou serva napájena 2 nabíječkami telefonů (5 V, 2 A max.).

Krok 4: Aplikace pro smartphone

Aplikace pro chytré telefony
Aplikace pro chytré telefony

Aplikace byla vytvořena na App inventor 2. Pomocí 2 joysticku ovládáme 4 serva a 2 další tlačítka pro ovládání finálního Gripu.

Arm a Smartphone spojíme dohromady pomocí modulu Bluetooth (HC-06).

Nakonec režim úspory umožňuje uživateli uložit až 9 pozic pro paži.

Rameno poté přejde do automatického režimu, kde bude reprodukovat uložené pozice.

Krok 5: Kód Arduino

Kód Arduino
Kód Arduino
Kód Arduino
Kód Arduino

// 08/19 - Robotické rameno Ovládáno chytrým telefonem

#include #define TRUE true #define FALSE false // ********************* PROHLÁŠENÍ ***************** ***********

opakování slov; // mot envoyé du module Arduino au smartphone

int chiffre_final = 0; int cmd = 3; // proměnná commande du servo moteur (troisième fil (orange, jaune)) int cmd1 = 5; // servo1 int cmd2 = 9; // servo2 int cmd3 = 10; // servo3 // int cmd4 = 10; // servo4 int cmd5 = 11; // pince int activate_saving = 0; Servomotor; // na définit notre servomoteur Servo moteur1; Servo moteur2; Servo moteur3; // Servo moteur4; Servo moteur5; int step_angle_mini = 4; int step_angle = 3; int úhel, úhel1, úhel3, úhel5, úhel2; // úhel int pas; int r, r1, r2, r3; int registrátor; booleovská ploutev = NEPRAVDA; boolean fin1 = NEPRAVDA; boolean fin2 = FALSE; boolean fin3 = NEPRAVDA; boolean fin4 = NEPRAVDA; slovo w; // proměnná envoyé du smartphone au module 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 úhel; // úhel natočení (0 a 180)

//********************ZALOŽIT*************************** ******** neplatné nastavení () {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); // na 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); úhel = 6; moteur1.write (100); úhel1 = 100; moteur2.write (90); moteur3.write (90); //moteur4.write(12); moteur5.write (90); úhel = 6; úhel1 = 100; úhel2 = 90; úhel3 = 90; úhel5 = 90; Serial.begin (9600); // permettra de communiquer au module Bluetooth} // ******************** BOUCLE ****************** ***************** void loop () {

// Serial.print ("úhel");

//Serial.print(angle);Serial.print ("\ t"); Serial.print (angle1); Serial.print ("\ t"); Serial.print (angle2); Serial.print ("\ t "); Serial.print (úhel3); Serial.print (" / t "); Serial.print (úhel5); Serial.print (" / n ");

//Serial.print("angle ");

int i; w = recevoir (); // při přijímání různých informací o chytrém telefonu, la proměnná w přepínač (w) {případ 1: TouchDown_Release (); break; případ 2: TouchDown_Grab (); break; případ 3: Base_Rotation (); break; případ 4: Base_AntiRotation (); break; případ 5: Waist_Rotation (); break; případ 6: Waist_AntiRotation (); break; případ 7: Third_Arm_Rotation (); break; případ 8: Third_Arm_AntiRotation (); break; případ 9: Fourth_Arm_Rotation (); break; případ 10: Fourth_Arm_AntiRotation (); break; // případ 11: Fifth_Arm_Rotation (); break; // případ 12: Fifth_Arm_AntiRotation (); break; případ 21: Serial.print ("tlačítko případu 1"); chiffre_final = 1; sauvegarde_positions1 [0] = úhel; sauvegarde_positions1 [1] = úhel1; sauvegarde_positions1 [2] = úhel2; sauvegarde_positions1 [3] = úhel3; [sauvegarde_ = úhel5; Serial.println (sauvegarde_positions1 [1]); Serial.println (sauvegarde_positions1 [2]); Serial.println (sauvegarde_positions1 [3]); Serial.println (sauvegarde_positions1 [4]); přestávka; případ 22: chiffre_final = 2; sauvegarde_positions2 [0] = úhel; sauvegarde_positions2 [1] = úhel1; sauvegarde_positions2 [2] = úhel2; sauvegarde_positions2 [3] = úhel3; sauvegarde_positions2 [4] = úhel5; přestávka; případ 23: chiffre_final = 3; sauvegarde_positions3 [0] = úhel; sauvegarde_positions3 [1] = úhel1; sauvegarde_positions3 [2] = úhel2; sauvegarde_positions3 [3] = úhel3; sauvegarde_positions3 [4] = úhel5; případ 24: chiffre_final = 4; sauvegarde_positions4 [0] = úhel; sauvegarde_positions4 [1] = úhel1; sauvegarde_positions4 [2] = úhel2; sauvegarde_positions4 [3] = úhel3; sauvegarde_positions4 [4] = úhel5; přestávka; případ 25: chiffre_final = 5; sauvegarde_positions5 [0] = úhel; sauvegarde_positions5 [1] = úhel1; sauvegarde_positions5 [2] = úhel2; sauvegarde_positions5 [3] = úhel3; sauvegarde_positions5 [4] = úhel5; přestávka; případ 26: chiffre_final = 6; sauvegarde_positions6 [0] = úhel; sauvegarde_positions6 [1] = úhel1; sauvegarde_positions6 [2] = úhel2; sauvegarde_positions6 [3] = úhel3; sauvegarde_positions6 [4] = úhel5; přestávka; případ 27: chiffre_final = 7; sauvegarde_positions7 [0] = úhel; sauvegarde_positions7 [1] = úhel1; sauvegarde_positions7 [2] = úhel2; sauvegarde_positions7 [3] = úhel3; sauvegarde_positions7 [4] = úhel5; přestávka; případ 28: chiffre_final = 8; sauvegarde_positions8 [0] = úhel; sauvegarde_positions8 [1] = úhel1; sauvegarde_positions8 [2] = úhel2; sauvegarde_positions8 [3] = úhel3; sauvegarde_positions8 [4] = úhel5; přestávka; případ 29: chiffre_final = 9; sauvegarde_positions9 [0] = úhel; sauvegarde_positions9 [1] = úhel1; sauvegarde_positions9 [2] = úhel2; sauvegarde_positions9 [3] = úhel3; sauvegarde_positions9 [4] = úhel5; přestávka;

případ 31: Serial.print ("31"); activate_saving = 1; chiffre_final = 0; break; // ZAČÍT

případ 33: Serial.print ("33"); activate_saving = 0; break; // BUTTON SAVE default: break; } if (w == 32) {Serial.print ("\ nReproduce / nChiffre final:"); Serial.print (chiffre_final); Serial.print ("\ n pozice Sauvegarde 1: / n"); for (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions1 ); Serial.print ("\ t");} Serial.print ("\ n Sauvegarde position 2: / n"); for (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions2 ); Serial.print ("\ t");} Serial.print ("\ n Sauvegarde position 3: / n"); for (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions3 ); Serial.print ("\ t");} for (i = 1; i <= chiffre_final; i ++) {Serial. tisk ("\ n / n ZAČÍT / nSmyčka:"); Serial.print (i); Serial.print ("\ n"); switch (i) {case 1: goto_moteur (*(sauvegarde_positions1)); delay (200); goto_moteur1 (*(sauvegarde_positions1+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions1+2)); delay (200); goto_moteur3 (*(sauvegarde_positions1+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions1+4)); delay (200); přestávka; případ 2: goto_moteur (*(sauvegarde_positions2)); delay (200); goto_moteur1 (*(sauvegarde_positions2+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions2+2)); delay (200); goto_moteur3 (*(sauvegarde_positions2+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions2+4)); zpoždění (200); přestávka; případ 3: goto_moteur (*(sauvegarde_positions3)); delay (200); goto_moteur1 (*(sauvegarde_positions3+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions3+2)); zpoždění (200); goto_moteur3 (*(sauvegarde_positions3+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions3+4)); delay (200); přestávka; případ 4: goto_moteur (*(sauvegarde_positions4)); delay (200); goto_moteur1 (*(sauvegarde_positions4+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions4+2)); delay (200); goto_moteur3 (*(sauvegarde_positions4+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions4+4)); zpoždění (200); přestávka; případ 5: goto_moteur (*(sauvegarde_positions5)); delay (200); goto_moteur1 (*(sauvegarde_positions5+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions5+2)); zpoždění (200); goto_moteur3 (*(sauvegarde_positions5+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions5+4)); delay (200); přestávka; případ 6: goto_moteur (*(sauvegarde_positions6)); delay (200); goto_moteur1 (*(sauvegarde_positions6+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions6+2)); delay (200); goto_moteur3 (*(sauvegarde_positions6+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions6+4)); delay (200); přestávka; případ 7: goto_moteur (*(sauvegarde_positions7)); delay (200); goto_moteur1 (*(sauvegarde_positions7+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions7+2)); delay (200); goto_moteur3 (*(sauvegarde_positions7+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions7+4)); zpoždění (200); přestávka; případ 8: goto_moteur (*(sauvegarde_positions8)); delay (200); goto_moteur1 (*(sauvegarde_positions8+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions8+2)); delay (200); goto_moteur3 (*(sauvegarde_positions8+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions8+4)); delay (200); přestávka; případ 9: goto_moteur (*(sauvegarde_positions9)); delay (200); goto_moteur1 (*(sauvegarde_positions9+1)); zpoždění (200); goto_moteur2 (*(sauvegarde_positions9+2)); delay (200); goto_moteur3 (*(sauvegarde_positions9+3)); zpoždění (200); goto_moteur5 (*(sauvegarde_positions9+4)); delay (200); přestávka; } Serial.print ("\ n ************************ FIN REPRODUCE ***************** / n "); zpoždění (500); }} /*Serial.print ("debut / n"); Serial.print (sauvegarde_positions1 [0]); Serial.print ("\ t"); Serial.print (sauvegarde_positions1 [1]); Serial.print ("\ t"); Serial.print (sauvegarde_positions1 [2]); 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]); 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]); 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]); Serial.print ("\ t"); Serial.print (sauvegarde_positions4 [3]); Serial.print ("\ t"); Serial.print (sauvegarde_positions4 [4]); Serial.print ("\ n");

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

zpoždění (100); } // ********************************************************* ******************

word recevoir () {// typ permettant de recevoir l'information du smartphone

if (Serial.available ()) {w = Serial.read ();

Serial.flush ();

návrat w; }}

void goto_moteur (int úhel_destinace)

{while (angle_destination angle+step_angle) {Serial.print ("\ n -------------- * * * * * * * -------------- ---- / n "); Serial.print ("angle_destination = / t"); Serial.print (úhel_cíle); Serial.print ("\ n angle1 = / t"); Serial.print (úhel); if (angle_destination angle + step_angle) {angle = angle + step_angle; moteur.write (angle);} delay (100); } moteur.write (úhel_cíle); } void goto_moteur1 (int angle_destination) {while (angle_destination angle1+step_angle) {Serial.print ("\ n -------------- * * * * * * * ------- ----------- / n "); Serial.print ("angle_destination = / t"); Serial.print (úhel_cíle); Serial.print ("\ n angle2 = / t"); Serial.print (úhel1); if (angle_destination angle1 +step_angle) {angle1 += step_angle; moteur1.write (úhel1);;} zpoždění (100); } moteur1.write (úhel_cíle); } neplatné goto_moteur2 (int úhel_cíle) {

while (úhel_cíle úhel2+krok_úhel)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (úhel_cíle); Serial.print ("\ n angle3 = / t"); Serial.print (úhel2); if (angle_destination angle2 +step_angle) {angle2 += step_angle; moteur2.write (úhel2);} zpoždění (100); } moteur2.write (úhel_cíle); } neplatné goto_moteur3 (int úhel_cíle) {

while (úhel_cílový úhel3+step_angle)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (úhel_cíle); Serial.print ("\ n angle4 = / t"); Serial.print (úhel3); if (angle_destination angle3 +step_angle) {angle3 += step_angle; moteur3.write (úhel3);} zpoždění (100); } moteur3.write (úhel_cíle); } neplatné goto_moteur5 (int úhel_cíle) {

while (úhel_cílový úhel5+step_angle)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (úhel_cíle); Serial.print ("\ n angle5 = / t"); Serial.print (angle5); if (angle_destination angle5 +step_angle) {angle5 += step_angle; moteur5.write (úhel5);} zpoždění (100); } moteur5.write (úhel_cíle); }

void TouchDown_Release () // Uvolnění tlačítka TouchDown

{if (angle5 <180) {angle5 = angle5+step_angle_mini; } moteur5.write (úhel5); }

void TouchDown_Grab () // TouchDown Button Grab

{if (angle5> 0) {angle5 = angle5-step_angle_mini; } moteur5.write (úhel5); } neplatný Base_Rotation () {if (úhel 0) {úhel = úhel-krok_angle; } else úhel = 0; moteur.write (úhel); } void Waist_Rotation () {if (angle1 20) {angle1 = angle1-step_angle; } else úhel1 = 20; moteur1.write (úhel1); } void Third_Arm_Rotation () {if (angle2 0) {angle2 = angle2-step_angle; } moteur2.write (úhel2); } neplatné Fourth_Arm_Rotation () {if (angle3 = 0) {angle3 = angle3-step_angle_mini; } moteur3.write (úhel3); }

Krok 6: To je ono

Děkuji za sledování, doufám, že jste ocenili!

Pokud se vám tento Instructable líbil, můžete nás určitě navštívit pro více! =)

Doporučuje: