תוכן עניינים:

משחק זרוע רובוטי - בקר סמארטפון: 6 שלבים
משחק זרוע רובוטי - בקר סמארטפון: 6 שלבים

וִידֵאוֹ: משחק זרוע רובוטי - בקר סמארטפון: 6 שלבים

וִידֵאוֹ: משחק זרוע רובוטי - בקר סמארטפון: 6 שלבים
וִידֵאוֹ: רובוט ריתוך HJR-008,יצרני רובוט ריתוך,זרוע רובוט ריתוך,ספק סיני 2024, יולי
Anonim
משחק זרוע רובוטי - בקר סמארטפון
משחק זרוע רובוטי - בקר סמארטפון

שלום !

הנה משחק קיץ מהנה: הזרוע הרובוטית הנשלטת על ידי סמארטפון !!

כפי שאתה יכול לראות בסרטון, אתה יכול לשלוט בזרוע עם כמה ג'ויסטיקים בסמארטפון שלך.

תוכל גם לשמור דפוס שהרובוט ישחזר בלולאה על מנת לבצע כמה משימות שחוזרות על עצמן כדוגמה. אבל הדפוס הזה ניתן לשינוי כרצונך !!!!

תהיה יצירתי !

שלב 1: חומרים

חומרים
חומרים

כאן תוכל לראות את החומר הדרוש לך.

זה יעלה לך בסביבות 50 € לבנות את הזרוע הרובוטית הזו. ניתן להחליף את התוכנה והכלים, אך השתמשתי באלה לפרויקט זה.

שלב 2: הדפס תלת מימד את הזרוע הרובוטית

הדפס תלת מימד את הזרוע הרובוטית
הדפס תלת מימד את הזרוע הרובוטית
הדפס תלת מימד את הזרוע הרובוטית
הדפס תלת מימד את הזרוע הרובוטית
הדפס תלת מימד את הזרוע הרובוטית
הדפס תלת מימד את הזרוע הרובוטית

הזרוע הרובוטית הודפסה בתלת מימד (עם prusa i3 שלנו).

הודות לאתר "HowtoMechatronics.com", קבצי STL שלו מדהימים על מנת לבנות זרוע תלת מימדית.

זה ייקח בערך 20 שעות להדפיס את כל החלקים.

שלב 3: מונטאז 'אלקטרוני

מונטאז 'אלקטרוני
מונטאז 'אלקטרוני

המונטאז 'נפרד לשני חלקים:

חלק אלקטרוני, שבו הארדואינו מחובר לסרוווס על ידי הפינים הדיגיטליים, ועם מכשיר ה- Bluetooth (Rx, Tx).

חלק כוח, שבו המנגנים מופעלים עם 2 מטען טלפון (5V, 2A מקסימום).

שלב 4: יישום סמארטפון

יישום סמארטפון
יישום סמארטפון

היישום בוצע על ממציא האפליקציות 2. אנו משתמשים בשני ג'ויסטיק לשליטה על 4 סרוו ושני כפתורים נוספים לשליטה באחיזה הסופית.

אנו מחברים את הזרוע והסמארטפון יחד באמצעות מודול בלוטות '(HC-06).

לבסוף, מצב חיסכון מאפשר למשתמש לשמור עד 9 עמדות עבור הזרוע.

לאחר מכן הזרוע תיכנס למצב אוטומטי, שם הוא ישחזר את העמדות השמורות.

שלב 5: קוד הארדואינו

קוד הארדואינו
קוד הארדואינו
קוד הארדואינו
קוד הארדואינו

// 08/19 - נשלט סמארטפון נשק רובוטי

#הכלול ***********

נציג מילים; // סמארטפון של מודול Arduino au smartphone

int chiffre_final = 0; int cmd = 3; // משתנה commande du servo moteur (troisième fil (כתום, ג'ון)) int cmd1 = 5; // servo1 int cmd2 = 9; // servo2 int cmd3 = 10; // servo3 // int cmd4 = 10; // servo4 int cmd5 = 11; // pince int active_saving = 0; מנוע סרוו; // on définit notre servomoteur Servo moteur1; סרוו מוטור 2; סרוו מוטור 3; // סרוו מוטור 4; סרוו מוטור 5; int step_angle_mini = 4; int step_angle = 3; זווית int, זווית 1, זווית 3, זווית 5, זווית 2; // זווית int pas; int r, r1, r2, r3; int enregistrer; סנפיר בוליאני = FALSE; boolean fin1 = FALSE; boolean fin2 = FALSE; boolean fin3 = FALSE; boolean fin4 = FALSE; מילה w; // משתנה שליח של סמארטפון או מודול 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 א 180)

