Inhaltsverzeichnis:

Roboterarmspiel - Smartphone-Controller - Gunook
Roboterarmspiel - Smartphone-Controller - Gunook

Video: Roboterarmspiel - Smartphone-Controller - Gunook

Video: Roboterarmspiel - Smartphone-Controller - Gunook
Video: LEGO MINDSTORMS Robot Inventor Guide: How to Connect a Game Controller to Your Robot 2024, Juli
Anonim
Roboterarm-Spiel - Smartphone-Controller
Roboterarm-Spiel - Smartphone-Controller

Hallo !

Hier ein lustiges Sommerspiel: Der Roboterarm, der vom Smartphone gesteuert wird !!

Wie Sie im Video sehen können, können Sie den Arm mit einigen Joysticks auf Ihrem Smartphone steuern.

Sie können auch ein Muster speichern, das der Roboter in einer Schleife reproduziert, um beispielsweise einige sich wiederholende Aufgaben zu erledigen. Aber dieses Muster ist beliebig modulierbar !!!!

Seien Sie kreativ !

Schritt 1: Materialien

Materialien
Materialien

Hier sehen Sie das benötigte Material.

Der Bau dieses Roboterarms wird Sie etwa 50€ kosten. Die Software und Tools können ersetzt werden, aber ich habe diese für dieses Projekt verwendet.

Schritt 2: 3D-Druck des Roboterarms

3D-Druck des Roboterarms
3D-Druck des Roboterarms
3D-Druck des Roboterarms
3D-Druck des Roboterarms
3D-Druck des Roboterarms
3D-Druck des Roboterarms

Der Roboterarm wurde 3D gedruckt (mit unserem prusa i3).

Dank der Website "HowtoMechatronics.com" sind seine STL-Dateien genial, um einen 3D-Arm zu bauen.

Es dauert ungefähr 20 Stunden, um alle Teile zu drucken.

Schritt 3: Elektronische Montage

Elektronische Montage
Elektronische Montage

Die Montage ist in 2 Teile getrennt:

Ein elektronisches Teil, bei dem das Arduino über die digitalen Pins mit den Servos und mit dem Bluetooth-Gerät (Rx, Tx) verbunden ist.

Ein Leistungsteil, in dem die Servos mit 2 Telefonladegeräten (5V, 2A max.) versorgt werden.

Schritt 4: Smartphone-Anwendung

Smartphone-Anwendung
Smartphone-Anwendung

Die Anwendung wurde auf App-Erfinder 2 erstellt. Wir verwenden 2 Joysticks, um 4 Servos und 2 weitere Tasten zu steuern, um den letzten Griff zu steuern.

Wir verbinden Arm und Smartphone über ein Bluetooth-Modul (HC-06).

Schließlich ermöglicht ein Speichermodus dem Benutzer, bis zu 9 Positionen für den Arm zu speichern.

Der Arm geht dann in einen Automatikmodus, in dem er die gespeicherten Positionen reproduziert.

Schritt 5: Der Arduino-Code

Der Arduino-Code
Der Arduino-Code
Der Arduino-Code
Der Arduino-Code

// 08/19 - Roboterarm Smartphone gesteuert

#include #define TRUE true #define FALSE false //********************ERKLÄRUNGEN******************** **********

Wortwiederholung; // mot envoyé du module Arduino au Smartphone

int chiffre_final = 0; int-cmd=3; // variabler Befehl des Servomotors (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; // auf définit notre servomoteur Servo moteur1; Servomotor2; Servomotor3; // Servomotor4; Servomotor5; int step_angle_mini = 4; int step_angle = 3; int angle, angle1, angle3, angle5, angle2; // angle int pas; int r, r1, r2, r3; int-Registrierer; Boolesche Flosse = FALSE; boolesche fin1 = FALSE; boolesche Fin2 = FALSE; boolesche Fin3 = FALSE; boolesche fin4 = FALSE; Wort w; // Variabler Gesandter des Smartphone-Au-Moduls 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-Winkel; // Drehwinkel (0 a 180)

//********************ERSTELLEN*************************** ******** Void setup () { 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); // auf dem objekt au pin de commande moteur1.attach (cmd1); moteur2.attach (cmd2); moteur3.attach (cmd3); // moteur4.attach (cmd4); moteur5.attach (cmd5); motor.write(6); Winkel = 6; motor1.write(100); Winkel1 = 100; motor2.write(90); motor3.write(90); //moteur4.write (12); moteur5.write(90); Winkel = 6; Winkel1=100; Winkel2= 90; Winkel3=90; Winkel5=90; Serial.begin (9600); // permettra de Communiquer au-Modul Bluetooth} //********************BOUCLE******************** **************** Leere Schleife () {

