How To Make A Mobile Controlled Robotic Arm Using Arduino Uno

Hey friends, searching the web for your final year major project then your search is over. Here you can easily learn to make a mobile controlled Robotic Arm using Arduino Uno and Bluetooth module HC-06. You can submit the project as making it only a RC car i.e. a Bluetooth controlled car. I’ve named this project as RoboDroid as it utilizes the concept of both Robotics and Android.

RoboDroid is a mechanical arm with a movable base that is controlled by Android Smartphone via Bluetooth module. Hc-06 is used as the Bluetooth module as it is a most commonly used Bluetooth module and can be easily programmed with Arduino Uno. The RoboDroid can function similar to the human arm as specified by the controller or can be used for the automation purposes.

List of components required-

  1. Arduino Uno r3
  2. Robotic Arm Assembling
  3. HC-06 Bluetooth module
  4. Motor Driver IC L293d
  5. Power Supply
  6. RoboDroid Mobile Application

1. The Arduino Platform

The Arduino platform is an open source electronic prototyping system that is used to make cool electronic projects. The Arduino board requires Arduino Software (also known as the Arduino IDE) to write code and upload the code into the board. To learn more about the Arduino platform and to download the Arduino IDE software you can see my previous post Introduction to the Arduino Platform and why you need one.

2. Assembling the RoboDroid

1. Making the Chassis: The chassis carry the whole weight of the robot and functions as the moving base of the RoboDroid. The base will carry the arm to the desired position. It is made up of sun mica sheet. Two dc geared motor are used in rear wheels while two ball bearings serve as front wheel function. And are driven using motor driver IC L293d. The operating voltage of dc geared motor is 9-12 volt.

Chassis Of RoboDroid
Chassis Of RoboDroid

2. Mounting Robotic Arm: The base(waist) of the robotic arm is bolted on the chassis. The waist offers précised position control of 0 to 360 degrees. The waist servo motor control the waist movement, two motors control shoulder movement, one servo motor control wrist movement and the remaining one control the gripper movement. There is a gear system in gripper part that convert the rotational motion of servo into opening and closing of the gripper.

Mobile Controlled Robotic Arm
RoboDroid

3. Connecting the Bluetooth Module HC-06

The Bluetooth module is used for communication between smart phone and the Arduino. The module is powered from Arduino 3.3 volt supply. Learn how to interface Bluetooth module HC-06 with Arduino.

4. Motor Driver IC L293d

The L293D are quadruple high-current half-H driver. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. For further information about L293d you can download the datasheet.

 

Pin Configuration Of L293d
Pin Configuration Of L293d

Specifications:

Supply Voltage: 4.5V to 36V

Output current per driver: 600mA

Pulsed Current: 1.2A Per Driver

How To Connect DC Motors With L293d (Motor Driver IC) and Arduino Uno

Connecting L293D (Motor Driver IC) With Motor
Connecting L293D (Motor Driver IC) With Motor

 5. Power Supply For RoboDroid

The servo motors, the motor driver and Arduino are powered from the 7.2 V LiPo (lithium polymer) battery. The LiPo battery supplying the power to servos has very high current rating (3000 mAh in my case). Or use the power supply as per the specification of the Robotic Arm. For giving the power supply to servo motors of the RoboDroid I’ve made a simple circuit. The circuit for connecting servo motors of the RoboDroid with a power supply:

Servo Motor Connection

Waist Servo – Arduino Pin No. 8

Shoulder Servo – Arduino Pin No. 9

Wrist Servo – Arduino Pin No. 10

Gripper Servo – Arduino Pin No. 11

6. RoboDroid Mobile Application

The mobile application can be easily developed using the app inventor tool. I’ve too developed a RoboDroid app to control my Robotic arm.

Application To Control Robotic Arm
Application To Control Robotic Arm

7. Arduino Code To Control Robotic Arm

[code language=”c”]
#include<Servo.h> //Servo Library
///////////////////////////////////////////four pins at which four in pous of l293d are connected///////////////////////////////////////////////////////////
const int LM1=3; // pin 3- output of l293d is connected to BLACK wire of dc Motor
const int LM2=4; // pin 6- output of l293d is connected to WHITE wire of dc Motor
const int RM1=5; // pin 10- output of l293d is connected to YELLOW wire of dc Motor
const int RM2=6; // pin 14- output of l293d is connected to GREEN wire of dc Motor
int flag=0,stats=0,sign=0,mark=0;
char ch=0;
////////////////////////////////four servo objects///////////////////////////////////////////////////////////////////////////////////////////////////////////
Servo waist_servo; //Waist Servo
Servo shoulder_servo; //Shoulder Servo
Servo wrist_servo; //Wrist Servo
Servo gripper_servo; //Gripper Servo
/////////////////////////////////////angles of four servo////////////////////////////////////////////////////////////////////////////////////////////////////
int waist_angle = 10; //waist angle between 10 & 170
int shoulder_angle = 130; //shoulder angle between 40 & 130,0 at bottom position
int wrist_angle = 30; //wrist angle between 30 & 150
int gripper_angle = 150; //gripper angle 180 closed,150 0pen
//////////////////////////////////clsaa to drive base of the robot////////////////////////////////////////////////////////////////////////////////////////
class DRIVE
{
public:
void update() //for contineous rotation of the dc motors
{
Serial.println(flag);
switch(flag)
{
case 1 : move_forward();
break;
case 2 : move_backward();
break;
case 3 : rotate_clockwise();
break;
case 4 : rotate_anticlockwise();
break;
case 5 : stp();
break;
}
}
void move_forward() //to move forward
{
analogWrite(LM1,180);
digitalWrite(LM2,LOW);
analogWrite(RM1,140);
analogWrite(RM2,0);
}
void move_backward() //to move backforward
{
analogWrite(LM1,0);
digitalWrite(LM2,HIGH);
analogWrite(RM1,0);
analogWrite(RM2,175);
}
void rotate_clockwise() //to rotate_clockwise
{
analogWrite(LM1,180);
digitalWrite(LM2,LOW);
analogWrite(RM1,0);
analogWrite(RM2,180);

}
void rotate_anticlockwise() //to rotate_anticlockwise
{
analogWrite(LM1,0);
digitalWrite(LM2,HIGH);
analogWrite(RM1,180);
analogWrite(RM2,0);
}
void stp() //to stop the base
{
analogWrite(LM1,0);
digitalWrite(LM2,LOW);
analogWrite(RM1,0);
analogWrite(RM2,0);
}
};
///////////////////////////////class to drive servo motors//////////////////////////////////////////////
class SERVO_DRIVE
{
public:
int i;
void set_waist_angle(int sign) // waist servo drive
{
if(sign==1)
{
for(i=1;i<=10;i++)
{
waist_servo.write(waist_angle+i);
Serial.println(waist_angle+i);
delay(50);
}
}
else
if(sign==0)
{
for(i=0;i<=10;i++)
{
waist_servo.write(waist_angle-i);
Serial.println(waist_angle-i);
delay(50);
}
}
}
void set_shoulder_angle(int sign) // shoulder servo drive
{
if(sign==1)
{
for(i=1;i<=10;i++)
{
shoulder_servo.write(shoulder_angle+i);
Serial.println(shoulder_angle+i);
delay(20);
}
}
else
if(sign==0)
{
for(i=0;i<=10;i++)
{
shoulder_servo.write(shoulder_angle-i);
Serial.println(shoulder_angle-i);
delay(20);
}
}
}
void set_wrist_angle(int sign) // wrist servo drive
{
if(sign==1)
{
for(i=1;i<=10;i++)
{
wrist_servo.write(wrist_angle+i);
Serial.println(wrist_angle+i);
delay(20);
}
}
else
if(sign==0)
{
for(i=0;i<=10;i++)
{
wrist_servo.write(wrist_angle-i);
Serial.println(wrist_angle-i);
delay(20);
}
}
}
void set_gripper_angle(int sign) // gripper servo drive
{
if(sign==1)
{
for(i=1;i<=10;i++)
{
gripper_servo.write(gripper_angle+i);
Serial.println(gripper_angle+i);
delay(20);
}
}
else
if(sign==0)
{
for(i=0;i<=10;i++)
{
gripper_servo.write(gripper_angle-i);
Serial.println(gripper_angle-i);
delay(20);
}
}
}
void set_position()
{
wrist_servo.detach();
for(i=shoulder_angle;i<=130;i++) //moving shoulder to top position
{
shoulder_servo.write(i);
delay(100);
}
shoulder_servo.detach();
delay(100);
shoulder_angle=130;
waist_servo.attach(8);
for(i=waist_angle;i<=170;i++) //moving waist to left position
{
waist_servo.write(i);
delay(50); }
waist_angle=170;
waist_servo.detach();
delay(500);
shoulder_servo.attach(9);
for(i=shoulder_angle;i>=40;i–) //moving shoulder to bottom position
{
shoulder_servo.write(i);
delay(100);
}
shoulder_angle=40;
delay(500);
for(i=gripper_angle;i<=180;i++) //closing the gripper
{
gripper_servo.write(i);
delay(150);
}
gripper_angle=180;
delay(500);
for(i=shoulder_angle;i<=130;i++) //moving shoulder to top position
{
shoulder_servo.write(i);
delay(100);
}
shoulder_servo.detach();
delay(500);
shoulder_angle=130;
waist_servo.attach(8);
for(i=waist_angle;i>=10;i–) //moving waist to left position
{
waist_servo.write(i);
delay(50);
}
waist_angle=10;
waist_servo.detach();
shoulder_servo.attach(9);
for(i=shoulder_angle;i>=45;i–) //moving shoulder to bottom position
{
shoulder_servo.write(i);
delay(100);
}
shoulder_angle=40;
for(i=gripper_angle;i>=150;i–) //opening the gripper
{
gripper_servo.write(i);
delay(150);
}
gripper_angle=150;
wrist_servo.attach(10);
}
};
////////////////////////////////////creating a drive class objetc//////////////////////////////
DRIVE forward = DRIVE();
////////////////////////////////////class to read data/////////////////////////////////////////
class READ_DATA
{
public:
READ_DATA()
{
}
void detect_drive()
{
if(ch>=65||ch<=69) { base_drive(); stats=1; }
else stats=2;
}
void base_drive()
{
switch(ch)
{
case ‘a’: forward.move_forward();
flag=1;
Serial.println("FORWARD");
break;
case ‘b’: forward.rotate_clockwise();
flag=3;
Serial.println("LEFT");
break;
case ‘c’: forward.rotate_anticlockwise();
flag=4;
Serial.println("RIGHT");
break;
case ‘d’: forward.move_backward();
flag=2;
Serial.println("REVERSE");
break;
case ‘e’: forward.stp();
flag=5;
Serial.println("STOP");
break; }
}
};
//////////////////////OBJECT OF READ_DATA CLASS///////////////////////////////////////
READ_DATA r = READ_DATA();
SERVO_DRIVE s = SERVO_DRIVE();
/////////////////////////////////////////////////////////////////////////////////////
void setup()
{
Serial.begin(9600);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
shoulder_servo.attach(9);
gripper_servo.attach(11);
gripper_servo.write(160); }
///////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
int i;
if(Serial.available()>0)
{
ch = Serial.read();
Serial.flush();
r.detect_drive();
if(stats==1)
forward.update();
/////////////////////////////////////////////////////////////////////////////////
while(ch==’f’) //if f is received then increase waist_angle
{
waist_servo.attach(8);
wrist_servo.detach();
if(waist_angle>=170)
break;
else
s.set_waist_angle(1);
waist_angle+=10;
ch = Serial.read();
Serial.flush();
waist_servo.detach();
}
while(ch==’g’) //if g is received then decrease waist_angle
{
waist_servo.attach(8);
wrist_servo.detach();
if(waist_angle<=10)
break;
else
s.set_waist_angle(0);
waist_angle-=10;
ch = Serial.read();
Serial.flush();
waist_servo.detach();
}
//////////////////////////////////////////////////////
while(ch==’h’) //if h is received then increase shoulder_angle
{
if(shoulder_angle>=130)
break;
else
s.set_shoulder_angle(1);
shoulder_angle+=10;
ch = Serial.read();
Serial.flush();
}
while(ch==’i’) //if i is received then decrease shoulder_angle
{
if(shoulder_angle<=40)
break;
else
s.set_shoulder_angle(0);
shoulder_angle-=10;
ch = Serial.read();
Serial.flush(); }
//////////////////////////////////////////////////////////
while(ch==’n’) //if n is received then increase wrist_angle
{
wrist_servo.attach(10);
if(wrist_angle>=150)
break;
else
s.set_wrist_angle(1);
wrist_angle+=10;
ch = Serial.read();
Serial.flush();
wrist_servo.detach();
}
while(ch==’o’) //if o is received then decrease wrist_angle
{
wrist_servo.attach(10);
if(wrist_angle<=30)
break;
else
s.set_wrist_angle(0);
wrist_angle-=10;
ch = Serial.read();
Serial.flush();
wrist_servo.detach(); }
/////////////////////////////////////////////////////
while(ch==’p’) //if p is received then increase gripper angle
{
if(gripper_angle>=180)
break;
else
s.set_gripper_angle(1);
gripper_angle+=10;
ch = Serial.read();
Serial.flush();
}
while(ch==’q’) //if q is received then decrease gripper_angle
{
if(gripper_angle<=150)
break;
else
s.set_gripper_angle(0);
gripper_angle-=10;
ch = Serial.read();
Serial.flush();
}
if(ch==’x’) //if f is received then call set_position function
{
s.set_position();
}
}
}
[/code]