//********************להכין*************************** ******** הגדרת void () {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); // on 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 module Bluetooth} // ******************* BOUCLE ****************** ****************** לולאת ריק () {

// Serial.print ("זווית");

//Serial.print(angle);Serial.print ("\ t"); Serial.print (angle1); Serial.print ("\ t"); Serial.print (angle2); Serial.print ("\ t "); Serial.print (angle3); Serial.print (" / t "); Serial.print (angle5); Serial.print (" / n ");

//Serial.print("angle ");

int i; w = recevoir (); // on a recevoir une information du smartphone, la variable w switch (w) {case 1: TouchDown_Release (); break; מקרה 2: TouchDown_Grab (); הפסקה; מקרה 3: Base_Rotation (); הפסקה; מקרה 4: Base_AntiRotation (); הפסקה; מקרה 5: Waist_Rotation (); הפסקה; מקרה 6: Waist_AntiRotation (); הפסקה; מקרה 7: Third_Arm_Rotation (); הפסקה; מקרה 8: Third_Arm_AntiRotation (); הפסקה; מקרה 9: Fourth_Arm_Rotation (); הפסקה; מקרה 10: Fourth_Arm_AntiRotation (); הפסקה; // מקרה 11: Fifth_Arm_Rotation (); הפסקה; // מקרה 12: Fifth_Arm_AntiRotation (); הפסקה; מקרה 21: Serial.print ("כפתור 1"); chiffre_final = 1; sauvegarde_positions1 [0] = זווית; sauvegarde_positions1 [1] = angle1; sauvegarde_positions1 [2] = angle2; sauvegarde_positions1 [3] = angle3; sauvegarde_ = angle5; Serial.println (sauvegarde_positions1 [1]); Serial.println (sauvegarde_positions1 [2]); Serial.println (sauvegarde_positions1 [3]); Serial.println (sauvegarde_positions1 [4]); לשבור; מקרה 22: chiffre_final = 2; sauvegarde_positions2 [0] = זווית; sauvegarde_positions2 [1] = angle1; sauvegarde_positions2 [2] = angle2; sauvegarde_positions2 [3] = angle3; sauvegarde_positions2 [4] = angle5; לשבור; מקרה 23: chiffre_final = 3; sauvegarde_positions3 [0] = זווית; sauvegarde_positions3 [1] = angle1; sauvegarde_positions3 [2] = angle2; sauvegarde_positions3 [3] = angle3; sauvegarde_positions3 [4] = angle5; מקרה 24: chiffre_final = 4; sauvegarde_positions4 [0] = זווית; sauvegarde_positions4 [1] = angle1; sauvegarde_positions4 [2] = angle2; sauvegarde_positions4 [3] = angle3; sauvegarde_positions4 [4] = angle5; לשבור; מקרה 25: chiffre_final = 5; sauvegarde_positions5 [0] = זווית; sauvegarde_positions5 [1] = angle1; sauvegarde_positions5 [2] = angle2; sauvegarde_positions5 [3] = angle3; sauvegarde_positions5 [4] = angle5; לשבור; מקרה 26: chiffre_final = 6; sauvegarde_positions6 [0] = זווית; sauvegarde_positions6 [1] = angle1; sauvegarde_positions6 [2] = angle2; sauvegarde_positions6 [3] = angle3; sauvegarde_positions6 [4] = angle5; לשבור; מקרה 27: chiffre_final = 7; sauvegarde_positions7 [0] = זווית; sauvegarde_positions7 [1] = angle1; sauvegarde_positions7 [2] = angle2; sauvegarde_positions7 [3] = angle3; sauvegarde_positions7 [4] = angle5; לשבור; מקרה 28: chiffre_final = 8; sauvegarde_positions8 [0] = זווית; sauvegarde_positions8 [1] = angle1; sauvegarde_positions8 [2] = angle2; sauvegarde_positions8 [3] = angle3; sauvegarde_positions8 [4] = angle5; לשבור; מקרה 29: chiffre_final = 9; sauvegarde_positions9 [0] = זווית; sauvegarde_positions9 [1] = angle1; sauvegarde_positions9 [2] = angle2; sauvegarde_positions9 [3] = angle3; sauvegarde_positions9 [4] = angle5; לשבור;

מקרה 31: Serial.print ("31"); active_saving = 1; chiffre_final = 0; הפסקה; // BEGIN

