Project tutorial
RoboArm

RoboArm © GPL3+

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

  • 1,199 views
  • 1 comment
  • 10 respects

Components and supplies

Servo motor Mg995
×4
Robotic Claw Gripper
×1
3d printed robotic arm
The schematic is down below
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1

Necessary tools and machines

26w6260 40
Multitool, Screwdriver
3drag
3D Printer (generic)

Apps and online services

About this project

I made this project for those who don't want to, for some reasons, buy a robotic arm from the store. The reason I started this project is that I tried buying a robotic arm, but it couldn't even lift itself, because of its design (also it had some small servos - sg90s). So in this project, I will try to explain how to design properly a simple functional robotic arm.

In this project you will:

  • calculate the mechanical advantage of the main 2 axis;
  • design the robotic arm using a CAD program (SketchUp);
  • 3d print the model;
  • learn 3 ways of how to control the robot.

You will need:

  • 50 M3 bolts and 50 M3 nuts;
  • wires;
  • a breadboard.

You will learn how to control the robot via:

  • computer, through a USB port (recommended if you want to take note about what positions can the servos get);
  • potentiometers;
  • HC-05 bluetooth module.

1. The design of the 2 principal axis:

First, you need to understand that a robotic arm is a class 1 lever, which means the fulcrum lies between the effort and the load. Down below we have the 2 principal axis of the robotic arm, which allows to move forward-back and up-down.

If you want to see how exactly the 2 axis work, you can make this parts from cardboard and fix them with a needle or something else, like I did in the photo bellow:

How the robotic arm should work

Next, I chose to use the MG955 motor servo, because it is small and strong (at 6V it can go up to 10 kgf·cm).

Now you must decide how long the lever will be. The longer it is, the more force the servo will put on and the weight it can carry will decrease. Its formula is effort arm * effort = load arm * load.

For example, if we use the servo2 MG995 as in the scheme bellow, the load can go up to 2 kg.

As for the servo1, the load can go up to 500g.

As we can see, because of the mechanical advantage, servo2 will play an important role in the lifting of the load. In the model attached in the hardware section, servo2 could lift a maximum load of 1.6 kg and servo1 could lift an additional 833 grams. This numbers may vary, because the servo can operate at 10 kg*cm at 6V. Take in mind that we use small batteries, that deplete quickly.

Second, you need to think about the load itself, who will be robotic claw gripper, a MG995 servo motor, and the object you want to carry. If the load is too heavy, the robotic arm will never work. Also try not to overdo it with the dimensions. The model might work but it would look weird.

The last ax will be the base servo who allows the robotic arm to turn around.

2. The CAD model:

Now you can draw the robotic arm and then 3D print it. I used SketchUp to design, because it is quite simple to use it. Consider when setting the dimensions in which you will work (mm). In the hardware section(CAD) there are 2 example models: one with 2 axis, and another with 3 axis.

When you design your model, the parts of the robot must be rigid to withstand the load. If they are too thin, they risk breaking. 2.6 mm should do fine. For the components to which the engines are fixed, I doubled the thickness to not to risk curving. For the load arm, because is too long, I took a thickness of 8 mm.

When designing, I recommend that place your components (red) parallel/ perpendicular with the ground, as shown in the picture. In this way, it is more easier to design.

Also, make sure that the green parts are placed symmetrically, as shown in the picture bellow. By placing a cylinder that passes through the holes of the 2 components, it can be verified that they are placed correctly.

If you want more efficiency for the robotic arm, then the 2 axis servos should be symmetrical too. As you will see later, it will be easy to control the robotic arm with both of the servos running simultaneously.

Take in mind that the some of the parts must move freely. That means that you do not have to tighten the screws so tightly, as the components might not move due to friction. In the model bellow, I marked with blue the holes connecting those components.

You also must make sure that you make a base in a way that the robot does not fall due to the load weight. You can: 1. make a base support that is wide; 2. you attach it to a support (it may be just another robot), with bolts or glue; 3. any other idea.

Before printing the model, you can test the CAD design by simply selecting the parts and rotate them, with the center on the center of the servos.

3. 3D printing the model:

!!!Take note that in this sketch I didn't make holes for the robotic arm gripper, because the dimensions may vary. It's up to you to change the sketch or just make 2 holes in the 3d printed model.

I 3d printed the 2 axis sketch, which doesn't have a base, because I will use it for a mini robot car, who can itself turn. If you don't have a 3D printer, you can use a local one, the hardware stores usually have a 3D printer, and the prices are alright (for my parts I paid 20€). You might take in note that the printed robotic arm won't be perfect. That is because the printer has an error of 0, 1 mm or even more. In my sketch, I used bolts to connect the parts. Some of them (the parts that make up the 2 axis), need a bigger hole to allow them to move. You can resolve that with an electric screwdriver. Or you can use the bolts who have a grip lenght and a thread lenght. If some of the printed parts do not match, or the motors do not fit into their holes, you can smooth with a abrasive paper.

So that's your 3D printed robotic arm, good job :) Now you just need to wire the servos to your Arduino and power them up - for the servos, 4 AA batteries should be enough, you need only 6 Volts. The Arduino you can power it from your computer or from a 9V battery.

4. How to control your robotic arm?

1) With your PC:

You will need a calibration code (is in the code section), to test how the robotic arm works and if the servos are mounted well (for example I put my servo was near the 180° and it couldn't go back, only forward). The easiest way to test that is with your laptop or PC. The arduino board can be connected to the computer with through a USB port. How to wire it you can find in the schematics section.

Custom program to test if the servos work properly

You can write a custom program who executes a certain action, or a program where you can insert values. The Arduino processes them and the servos move.

2) With potentiometers (100k or 10k):

To use the robot, you need to figure out how it's movements work, more precisely the 2 principal axis. It can go up and down, forward and backward, but to perform a process by which it takes an object and do something with it, it becomes more complex.

The easiest way to understand how the robotic arm works, is to use the robot with potentiometers. They are easy to use and they need a short code (found in the code section).

Robotic arm used with potentiometers

3) With your phone (and HC-05 Bluetooth module):

Of course, to use your phone to control the robot might be the best choice. But this is where things get hard. You are dealing with both serial communication and the creation of an Android app for your phone to act as a remote control.

Check my other project if you want to see how to control your robotic arm with a phone:

https://create.arduino.cc/projecthub/Uwita/control-your-robot-with-your-phone-joysticks-app-a4ab50

Feel free to use and improve this project :)

Code

Code PC.inoArduino
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 potentiometersArduino
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);
}

Custom parts and enclosures

2 axis robotic arm
You can open it with SketchUp. This model has been tested.
2_axis_robotic_arm_DBL7lkSVph.skp
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.
3d_PxyV76BwOd.zip
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_Qrssl1cUYM.skp
3 axis robotic arm STL PARTS
This model has not been tested yet. The parts might not connect.
3d_98Lwd2jDMr.zip
2 axis robotic arm STL
You can find its parts in the zip attachment.
3 axis robotic arm STL

Schematics

Circuit design for PC
This is the circuit design if you wish to control your robotic arm with your pc through serial.
Circuitdesign1 fb6ju39ocp
Circuit design with potentiometers
This is the circuit design if you wish to control your robotic arm with potentiometers.
Untitled sketch 2 bb avwxto22ze

Comments

Similar projects you might like

RoboArm With 1Sheeld Gamepad

by Mohammed Magdy

  • 3,124 views
  • 0 comments
  • 11 respects

Control your RoboArm with your Smartphone

Project in progress by Zone Team

  • 12,215 views
  • 7 comments
  • 32 respects

Simple MPU6050 IMU + Arduino bot UPDATE

Project tutorial by Imalwaysontheinternet

  • 4,586 views
  • 14 comments
  • 28 respects

G-Code Arduino Library

Project in progress by tinkersprojects

  • 9,341 views
  • 2 comments
  • 15 respects

Where's my stuff?? - Find your misplaced things with Alexa!

Project in progress by Team Crakers

  • 3,018 views
  • 0 comments
  • 8 respects

Bluetooth Controlled Servo

Project tutorial by JANAK13

  • 23,352 views
  • 24 comments
  • 46 respects
Add projectSign up / Login