Bot Reboot
Published © GPL3+

RoboArm

Arduino 2 axis robotic arm with a robotic claw gripper. Can be controlled with your PC, potentiometers and even with your phone.

IntermediateFull instructions provided1,186
RoboArm

Things used in this project

Hardware components

Servo motor Mg995
×4
Robotic Claw Gripper
×1
3d Printed Robotic Arm
The schematic is down below
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE
SketchUp
MIT App Inventor 2
MIT App Inventor 2

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

2 axis robotic arm

You can open it with SketchUp. This model has been tested

2 axis robotic arm STL PARTS

These are the STL parts that need to be 3d printed in order to build your 2 axis robotic arm.

3 axis robotic arm

This model has not been tested yet. There is the posibility that the model whould be too heavy for the base servo. You can open it with Sketchup.

3 axis robotic arm STL PARTS

This model has not been tested yet. The parts might not connect.

2 axis robotic arm STL

You can find its parts in the zip attachment.

3 axis robotic arm STL

Schematics

Circuit design with potentiometers

This is the circuit design if you wish to control your robotic arm with potentiometers.

Circuit design for PC

This is the circuit design if you wish to control your robotic arm with your pc through serial.

Code

Code PC

C/C++
This can be used as a calibration code.
Use this to control your robotic arm with your pc through serial.
With this you can figure out what values ​​the servos can take.
!This code is compatible with the model I made. For other robotics arm you might need to change void rotate2.
/*Open the serial monitor to control the robotic arm.
 * This is a calibration code
 * Code made by Alex Dumitrache
*/
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servoclaw;
//Servo servobase; //uncomment this if you use a 3 axis robot

int pos1=90,pos2=90,pos3=90,pos4=90;
int values[3];
int cnt=0;

void setup() {
  Serial.begin(9600);
  Serial.println("Enter 2 values:");
  Serial.println("the first value for the type of servo:");
  Serial.println("1 - the first servo; 2 - the second servo; 3 - both 2 axis servos; 4 - clawservo; 5 - baseservo");
  Serial.println("the second value for the postion of the servo/s - between 0 and 180");

  
  //Enter the PMW pin for each of the servo
  servo1.attach(9);
  servo2.attach(10);
  servoclaw.attach(11);
  //servobase.attach(pin);//uncomment this if you use a 3 axis robot
}

void loop() {
  if(Serial.available()) {
    while(Serial.available() == 0); //if the Arduino receive the values through serial
    int val = Serial.parseInt();
    if (val!=0) {
      cnt++;//Arduino expects 2 values so we put a counter
      values[cnt]=val;//it stores the values he received
      if (cnt==2) {//run the subprogram
        if(values[1]==1) {
          rotate1(pos1,values[2],servo1);
          pos1=values[2];
        }
        if(values[1]==2) {
          rotate1(pos2,values[2],servo2);
          pos2=values[2];
        }
        if(values[1]==3) {
          rotate1(pos1,pos2,servo2);
          pos1=pos2;
          rotate2(pos2,values[2],servo1,servo2);
          pos1=values[2];
          pos2=values[2];
        }
        if(values[1]==4) {
          rotate1(pos3,values[2],servoclaw);
          pos3=values[2];
        }
        /*if(values[1]==5) {   //uncomment this if you use a 3 axis robot
          rotate1(pos4,values[2],servobase);
          pos4=values[2];
        }
        */
        cnt=0;//waiting for new values
      }
    }
  }
}

void rotate1(int i, int f, Servo myservo) {
  if(i<=f) {
    for(int pos=i;pos<=f;pos++) {
      myservo.write(pos);
      delay(15);
    }
  }
  else {
    for(int pos=i;pos>=f;pos--) {
      myservo.write(pos);
      delay(15);
    }
  }
}

void rotate2(int i, int f, Servo myservo1, Servo myservo2) {
  if(i<=f) {
    for(int pos=i;pos<=f;pos++) {
      myservo1.write(pos);
      myservo2.write(180-pos);
      delay(15);
    }
  }
  else {
    for(int pos=i;pos>=f;pos--) {
      myservo1.write(pos);
      myservo2.write(180-pos);
      delay(15);
    }
  }
}

Code potentiometers

C/C++
Use this code of you are controlling your robotic arm with potentiometers.
!This code is compatible with any robotic arm.
/*
 Controlling a servo position using a potentiometer (variable resistor)
 by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

 modified on 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Knob

 modified by Alex Dumitrache
*/

//If you use a 4th servo make sure to uncomment the lines that include it.

#include <Servo.h>

Servo myservo1;  // create servo object to control a servo
Servo myservo2;
Servo myservo3;
//Servo myservo4;

int potpin1 = 0;  // analog pin used to connect the potentiometer
int potpin2 = 1; 
int potpin3 = 2; 
//int potpin4 = 3; 
int val1;  // variable to read the value from the analog pin
int val2; 
int val3; 
//int val4; 

void setup() {
  myservo1.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(10);
  myservo3.attach(11);
  //myservo4.attach(6);
}

void loop() {
  val1 = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023)  
  val1 = map(val1, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
  myservo1.write(val1);  // sets the servo position according to the scaled value
  delay(15); // waits for the servo to get there
  
  val2 = analogRead(potpin2);
  val2 = map(val2, 0, 1023, 0, 180);
  myservo2.write(val2);
  delay(15);
  
  val3 = analogRead(potpin3);
  val3 = map(val3, 0, 1023, 0, 180);
  myservo3.write(val3);
  delay(15);
  
  //val4 = analogRead(potpin4);
  //val4 = map(val4, 0, 1023, 0, 180);
  //myservo4.write(val4);
  //delay(15);
}

Credits

Bot Reboot
3 projects • 49 followers
Student in the first year at CSE TU Delft.
Thanks to Ian Juby.

Comments