מקרה 33: Serial.print ("33"); active_saving = 0; break; // BUTTON SAVE ברירת מחדל: break; } אם (w == 32) {Serial.print ("\ nReproduce / nChiffre final:"); Serial.print (chiffre_final); Serial.print ("\ n עמדה Sauvegarde 1: / n"); עבור (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions1 ); Serial.print ("\ t");} Serial.print ("\ n עמדה 2 של Sauvegarde: / n"); עבור (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions2 ); Serial.print ("\ t");} Serial.print ("\ n עמדה 3 של Sauvegarde: / n"); עבור (i = 0; i <5; i ++) {Serial.print (sauvegarde_positions3 ); Serial.print ("\ t");} עבור (i = 1; i <= chiffre_final; i ++) {Serial. print ("\ n / n BEGIN / n לולאה:"); Serial.print (i); Serial.print ("\ n"); switch (i) {מקרה 1: goto_moteur (*(sauvegarde_positions1)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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)); עיכוב (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 ***************** / n "); עיכוב (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]); 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");*/

עיכוב (100); } // *************************** ****************** *******************

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

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

Serial.flush ();

החזר w; }}

goto_moteur (int angle_destination) חלל

{while (זווית_הגדרה_זווית+שלב_אנגלית) {Serial.print ("\ n -------------- * * * * * * -------------- ---- / n "); Serial.print ("angle_destination = / t"); Serial.print (זווית_דיסטנציה); Serial.print ("\ n angle1 = / t"); Serial.print (זווית); אם (זווית ייעוד_זווית + שלב_זווית) {זווית = זווית + צעד_זווית; moteur.write (זווית);} עיכוב (100); } moteur.write (זווית_דיסטנציה); } vooto goto_moteur1 (int angle_destination) {while (angle_destination angle1+step_angle) {Serial.print ("\ n -------------- * * * * * * ------- ----------- / n "); Serial.print ("angle_destination = / t"); Serial.print (זווית_תפקיד); Serial.print ("\ n angle2 = / t"); Serial.print (זווית 1); אם (זווית_הגדרה_זווית 1 +שלב_מסלול) {זווית1 += שלב_זווית; moteur1.write (angle1);;} עיכוב (100); } moteur1.write (זווית_דיסטנציה); } vooto goto_moteur2 (int angle_destination) {

בעוד (זווית_הגדרה_זווית 2+צלע_שלב)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (זווית_תפקיד); Serial.print ("\ n angle3 = / t"); Serial.print (זווית 2); אם (זווית_הגדרה_זווית 2 +שלב_אנגלית) {זווית2 += שלב_זווית; moteur2.write (angle2);} עיכוב (100); } moteur2.write (זווית_דיסטנציה); } void goto_moteur3 (int angle_destination) {

בעוד (זווית_הגדרה_זווית 3+צלע_שלב)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (זווית_תפקיד); Serial.print ("\ n angle4 = / t"); Serial.print (angle3); if (angle_destination angle3 +step_angle) {angle3 += step_angle; moteur3.write (angle3);} עיכוב (100); } moteur3.write (זווית_דיסטנציה); } חלל goto_moteur5 (int angle_destination) {

בעוד (זווית_הגדרה זווית 5+צלע_שלב)

{Serial.print ("\ n -------------- * * * * * * ------------------ / n"); Serial.print ("angle_destination = / t"); Serial.print (זווית_תפקיד); Serial.print ("\ n angle5 = / t"); Serial.print (זווית 5); אם (זווית_התאמה_זווית5 +שלב_מסלול) {זווית5 += שלב_מסלול; moteur5.write (angle5);} עיכוב (100); } moteur5.write (זווית_דיסטנציה); }

void TouchDown_Release () // שחרור לחצן TouchDown

{if (angle5 <180) {angle5 = angle5+step_angle_mini; } moteur5.write (זווית 5); }

void TouchDown_Grab () // TouchDown Button Grab

{if (angle5> 0) {angle5 = angle5-step_angle_mini; } moteur5.write (זווית 5); } void Base_Rotation () {if (זווית 0) {angle = angle-step_angle; } זווית אחרת = 0; moteur.write (זווית); } void Waist_Rotation () {if (angle1 20) {angle1 = angle1-step_angle; } זווית אחרת 1 = 20; moteur1.write (זווית 1); } void Third_Arm_Rotation () {if (angle2 0) {angle2 = angle2-step_angle; } moteur2.write (זווית 2); } void Fourth_Arm_Rotation () {if (angle3 = 0) {angle3 = angle3-step_angle_mini; } moteur3.write (זווית 3); }

שלב 6: זהו

תודה שצפיתם, אני מקווה שהערכתם!

אם אהבת את ההנחיה הזו, אתה בהחלט יכול לבקר אותנו לעוד! =)

מוּמלָץ: