# How To Make A Robotic Arm With Arduino and servo motors

In this tutorial, we shall discuss how to make a Robotic arm with Arduino using servo motors and some other easy to source parts. The type of robot we shall design is an articulated robotic arm. In the last tutorial, we discussed to a reasonable length how a servo motor works, and how to use servo motor with arduino.

Meanwhile, let’s define what an articulated robot is.

An Articulated robot is a robot that has a rotary base with two or more rotary joints.

## Topics to Learn in Robot Design

The design of robots requires a mastery of at least the following three topics:

1. Sensors and machine vision
2. Kinematics
3. Motion control

Imagine you are standing in a room and wishes to drop a cup in your hand on a table, well, that might be a very simple task. However, designing a robot that can do that is a very sophisticated task.

Firstly, the robot has to scan its environment to spot where the table is located in the room and differentiate the table’s image from the images of other objects in the room. This is made possible by sensors and machine vision of the robot.

Secondly, the robot will have to move its arm with respect to the location of the table, this is called kinematics. This requires the robot manipulating its actuators to assume the right joint angles for its arm’s motion.

Thirdly, the robot has to drop the cup on the table with the appropriate speed and force as it moves its arm. If the robot moves faster than it should or exerts more force than required, it might miss the table or throw the cup off the table. The ability of the robot to achieve smooth and accurate motion is called motion control.

## Important terms to note on how to make a robotic arm

Before we delve into discussing the topic of this tutorial, how to make a robotic arm with Arduino, let’s define and explain some important concepts in robotics, meanwhile, Robotics is an engineering and technological interdisciplinary field that comprises of electronics, mechanics and computing. How to make a robotic, is laden with a lot of mathematics, but we shall reduce the mathematics to bare minimum and focus more on the making.

Articulated body

An articulated body is a dynamic framework (skeleton) of a human, animal or a system. It is a tree of linked chains. The linked chains are made up of links and joints.

A link is a rigid body, i.e. a body that does not move

Joint

A point or region that allows free movement with some constraints

Degree of Freedom (DoF)

Simply put is the minimum number of actuated joints to control the robot or the number of independent ways by which a dynamic system can move, without violating any constraint imposed on it.

When a joint and a link merge together, they form a linkage.

The model of an articulated body made from linkages is called a Kinematic chain. A kinematic chain is shown below.

Linkages are designed to manage forces and movements in a robot, like changing the direction of force or making two parts move at the same time.

The nature of movement of a link is determined by the type of joint used in the robot design. The figure below shows the various robot joints we have.

Our robot is going to have just one type of joint, a revolute joint.

A revolute joint is a type of joint that rotates round a link much like how a clock hand rotates round the center pin of the clock.

Having talked about few concepts that are necessary to understanding an articulated robot design, we will now proceed to the design proper.

Our robotic arm will be a simple articulated robot with two degrees of freedom using revolute joints.

## Parts and tools required to make the robotic arm with Arduino are:

Arduino Uno board
SG90 Servo motor x 3
5 volts 5A power supply
Robot Gripper
Jumper wires
Wooden materials as base and links
Screw driver
Hot glue

After getting all the necessary materials and tools required for the project , you connect the parts as shown in the video below.

## The Arduino code for the robot is shown below.

``````#include <Servo.h>
Servo myservo1;  // create servo object to control a servo at the arm
Servo myservo2;  // create servo object to control a servo at the base
Servo myservo3;   // create servo object to control a servo at the end effector
int pos;    // variable to store the servo position for the base
int pos1;  // variable to store the servo position for the arm
void setup()  // the codes inside this function runs once immediately the arduino is powered or reset button pressed
{myservo1.attach(9); // attaches the servo on pin 9 to the servo object myservo1
myservo2.attach(10); // attaches the servo on pin 10 to the servo object myservo2
myservo3.attach(11);   //// attaches the servo on pin 11 to the servo object myservo3

for (pos1= 0; pos1<=50; pos1+=1)
{                                    // we use a for loop to increamentally move...
myservo1.write(pos1);             //...the arm of the manipulator to 140 degrees in 1 degrees steps
delay(50);
}
}
void loop()                   //    the codes inside this function functions repeatedly
{for (pos = 0; pos <=180; pos+=2)  // we use a for loop to move the base rapidly to 0 degrees position...
{myservo2.write(pos);          // ...and slowly to 180 degrees position where it will pick an object
delay(50);}
delay(1000);                    // the robots does nothing for one second
myservo3.write(150);             // we open the gripper(robot's end effector)
delay (1000);                      // the robot does nothing for half a second
for(pos1 =50; pos1>=0; pos1-=1) // we use a for loop to move the arm 50 degrees lower, to pick an object
{myservo1.write(pos1);
delay(50);
}
delay(1000);     // the robot does nothing for second
myservo3.write(125);  // the robot gripper(end effector) closes
delay (1000);       //the robot does nothing for one second
for(pos1=0; pos1<=50; pos1+=1) // we use a for loop to movw the arm to 50 degrees position
{myservo1.write(pos1);
delay(50);}

delay (1000);      // the robot does nothing for one second
for(pos = 180; pos >=0; pos-=1)  // we use a for loop to return the arm...
{myservo2.write(pos);          //...to 0 degrees position where the gripper will dropo the object
delay(50); }
delay(1000);                   //the robot does nothing for one second
myservo3.write(150);             // the gripper opens and drops the object
delay(2000);                    //the robot does nothing for one second
myservo3.write(125);              // the robot closes its gripper
}``````

### 2 Comments on “How To Make A Robotic Arm With Arduino and servo motors”

1. Godwin says:

Hello Ettron am Godwin, I read your article about adsense arbitrage. I wanna want to do it but am scared of adsense banned. From the view of things I can see you doing it. Please I would like us to talk about it. Please you can send me your number on this mail so I can chat you up on WhatsApp. Hope you see this message

1. ettron says:

I’ve replied to your chat on whatsapp