INTRODUCTION
Precision controlled mechanical movement has brought a revolutionary wave in robotics and automation space which can now be found across various industry ranging from manufacturing and manufacturing to healthcare. Thanks to the inexpensive microcontrollers (Arduino cost) that allow enthusiasts and hobbyists to control everything from its motor driver buying the microcontroller (Arduino), servo motor, and motor driver means to buy everything their own Bluetooth controllable robotic arm.
We see robotic arms in the industrial automation of a vast variety of applications including Pick and Place assembly lines. Now, with the ARA (Arduino Robotic Arm), from the comfort of your own home you can assemble a Robot Arm mounted on a 2WD Arduino car kit.
In this tutorial, we will discuss how to build your very own Arduino based Robotic Arm capable of being controlled over wireless and programed via an Android application created for that purpose. A special button permits maneuvering the various servos or axes of the robot arm within the application’s interface. Notably, this robot car encompasses two primary functions: The simulator includes: a 2WD car mode and control of a robotic arm. In order to achieve this integration, use of two DC motors and a robotic arm is chosen. We present the robotic arm itself through a 3D designed model and physically assembled iterations.
A kinematic study for Arm Robot Manipulator
Thought of building a robotic arm sounds gruesome and complex at the very first. However, when you delve deeper to the physics and kinematics behind it, as we ended up doing, there is actually no limit to the amount of adjustments you can apply. Then you will get that it is not that difficult.
The robotic arm holds 3 servo motors for 1 Gripper and 2 for Arm joints movement. It is 2 DOF (degree of freedom) for this robot. Even with the kinematics, the Arm is dependent on the angle and position of it.
Kinematics is a science that ignores the cause of the motion of an object (robot) and considers its motion. The kinematics treats itself about the position, the velocity, the acceleration and other higher derivatives of the position with respect to time. Thus kinematics is the study of those geometrical and time modification properties of motion.
An arm robot manipulator is constructed by a set of links, joints connecting the links, the bottom is called the based and the end is called end-eflector. The degree of freedom (DOF) is defined by the number of joints, and how it moves. There are revolute or prismatic joints. Fig below shows that 2 DOF robot consists of all revolute joints. Generally, 5 or 6 joints are available in typical applied in industries robot. For simplicity, kinematics and dynamics are derived for the case of the 2 DOF facility.
Forward Kinematics
In the context of the robot forward kinematics employs the robots kinematic equations to compute the position of the end effector given joint parameter values (that is the positions of servo motors in this context) to calculate the position of the end effector. The Denavit-Hartenberg parameters in sketch of the robotic arm below could help you visualize. The derived forward kinematic equation for the robotic arm is also presented.
An alternative approach was indeed pursued, where the equations derived will not be required to work within matrices, but the same equations still hold for those interested in investigating other approaches. But note that ‘C’ denotes cosine and ‘S’ means sine.
Inverse Kinematics
Solving Inverse Kinematics equations allows us to correctly control the end-effector movement and orientation of a robotic arm. However, these equations tell us what angle each joint should have if we want a position in space. This figure is a breakdown of the variables that are integral to the decision when we want to make these equations practical arm movements.
Like other robot arms, Arduino robot arms are usually judged by their degrees of freedom (DOF). The term count refers to the number of rotational joints in the robot’s body. The term DOF is interchangeable with the common term axes. For example, a 2DOF, 2 Axis robot arm is a robot arm where two distinct axes allows specific motion.
The robot arm arrives totally flat-pack and requires very little soldering under the instruction of just a few pictures. They include two MG90 servos, supporting two degrees of movement. Further, the gripper can grip lightweight objects very well.
“We call this the “Base,” or the “Waist,” which will provide either a 180° or 360° rotation of the arm depending on the type of servo used for this (a 180° Servo was used for this project).”
Vertically raising or lowering the arm is the job of the “Shoulder” maneuver.
The ‘Gripper’ can either open or close to ‘grab things.”
Types of Components that are required to develop a robotic arm car.
-
- As Arduino board (e.g., Arduino Uno)
-
- The (3x) MG 90 metal gear Servo motors
-
- L298N motor driver
-
- Chassis and Robotic arm mechanical components using laser cut.
-
- 12V Li-ion battery
-
- LM2596 DC-DC Buck Converter
-
- Switch
-
- Jumper wires
-
- Breadboard way or using a Printed Circuit Board (PCB).
-
- Screws, nuts, spacers
Assembly of Robotic Arm
For our project we have used acrylic sheet laser cut to make the Robotic Arm. All necessary fittings and components have been cut to match the sheet with precision, so assembly of the whole project can be done with a screwdriver.
We have to adjust the angle adjustment of the servo motors before beginning to assembly. If not then your robotic Arm will not function properly.
First, we connect the Servo Arm to the servo by lining it up and securing it.
### Alternative Responses:
Lining it up, and securing it, is the first part of connecting the Servo Arm to the servo. As sometimes it is not possible to manually calibrate or you don’t get accurate result with manual calibration so we can calibrate your servo motors using given code #1. Connect your servo motors to Arduino pins 5, 6, and 3 as shown on the circuit diagram mentioned below. Put the provided code #1 on your Arduino board so the calibration can run. If you don’t implement this step, your robot might not perform well.
Establish a stable well functioning robot by laying its foundation through proper calibration and alignment of the servos.
robotic arm movements angle values
Angle values for robotic arm movements
No. | Servo type | Angle of rotation on servo(in°) | Information |
1 | Servo gripper | 150° | Pinch |
60° | Open | ||
2 | Servo Waist | 45° | Down |
90° | Up | ||
3 | Servo Base | 0° | Right position |
90° | Middle position | ||
180° | Left position |
This angle value maybe changed cording to your servo adjustment. After done with servo adjustments, you can pass Assembly stages.
Step 1: Shown here is a picture of all of the required components for building the robotic arm.
Step 2: M2.5 10mm nuts and bolts are used to secure the servo motor to the gripper base plate.
Step 3: Glue an M4 10mm nut and bolt into each of the gripper gears, and attach them to the servo and base plate.
Step 4: M3 30mm nuts and bolts are used to secure the gripper hand to both gears at their respective positions.
Step 5: Use M3 and M4 10mm nuts and bolts to join the hand support link to the gripper hand and the servo base plate.
Step 6: Finally, insert M3 nuts and bolts to brake the side shoulder movement legs at their landing position as well as the side stoppers.
Bluetooth Controlled Robotic Arm Car with Arduino motor Control Using 3 Servo
In this setup the robot’s wheels (DC motors) are the DC motors that assist the robot to move in various directions. The three servo motors act as robot arm joints, twisting and turning at the waist, lifting and lowering the shoulder and opening and closing the gripper.
Luckily, for this project, all the motors run off of 5V, so you don’t need to worry about anything complicated. The motors are controlled with digital pins. Since we didn’t want to use the 5V pin on the Arduino because it wouldn’t give enough power to run all the motors well. To avoid this threshold, we use a DC-DC buck converter and a different power supply. That way, we can generate enough power so that all motors will run correctly.
Circuit Connection:
Arduino and L298n motor driver module Connections:
Connect the ground (GND) pin of the Arduino to the ground rail on the arduino breadboard.
Connect the positive rail on the breadboard to the Arduino Vin pin.
Then make your LM2596 DC DC buck converter 5 V output terminal attached to the breadboard positive rail terminal.
Connect ground (GND) of the LM2596 DC-DC buck converter to the ground (GND) rail on the breadboard.
Then connect the input 1 (IN1) and input 2 (IN2) pins of L298N motor driver board to two digital pins on Arduino board (for example pins 7 and 8) through which we can drive the first DC motor.
Connect the second DC motor control two digital Arduino pin (e.g. pin 12 and pin 11) by connecting input 3 (IN3) and input 4 (IN4) pins from L289N motor driver.
Connect the ENA and the ENB pin of the L298N motor driver to the on board high state pin of the L298N motor driver.
Servo Motor Connections:
The brown signal wire of the waist servo (first servo motor) is connected to a digital pin on the Arduino (switch to pin number 5, for example).
Attach the red positive wire of the waist servo to the positive rail on the breadboard.
Wire the waist servo’s black negative wire’s to breadboard’s ground rail.
Brown signal wire of a shoulder servo (second servo motor) connects to a Digital pin on the Arduino (e.g. pin 6).
Pins one and 9 are connected.
Black negative wire of shoulder servo connect with ground rail of breadboard.
Tie the brown signal wire of the gripper servo (third servo motor) to a digital pin of the Arduino (for example, pin 3).
Connect the positive rail from the breadboard to the positive red wire of the gripper servo.
Black Negative Wire of the Gripper Servo port to the Ground Rail on the Breadboard.
Bluetooth Module Connections:
The TX pin of the HC-05 Bluetooth module must be connected to RX pin (digital pin 0) of the Arduino.
To the Arduino RX pin (digital pin 1) connect the RX pin of the HC-05 Bluetooth module.
You can connect the VCC pin of the HC-05 module to the 5V rail on the breadboard.
Connect the HC-05 Bluetooth modules’ GND pin to the ground rail on the breadboard.
Power Connections:
Reach out the positive terminal of the 12V Li-ion battery to the LM2596 DC-DC buck converter Vin input.
Push the negative terminal of the battery into the ground rail on the breadboard.
L298n motor driver module 12V input connect to positive terminal 12V Li-ion battery.
Negative terminal of the battery connects with GND of L298n motor driver module.
More than one servo needs much more power than the Arduino Uno microcontroller can manage. As a result, an inputs of external power is required. The input voltage shouldn’t exceed 5 volts, or else it will cause damage to the Arduino microcontroller.
In case that you are using the cell with a higher voltage, you can use a DC -DC buck converter to adjust the voltage to 5V. The output of the voltage reducing circuit should connect to both Arduino and servo motors. This guarantees safe and efficient project of power.
Also, ensure that you set up the servo motor control and motor direction control in the Arduino Code. If you are powering on the circuit be sure to always double check your connections and make sure it is wired properly.
Explanation of Bluetooth‐Controlled Robotic Arm Car Code.
Car is, as you would have guessed, controlled by an Android app on Smart phone via Bluetooth. The App contains different button which are used to move the Car in forward, backward, left and right. It also controls the movements of the robotic arm waist, shoulder and gripper.
Whenever the specific button is pressed on the app, signals are sent to the corresponding servo motors in the robot robot telling them how to position the arm for each different type of movement.
This code #1 important to execute before starting the assembly stages. This code was written to calibrate and tweak the servo motors to their proper angles. Running this code will test if the servo motors are working correctly and are placed in proper orientation. In this way you’ll avoid getting into any potential issues, or complications, that might occur during the later stages of the assembly process.
Code #1
#include <ESP32_Servo.h> // include servo library
// Define 3 Servos
Servo myServo1; // waist or base Servo
Servo myServo2; // shoulder Servo
Servo myServo3; // gripper Servo
void setup() {
// Attach servos to Arduino PWM Pins
myServo1.attach(5);
myServo2.attach(6);
myServo3.attach(3);
myServo1.write(90);
myServo2.write(90);
myServo3.write(90);
}
void loop() {
}
This code #2 includes all the necessary servo motor movements to make your robot functional. Without this code, you will not be able to complete the project successfully. It is crucial for the proper operation of the robot.
This code outlines the setup and control mechanisms for a robotic arm and a 2WD Arduino car using servo motors and DC motors. It integrates Bluetooth communication to enable remote control and demonstrates how to manipulate servo angles and motor directions to achieve specific movements.
Code #2
#include <Servo.h>
Servo motor_1;
Servo motor_2;
Servo motor_3;
These lines include the necessary library for using servo motors and define three Servo objects (motor_1, motor_2, and motor_3) are created to control the three servos connected to pins 5, 6, and 3 respectively.
#define in1 7 //Motor1 L298 Pin in1
#define in2 8 //Motor1 L298 Pin in1
#define in3 12 //Motor2 L298 Pin in1
#define in4 11 //Motor2 L298 Pin in1
These lines define digital pins of Arduino (pin7,pin8,pin12 and pin11) for the L298N motor driver inputs to control the DC motors. The pins in1 and in2 control one motor, and the pins in3 and in4 control the other motor.
int servo1 = 90;
int servo2 = 0;
int servo3 = 90;
int bt_data;
int Speed = 130;
Initial positions (angles) for the three servos are set: servo1, servo2, and servo3. bt_data is used to store incoming Bluetooth data. Speed is initially set to 130.
void setup(){
Serial.begin(9600); // initialize serial communication at 9600 bits per second:
motor_1.attach(5); // Waist Servo
motor_2.attach(6); // Shoulder Servo
motor_3.attach(3); // Gripper Servo
motor_1.write(servo1);
motor_2.write(servo2);
motor_3.write(servo3);
//pinMode(enA, OUTPUT); // declare as output for L298 Pin enA
pinMode(in1, OUTPUT); // declare as output for L298 Pin in1
pinMode(in2, OUTPUT); // declare as output for L298 Pin in2
pinMode(in3, OUTPUT); // declare as output for L298 Pin in3
pinMode(in4, OUTPUT); // declare as output for L298 Pin in4
//pinMode(enB, OUTPUT); // declare as output for L298 Pin enB
digitalWrite(in1, LOW); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, LOW); //Left Motor backword Pin
digitalWrite(in4, LOW); //Left Motor forword Pin
delay(1000);
}
In the setup() function, serial communication is initialized at 9600 bits per second. The servo motors are attached to specific pins, and their initial positions are set. The digital pins for motor control and the motor driver pins are set as outputs. The motor driver pins are initially set to low to ensure the motors are not moving during setup.
void loop(){
//if some date is sent, reads it and saves in state
if(Serial.available() > 0){
bt_data = Serial.read();
Serial.println(bt_data);
if(bt_data > 20)
{Speed = bt_data;}
}
The loop function is where the main program logic runs in a continuous loop.
This code block reads incoming Bluetooth data from the serial connection. If the received data is greater than 20, it updates the Speed variable.
if(bt_data == 1)
{forword(); } // if the bt_data is '1' the DC motor will go forward
else if(bt_data == 2)
{backword();} // if the bt_data is '2' the motor will Reverse
else if(bt_data == 3)
{turnLeft();} // if the bt_data is '3' the motor will turn left
else if(bt_data == 4)
{turnRight();} // if the bt_data is '4' the motor will turn right
else if(bt_data == 5)
{Stop(); } // if the bt_data '5' the motor will Stop
These conditional statements check the value of bt_data and call corresponding functions (forword, backword, turnLeft, turnRight, Stop) based on the received data.
else if (bt_data == 8){
if(servo1<180){servo1 = servo1+1;}
motor_1.write(servo1);
}
else if (bt_data == 9){
if(servo1>0){servo1 = servo1-1;}
motor_1.write(servo1);
}
else if (bt_data == 10){
if(servo2>0){servo2 = servo2-1;}
motor_2.write(servo2);
}
else if (bt_data == 11){
if(servo2<180){servo2 = servo2+1;}
motor_2.write(servo2);
}
else if (bt_data == 16){
if(servo3>60){servo3 = servo3-1;}
motor_3.write(servo3);
}
else if (bt_data == 17){
if(servo3<150){servo3 = servo3+1;}
motor_3.write(servo3);
}
delay(30);
}
These conditional statements adjust the position of the waist servo (motor_1) based on the received Bluetooth data.
The remaining else if blocks adjust the positions of the shoulder and gripper servos (motor_2 and motor_3) similarly.
delay introduces a short pause between iterations of the loop function to prevent rapid and continuous execution.
void forword(){ //forword
digitalWrite(in1, HIGH); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, HIGH); //Left Motor forward Pin
digitalWrite(in4, LOW); //Left Motor backward Pin
}
void backword(){ //backword
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
}
void turnRight(){ //turnRight
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
void turnLeft(){ //turnLeft
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
}
void Stop(){ //stop
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}
The movements of the robot (forword, backword, turnLeft, turnRight, Stop) depend on states of the pins of motor driver.
The direction of the motors are controlled by these functions to achieve what is desired.
This way of organizing the code allows us to modulate the functionality while we can easily understand and maintain it. These conditional statements make sure that the proper movement function is executed whenever that certain condition is fulfilled given the received data.
BRAC: A Controlling Robotic Arm Car using Android App
In playstore there are so many different app’s that can control robot arm. For this project however, I will be making my own Android app using the help of MIT App Inventor.
To connect the Bluetooth-controlled robotic arm Car with your phone, follow these steps:
Do this simply by opening the “Robotic Arm Car” app on your Android device. For now, only Android users can use this app.
Go to your phone settings, and turn on the Bluetooth.
Put the HC-05 Bluetooth module in connect mode; pair it with your phone. If you have a new HC-05 module you have one more step before connecting.
Scroll over to the Bluetooth settings on your phone.
Search for Bluetooth devices.
A Bluetooth device called HC-05 will be there.
Then, select your phone and pair the Bluetooth device with your phone.
During the pairing process you will be asked to input a password.
Usually your default HC-05 password is either 1234 or 0000.
However enter the password and go with the pairing process.
Once your Android device pair with this Bluetooth Car, your Bluetooth Car is now connected to your Android device.
There are a total of 10 control buttons that work intuitively to enhance the user’s experience on this app. Of this four buttons are used for the movements of robot right, forward, backward, left. The remaining six buttons are dedicated to fine tuning servos angles of robotic arm.
The control buttons are then easily activated using our dedicated app once HC-05 Bluetooth module is properly paired with an Android phone. Pressing a control key results in the Android phone sending and receiving the correct value quickly and accurately, allowing for fictionary control of the robot and its robotic arm.
Conclusion
Work must be done to model an Arm robot manipulator from the kinematic work to figure out how it moves to the dynamic work necessary to determine how much energy is needed. This is an introduction to robotics and automation by building a Bluetooth controlled robotic arm with Arduino. The design of a 2 DOF manipulator robot prototype for lifting and moving light material objects is shown in this project using a Gripper. Enthusiasts can create a versatile, interactive mechanical systems by combining servos, motor drivers and Bluetooth communication. Other than demonstrating the fusion of hardware and software, it’s a project that can be a stepping rock for much more complex robotic endeavours. For those of you who are aspiring engineers, or for those of you who simply want to learn more about robotics, this project is an exciting and educational trip into the automation world.
CODES :
//PROVIDED BY ELECTROGLOBAL
#include // include servo library
// Define 3 Servos
Servo myServo1; // waist or base Servo
Servo myServo2; // shoulder Servo
Servo myServo3; // gripper Servo
void setup() {
// Attach servos to Arduino PWM Pins
myServo1.attach(5);
myServo2.attach(6);
myServo3.attach(3);
myServo1.write(90);
myServo2.write(90);
myServo3.write(90);
}
void loop() {
}
Code #2
#include <Servo.h>
Servo motor_1;
Servo motor_2;
Servo motor_3;
//#define enA 9 //Enable1 L298 Pin enA
#define in1 7 //Motor1 L298 Pin in1
#define in2 8 //Motor1 L298 Pin in1
#define in3 12 //Motor2 L298 Pin in1
#define in4 11 //Motor2 L298 Pin in1
//#define enB 9 //Enable2 L298 Pin enB
int servo1 = 90;
int servo2 = 0;
int servo3 = 90;
int bt_data;
int Speed = 130;
void setup(){
Serial.begin(9600); // initialize serial communication at 9600 bits per second:
motor_1.attach(5); // Waist Servo
motor_2.attach(6); // Shoulder Servo
motor_3.attach(3); // Gripper Servo
motor_1.write(servo1);
motor_2.write(servo2);
motor_3.write(servo3);
//pinMode(enA, OUTPUT); // declare as output for L298 Pin enA
pinMode(in1, OUTPUT); // declare as output for L298 Pin in1
pinMode(in2, OUTPUT); // declare as output for L298 Pin in2
pinMode(in3, OUTPUT); // declare as output for L298 Pin in3
pinMode(in4, OUTPUT); // declare as output for L298 Pin in4
//pinMode(enB, OUTPUT); // declare as output for L298 Pin enB
digitalWrite(in1, LOW); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, LOW); //Left Motor backword Pin
digitalWrite(in4, LOW); //Left Motor forword Pin
delay(1000);
}
void loop(){
//if some date is sent, reads it and saves in state
if(Serial.available() > 0){
bt_data = Serial.read();
Serial.println(bt_data);
if(bt_data > 20)
{Speed = bt_data;}
}
//analogWrite(enA, Speed); // Write The Duty Cycle 0 to 255 Enable Pin A for Motor1 Speed
//analogWrite(enB, Speed); // Write The Duty Cycle 0 to 255 Enable Pin B for Motor2 Speed
if(bt_data == 1)
{forword(); } // if the bt_data is '1' the DC motor will go forward
else if(bt_data == 2)
{backword();} // if the bt_data is '2' the motor will Reverse
else if(bt_data == 3)
{turnLeft();} // if the bt_data is '3' the motor will turn left
else if(bt_data == 4)
{turnRight();} // if the bt_data is '4' the motor will turn right
else if(bt_data == 5)
{Stop(); } // if the bt_data '5' the motor will Stop
else if (bt_data == 8){
if(servo1<180){servo1 = servo1+1;}
motor_1.write(servo1);
}
else if (bt_data == 9){
if(servo1>0){servo1 = servo1-1;}
motor_1.write(servo1);
}
else if (bt_data == 10){
if(servo2>0){servo2 = servo2-1;}
motor_2.write(servo2);
}
else if (bt_data == 11){
if(servo2<180){servo2 = servo2+1;}
motor_2.write(servo2);
}
else if (bt_data == 16){
if(servo3>60){servo3 = servo3-1;}
motor_3.write(servo3);
}
else if (bt_data == 17){
if(servo3<150){servo3 = servo3+1;}
motor_3.write(servo3);
}
delay(30);
}
void forword(){ //forword
digitalWrite(in1, HIGH); //Right Motor forword Pin
digitalWrite(in2, LOW); //Right Motor backword Pin
digitalWrite(in3, HIGH); //Left Motor forward Pin
digitalWrite(in4, LOW); //Left Motor backward Pin
}
void backword(){ //backword
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
}
void turnRight(){ //turnRight
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);
}
void turnLeft(){ //turnLeft
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, HIGH);
}
void Stop(){ //stop
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
}