* Σύντομα και στα Ελληνικά
Introduction |
Published date: 12/12/2016
|
If you have a 3D printer then... you must try to build one of this robotic arm-grab toy!
The robotic arm can learn what to do on every start up. Use the potentiometers (one per servo) and the "teach" button and make your arm to grab.. everything!
In this tutorial you will find the part list, circuit connections, Arduino code and of course 3D files of this amazing toy.
Many thanks to daGHIZmo for the 3D printer files of EEZYbotARM
Link: http://www.thingiverse.com/thing:1015238
The robotic arm can learn what to do on every start up. Use the potentiometers (one per servo) and the "teach" button and make your arm to grab.. everything!
In this tutorial you will find the part list, circuit connections, Arduino code and of course 3D files of this amazing toy.
Many thanks to daGHIZmo for the 3D printer files of EEZYbotARM
Link: http://www.thingiverse.com/thing:1015238
Ours Arduino Robotic Arm in action!
|
|
What you will need - Hardware
For this project you will need:
Tip: You can use any Arduino board!
|
|
The circuit
The connections are pretty easy, see the above image with the breadboard circuit schematic.
Servo Motors:
Servo Motors:
- Servo for Grab movement to Arduino pin 6
- Servo for Rotate movement to Arduino pin 5
- Servo for Up/Down movement to Arduino pin 4
- Servo for Forward/Backward movement to Arduino pin 3
- All black cables to GND
- All red cables to Vcc - 5V
- for Grab movement to Arduino pin A0
- for Rotate movement to Arduino pin A1
- for Up/Down movement to Arduino pin A2
- for Forward/Backward movement to Arduino pin A3
- All left pins to GND
- All right pins to Vcc - 5V
- Teach button to Arduino pin 7
- Start button to Arduino pin 8
- buzzer to arduino pin 9
3D Files and assembly of the robotic arm
Here you will find all 3D - stl files for the EEZYbotARM. As I said before, this amazing robotic arm designed by daGHIZmo. He also wrote a step-by-step assembly guide that you can find at Instructables.com, just click here.
The code
If you want to disable the home position of your arm, just comment out the lines with "goHome();" command.
Note: You will need to change the min/max values for every servos to meet your setup.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /* Arduino Robotic Arm with Grab * More info: http://www.ardumotive.com/ * Dev: Michalis Vasilakis Data: 12/12/2016 Ver: 1.1 */ #include <Servo.h> //Create servo objects to control servo motors Servo up_down; Servo forward_backward; Servo rotate; Servo grab; //Constants const int startBT = 7; const int teachBT = 8; const int buzzer = 9; const int potForwardBackward = A3; const int potUpDown = A2; const int potRotate = A1; const int potGrab = A0; //Max and Min values for servos ! Change them to meet your setup ! const int minGrab=180; const int maxGrab=126; const int minRotate=0; const int maxRotate=100; const int minUpDown=5; const int maxUpDown=100; const int minForwardBackward=160; const int maxForwardBackward=80; //-------------------------------------// //Variables int readUpDown,readForwardBackward,readRotate,readGrab,readTeach,readStart; int teachUpDown[100],teachForwardBackward[100],teachRotate[100],teachGrab[100]; boolean started =false; int index = 1; int stepSpeed = 20; //Change this to fo faster! void setup() { //Attach Servo motors forward_backward.attach(3); up_down.attach(4); rotate.attach(5); //portokali xontro grab.attach(6); //Inputs-Outputs pinMode(teachBT, INPUT_PULLUP); pinMode(startBT, INPUT_PULLUP); pinMode(buzzer, OUTPUT); //Do a smooth movement on startup, from home potion to pot position: readInputs(); goHome(); goPot(); } void loop() { if (!started){ readInputs(); moveServos(); if (readTeach==LOW){ savePosition(); tone(buzzer,500); delay(500); noTone(buzzer); } if (readStart==LOW){ tone(buzzer,700); started=true; delay(1000); noTone(buzzer); } } else{ goHome(); runTeach(); } } void readInputs(){ //Read potentiometers readUpDown = analogRead(potUpDown); readUpDown = map(readUpDown,0,1023,minUpDown,maxUpDown); readForwardBackward = analogRead(potForwardBackward); readForwardBackward = map(readForwardBackward,0,1023,minForwardBackward,maxForwardBackward); readRotate = analogRead(potRotate); readRotate = map(readRotate,0,1023,minRotate,maxRotate); readGrab = analogRead(potGrab); readGrab = map(readGrab,0,1023,minGrab,maxGrab); //Read buttons readTeach = digitalRead(teachBT); readStart = digitalRead(startBT); delay(50); } void moveServos(){ up_down.write(readUpDown); forward_backward.write(readForwardBackward); rotate.write(readRotate); grab.write(readGrab); } void savePosition(){ teachUpDown[index] = readUpDown; teachForwardBackward[index] = readForwardBackward; teachRotate[index] = readRotate; teachGrab[index] = readGrab; index++; } void runTeach(){ for (int i=0; i<index-1; i++){ if (teachRotate[i] < teachRotate[i+1]){ for (int j = teachRotate[i]; j<= teachRotate[i+1]; j++){ rotate.write(j); delay(stepSpeed); } } else if (teachRotate[i] > teachRotate[i+1]){ for (int j = teachRotate[i]; j>= teachRotate[i+1]; j--){ rotate.write(j); delay(stepSpeed); } } else{ rotate.write(teachRotate[i]); } if (teachGrab[i] < teachGrab[i+1]){ for (int j = teachGrab[i]; j<= teachGrab[i+1]; j++){ grab.write(j); delay(stepSpeed); } } else if (teachGrab[i] > teachGrab[i+1]){ for (int j = teachGrab[i]; j>= teachGrab[i+1]; j--){ grab.write(j); delay(stepSpeed); } } else{ grab.write(teachGrab[i]); } if (teachForwardBackward[i] < teachForwardBackward[i+1]){ for (int j = teachForwardBackward[i]; j<= teachForwardBackward[i+1]; j++){ forward_backward.write(j); delay(stepSpeed); } } else if (teachForwardBackward[i] > teachForwardBackward[i+1]){ for (int j = teachForwardBackward[i]; j>= teachForwardBackward[i+1]; j--){ forward_backward.write(j); delay(stepSpeed); } } else{ forward_backward.write(teachForwardBackward[i]); } if (teachUpDown[i] < teachUpDown[i+1]){ for (int j = teachUpDown[i]; j<= teachUpDown[i+1]; j++){ up_down.write(j); delay(stepSpeed); } } else if (teachUpDown[i] > teachUpDown[i+1]){ for (int j = teachUpDown[i]; j>= teachUpDown[i+1]; j--){ up_down.write(j); delay(stepSpeed); } } else{ up_down.write(teachUpDown[i]); } } started=false; } //Change values if it's necessary... void goHome(){ if (readForwardBackward < 80){ for (int j = readForwardBackward; j<=80; j++){ forward_backward.write(j); delay(stepSpeed); } } else if (readForwardBackward > 80){ for (int j = readForwardBackward; j>=80; j--){ forward_backward.write(j); delay(stepSpeed); } } else{ forward_backward.write(80); } if (readUpDown < 32){ for (int j = readUpDown; j<=32; j++){ up_down.write(j); delay(stepSpeed); } } else if (readUpDown > 32){ for (int j = readUpDown; j>=32; j--){ up_down.write(j); delay(stepSpeed); } } else{ up_down.write(32); } if (readRotate < 0){ for (int j = readRotate; j<=0; j++){ rotate.write(j); delay(stepSpeed); } } else if (readRotate > 0){ for (int j = readRotate; j>=0; j--){ rotate.write(j); delay(stepSpeed); } } else{ rotate.write(0); } if (readGrab < 148){ for (int j = readGrab; j<=148; j++){ grab.write(j); delay(stepSpeed); } } else if (readGrab > 148){ for (int j = readGrab; j>=148; j--){ grab.write(j); delay(stepSpeed); } } else{ grab.write(148); } //Always start from home position teachForwardBackward[0]= 80; teachUpDown[0]=32; teachRotate[0]=0; teachGrab[0]=148; } void goPot(){ if (0 > readRotate){ for (int j = 0; j>=readRotate; j--){ rotate.write(j); delay(stepSpeed); } } else if (readRotate > 0){ for (int j = 0; j<=readRotate; j++){ rotate.write(j); delay(stepSpeed); } } else{ rotate.write(readRotate); } if (readGrab > 148){ for (int j = 148; j<=readGrab; j++){ grab.write(j); delay(stepSpeed); } } else if (readGrab < 148){ for (int j = 148; j>=readGrab; j--){ grab.write(j); delay(stepSpeed); } } else{ grab.write(readGrab); } if (80 > readForwardBackward){ for (int j = 80; j>=readForwardBackward; j--){ forward_backward.write(j); delay(stepSpeed); } } else if (80 < readForwardBackward){ for (int j = 80; j<=readForwardBackward; j++){ forward_backward.write(j); delay(stepSpeed); } } else{ forward_backward.write(readForwardBackward); } if (32 > readUpDown){ for (int j = 32; j>=readUpDown; j--){ up_down.write(j); delay(stepSpeed); } } else if (readUpDown > 32){ for (int j = 32; j<=readUpDown; j++){ up_down.write(j); delay(stepSpeed); } } else{ up_down.write(readUpDown); } } |
Download the code from here and open it with Arduino IDE.
|
|
Well done!
Great news! You have successfully complete this guide and now you have your own 3D printed Arduino Robotic Arm!
Move the arm in a position and press the teach button to save it. Make a path, when you are ready, press the start button to test it! If it succeed, you can repeat by pressing the start button! If you want to start from the beginning just power off/on the Arduino from switch.
I hope you liked this, let me know in the comments!
Move the arm in a position and press the teach button to save it. Make a path, when you are ready, press the start button to test it! If it succeed, you can repeat by pressing the start button! If you want to start from the beginning just power off/on the Arduino from switch.
I hope you liked this, let me know in the comments!