// Serial.print ("Winkel");

//Serial.print(Winkel);Serial.print ("\t");Serial.print(Winkel1);Serial.print("\t");Serial.print(Winkel2);Serial.print("\t ");Serial.print(Winkel3);Serial.print (" \t");Serial.print(Winkel5);Serial.print (" \n");

//Seriell.print("Winkel");

int ich; w = Empfänger(); // beim Empfangen von Informationen des Smartphones, la Variable w switch (w) {Fall 1: TouchDown_Release();break; Fall 2: TouchDown_Grab();Pause; Fall 3: Base_Rotation();break; Fall 4: Base_AntiRotation();break; Fall 5: Waist_Rotation();break; Fall 6: Waist_AntiRotation();break; Fall 7: Third_Arm_Rotation();break; Fall 8: Third_Arm_AntiRotation();break; Fall 9: Fourth_Arm_Rotation();break; Fall 10: Fourth_Arm_AntiRotation();break; //Fall 11: Fifth_Arm_Rotation();break; //Fall 12: Fifth_Arm_AntiRotation();break; case 21: Serial.print("case button 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]); brechen; Fall 22: chiffre_final = 2;sauvegarde_positions2[0] =Winkel;sauvegarde_positions2[1] =Winkel1;sauvegarde_positions2[2] =Winkel2;sauvegarde_positions2[3] =Winkel3;sauvegarde_positions2[4] =Winkel5; brechen; Fall 23: chiffre_final = 3;sauvegarde_positions3[0] =Winkel;sauvegarde_positions3[1] =Winkel1;sauvegarde_positions3[2] =Winkel2;sauvegarde_positions3[3] =Winkel3;sauvegarde_positions3[4] =Winkel5;break; Fall 24: chiffre_final = 4;sauvegarde_positions4[0] =Winkel;sauvegarde_positions4[1] =Winkel1;sauvegarde_positions4[2] =Winkel2;sauvegarde_positions4[3] =Winkel3;sauvegarde_positions4[4] =Winkel5; brechen; Fall 25: chiffre_final = 5;sauvegarde_positions5[0] =Winkel;sauvegarde_positions5[1] =Winkel1;sauvegarde_positions5[2] =Winkel2;sauvegarde_positions5[3] =Winkel3;sauvegarde_positions5[4] =Winkel5; brechen; Fall 26: chiffre_final = 6;sauvegarde_positions6[0] =Winkel;sauvegarde_positions6[1] =Winkel1;sauvegarde_positions6[2] =Winkel2;sauvegarde_positions6[3] =Winkel3;sauvegarde_positions6[4] =Winkel5; brechen; Fall 27: chiffre_final = 7;sauvegarde_positions7[0] =Winkel;sauvegarde_positions7[1] =Winkel1;sauvegarde_positions7[2] =Winkel2;sauvegarde_positions7[3] =Winkel3;sauvegarde_positions7[4] =Winkel5; brechen; Fall 28: chiffre_final = 8;sauvegarde_positions8[0] =Winkel;sauvegarde_positions8[1] =Winkel1;sauvegarde_positions8[2] =Winkel2;sauvegarde_positions8[3] =Winkel3;sauvegarde_positions8[4] =Winkel5; brechen; Fall 29: chiffre_final = 9;sauvegarde_positions9[0] =Winkel;sauvegarde_positions9[1] =Winkel1;sauvegarde_positions9[2] =Winkel2;sauvegarde_positions9[3] =Winkel3;sauvegarde_positions9[4] =Winkel5; brechen;

Fall 31: Serial.print("31");activate_saving = 1;chiffre_final = 0; Pause;// ANFANGEN

Fall 33: Serial.print("33");activate_saving = 0; break;// BUTTON SAVE default: break; } if (w == 32) {Serial.print ("\nReproduzieren\nChiffre final:"); Serial.print (chiffre_final); Serial.print("\n Sauvegarde-Position 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");} für (i = 1; i <=chiffre_final; i ++) {Serial. print(" \n\n BEGIN \nLoop: "); Serial.print(i);Serial.print("\n"); Schalter (i) { Fall 1: goto_moteur (* (sauvegarde_positions1)); Verzögerung (200); goto_moteur1(*(sauvegarde_positions1+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions1+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions1+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions1+4));Verzögerung(200); brechen; Fall 2: goto_moteur(*(sauvegarde_positions2));Verzögerung(200); goto_moteur1(*(sauvegarde_positions2+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions2+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions2+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions2+4));Verzögerung(200); brechen; Fall 3: goto_moteur(*(sauvegarde_positions3));Verzögerung(200); goto_moteur1(*(sauvegarde_positions3+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions3+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions3+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions3+4));Verzögerung(200); brechen; Fall 4: goto_moteur(*(sauvegarde_positions4));Verzögerung(200); goto_moteur1(*(sauvegarde_positions4+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions4+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions4+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions4+4));Verzögerung(200); brechen; Fall 5: goto_moteur(*(sauvegarde_positions5));Verzögerung(200); goto_moteur1(*(sauvegarde_positions5+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions5+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions5+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions5+4));Verzögerung(200); brechen; Fall 6: goto_moteur(*(sauvegarde_positions6));Verzögerung(200); goto_moteur1(*(sauvegarde_positions6+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions6+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions6+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions6+4));Verzögerung(200); brechen; Fall 7: goto_moteur(*(sauvegarde_positions7));Verzögerung(200); goto_moteur1(*(sauvegarde_positions7+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions7+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions7+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions7+4));Verzögerung(200); brechen; Fall 8: goto_moteur(*(sauvegarde_positions8));Verzögerung(200); goto_moteur1(*(sauvegarde_positions8+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions8+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions8+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions8+4));Verzögerung(200); brechen; Fall 9: goto_moteur(*(sauvegarde_positions9));Verzögerung(200); goto_moteur1(*(sauvegarde_positions9+1)); Verzögerung (200); goto_moteur2(*(sauvegarde_positions9+2));Verzögerung(200); goto_moteur3(*(sauvegarde_positions9+3)); Verzögerung (200); goto_moteur5(*(sauvegarde_positions9+4));Verzögerung(200); brechen; } Serial.print("\n************************ FIN REPRODUCE **************** \n "); Verzögerung (500); } } /*Serial.print ("debüt\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");*/

Verzögerung (100); } //**************************** FUNKTIONEN******************** ******************

Wort recevoir () {// Funktion permettant de recevoir l'information du smartphone

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

Serial.flush();

Rückkehr w; }}

void goto_moteur(int angle_destination)

{ while (angle_destination angle+step_angle) { Serial.print(" \n --------------* * * * * *---------------- ----\n"); Serial.print ("angle_destination = \t"); Serial.print (angle_destination); Serial.print ("\n Winkel1 = \t"); Serial.print (Winkel); if (angle_destination angle +step_angle) { angle = angle + step_angle;moteur.write (Winkel);} Verzögerung (100); } moteur.write (Winkel_Ziel); aufrechtzuerhalten. aufrechtzuerhalten. -----------\n"); Serial.print ("angle_destination = \t"); Serial.print (angle_destination); Serial.print ("\n angle2 = \t"); Serial.print (angle1); if(angle_destination angle1 +step_angle){angle1 += step_angle; moteur1.write (Winkel1);;} Verzögerung (100); } moteur1.write (angle_destination); } void goto_moteur2(int angle_destination) {

while (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 (angle2); if(angle_destination angle2 +step_angle){angle2+=step_angle; moteur2.write (Winkel2);} Verzögerung (100); } moteur2.write (Winkel_Ziel); } void goto_moteur3(int angle_destination) {

while (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 (angle3); if(angle_destination angle3 +step_angle){angle3+=step_angle; moteur3.write (Winkel3);} Verzögerung (100); } moteur3.write (Winkel_Ziel); } void goto_moteur5(int angle_destination) {

while (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 (angle5); if(angle_destination angle5 +step_angle){angle5+=step_angle; moteur5.write (Winkel5);} Verzögerung (100); } moteur5.write (angle_destination); }

void TouchDown_Release() // TouchDown Button Release

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

void TouchDown_Grab() // TouchDown Button Grab

{ if (angle5 > 0) { angle5 = angle5-step_angle_mini; } moteur5.write (Winkel5); aufrechtzuerhalten. Void Base_Rotation () { if (Winkel 0) { angle = angle-step_angle; } sonst Winkel = 0; motor.write (Winkel); aufrechtzuerhalten. Void Waist_Rotation () { if (angle1 20) { angle1 = angle1-step_angle; } sonst Winkel1 = 20; motor1.write (Winkel1); aufrechtzuerhalten. Void Third_Arm_Rotation () { if (angle2 0) { angle2 = angle2-step_angle; } moteur2.write (Winkel2); aufrechtzuerhalten. Void Fourth_Arm_Rotation () { if (angle3 = 0) { angle3 = angle3-step_angle_mini; } moteur3.write (Winkel3); }

Schritt 6: Das ist es

Vielen Dank fürs Zuschauen, ich hoffe, Sie haben es geschätzt!

Wenn Ihnen dieses Instructable gefallen hat, können Sie uns sicher für mehr besuchen! =)