PLASTIC BOTTLE COLLECTING ROBOT-Semester 08

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

SOFTWARE IMPLEMENTIATION FOR PLASTIC

BOTTLE COLLECTING ROBOT

A PROJECT REPORT

Submitted by

DE ALWIS K K D T N

PERERA H P N

in partial fulfillment for the award of the degree

of

BACHELOR OF SCIENCE IN ENGINEERING (HONS)

IN

MECHANICAL ENGINEERING

FACULTY OF ENGINEERING

SOUTH EASTERN UNIVERSITY OF SRI LANKA

OCTOMBER 2017
ii

SOUTH EASTERN UNIVERSITY OF SRI LANKA

BONA FIDE CERTIFICATE

Certified that this project report “PLASTIC BOTTELE COLLECTING


ROBOT” is the bona fide work of “K K D T N DE ALWIS & H P N PERERA”
who carried out the project work under our supervision.

SIGNATURE SIGNATURE

DR. A M U MUZATHIK ENG. RAMESHA SOYSA

HEAD OF THE DEPARTMENT MAIN SUPERVISOR

DEPARTMENT OF MECHANICAL ENGINEERING DEPARTMENT OF MECHANICAL ENGINEERING

FACULTY OF ENGINEERING FACULTY OF ENGINEERING

SOUTH EASTERN UNIVERSITY OF SRI LANKA SOUTH EASTERN UNIVERSITY OF SRI LANKA

OLUVIL OLUVIL

SIGNATURE

ENG. R. RATHEESAN

CO. SUPERVISOR

DEPARTMENT OF MECHANICAL ENGINEERING

FACULTY OF ENGINEERING

SOUTH EASTERN UNIVERSITY OF SRI LANKA

OLUVIL
iii

ABSTRACT

This article presents the software implementation of the project: plastic bottle collecting robot, that
could be utilized in high-risk places such as high-rise building construction sites and highway
roads using wireless communications. The robot is built on the moving platform with robot arm,
and basket for gather bottles which can unload them in a certain place. The user can command the
robot to navigate it with android powered mobile phone via Bluetooth. A program developed in
Arduino application based on programming to control the all actuators. Image processing part is
done by Matlab and it measures the distance between object and the cmaera to arrange the angles
of robot arm components to reach the plastic bottle.
iv

TABLE OF CONTENTS

ABSTRACT ...................................................................................................................................iii
LIST OF TABLES .......................................................................................................................... v
LIST OF FIGURES ......................................................................................................................... v
LIST OF SYMBOLS AND ABBRIVIATIONS ............................................................................. v
ACKNOWLEDGEMENTS ........................................................................................................... vi
1. INTRODUCTION ....................................................................................................................... 1
2. LITERATURE REVIEW ............................................................................................................ 2
3. PROJECT OBJECTIVE .............................................................................................................. 6
4. METHODOLOGY ...................................................................................................................... 7
5. RESULT ...................................................................................................................................... 9
5.1 Platform ................................................................................................................................. 9
5.1.1 Bluetooth Connection ................................................................................................... 11
5.2 Object Distance Measurement Using a Single Camera ...................................................... 12
5.2.1 The Image Processing Algorithm ................................................................................. 12
5.2.2 MATLAB Function ...................................................................................................... 14
5.3 MATHLAB Robotics Toolbox ........................................................................................... 15
5.3.1 Create the Robot Arm in MATLAB ............................................................................ 16
3. Define DH (Denavit–Hartenberg) table, links using link command:................................ 16
5.4 Robotic Arm ........................................................................................................................ 18
5.5 Unloading ............................................................................................................................ 19
6. DIFFICULTIES ........................................................................................................................ 20
7. SUGGESTIONS AND FUTURE WORKS .............................................................................. 21
CONCLUSION ............................................................................................................................. 22
REFERENCE ................................................................................................................................ 23
APPENDIX 1 ................................................................................................................................ 24
APPENDIX 2 ................................................................................................................................ 30
APPENDIX 3 ................................................................................................................................ 32
v

LIST OF TABLES

Table 01: DH Table ....................................................................................................................... 17

LIST OF FIGURES

Figure 01: Flow Chart ..................................................................................................................... 7


Figure 02: Initial design of the platform ......................................................................................... 9
Figure 03: Initial Platform Control Diagram................................................................................... 9
Figure 04: Final Output of Platform .............................................................................................. 10
Figure 05: Final Platform Control Diagram .................................................................................. 10
Figure 06: Bluetooth Controller Android Phone Display ............................................................. 11
Figure 07: HC-05 Bluetooth Module ............................................................................................ 11
Figure 08: Standard frame assignment .......................................................................................... 12
Figure 09: RGB model of the image ............................................................................................. 13
Figure 10: Image obtained after threshold ................................................................................... 13
Figure 11: Final Output from of the matlab function .................................................................... 15
Figure 12: Robotic Toolbox Interface ........................................................................................... 16
Figure 13: Robotic Arm Position in graphically ........................................................................... 17
Figure 14: Robotic Arm ................................................................................................................ 18
Figure 15: Matlab Output through Arduino .................................................................................. 19
Figure 16: Loading and Unloading Bucket ................................................................................... 19

LIST OF SYMBOLS AND ABBRIVIATIONS

Wi-Fi Wireless Fidelity


DH Denavit–Hartenberg
vi

ACKNOWLEDGEMENTS

We would like to convey our heartiest thanks to following people who helped us in numerous
ways to completion of our Final Year Project.

We like to convey our sincere gratitude to the Senior Lecturer, Dr. A M Muzathik, Head of the
Department, Department of Mechanical Engineering, Faculty of Engineering, South Eastern
University of Sri Lanka for providing necessary support and advice.

We would like to thank the Final Year Project coordinator Eng.P. Balthazar in Department of
Mechanical Engineering, for the arrangement and coordination of the final year project.

We would like to express our special thanks of gratitude to our project main supervisor
Eng.Ramesha Soysa for the most valuable guidance in supervising this project. Also, we express
our special thanks of gratitude to our project co. supervisor Eng. R. Ratheesan for all other
supports on our project.

Further, we would like to thankful to the Workshop Engineer Mr. Subrey and workshop staffs
for their help and advices.

Moreover, we would like to convey our sincere gratitude to our parents, friends, and personnel
for their cooperative us to do the project.

DE ALWIS K K D T N
PERERA H P N
Department of Mechanical Engineering,
Faculty of Engineering,
South Eastern University of Sri Lanka.
1

1. INTRODUCTION

Environmental pollution is one of the major concerns in the world and one of the main
environmental pollutants is plastic. The reason for this is that plastics do not respond to decay with
the bacterial reaction. Therefore, among other pollutants, plastics such as drinking water bottles,
polythene bags, beverage cans, and yogurt cups causes a great threat to the environment.

The modern daily lifestyles, people prefer drinking bottled water for avoid health issues caused by
unclean supplies of water. Also, other instant drinks are packed in plastic bottles due to low cost,
ease of handling, no reaction with the content of water and carbonated drinks.

This however causes an increase in the amount of plastic disposal to the environment. Although
there are some proper ways to dispose plastic bottles or other items for recycling, some people are
not aware of them or do not take effort in following the procedure. They put empty water bottles
in everywhere despite the harm it causes to the environment we live in.

To reduce the environmental pollution, these types of wastes need to be collected and disposed
properly. Currently, in most countries, especially third world counties, plastic waste collection
process is done by manually. Although using human labor is efficient at times, there are locations
that are not safe and pose difficulties when collecting waste. Such critical areas are beside the
highways, construction sites, and beside the busy railway stations. Thus, developing a robot to
work on plastic waste collecting for these critical areas will allow us to safely perform the task.

Basically this Robot consist of few major systems such as moving platform, camera with image
processing system, robot arm and unloading system. All the controling part of the robot is done by
Arduino and MATLAB. Expect image processing, all other controling prosesses done by Arduino.
totally three arduino (Two Arrduino Mega 2560 and one Arduino Uno) boards were used for
control Robot arm, Unloading system and for the moving platform respectively.

Arduino Mega or Arduino Uno microcontrollers were not capable enough for the process of image
processing. then the image processing was done by Matlab software. the visual output of camera
of robot is observed by Matlab and calculates the distance between the captured object and the
camera. Then the the positioning angles of robot arm to reach the object also done by MATLAB.
2

2. LITERATURE REVIEW

Several research papers and articles relevant to software developing of the robot were referred to
while developing and improving our project (Plastic bottle collecting robot). The basic ideas and
the technologies observed in those publications are briefly discussed below.

2.1 Sending and Receiving Data via Bluetooth with an Android Device [1]

Android developers often need to use Bluetooth in their projects. Unfortunately, Bluetooth
can be confusing to use for those unfamiliar with the process. This application note details
a method to utilize Bluetooth to communicate with a microcontroller. This method includes
verifying Bluetooth support and status, pairing and connecting to the microcontroller’s
Bluetooth module, and sending and receiving data serially.

2.2 Bluetooth based home automation system using cell phone [2]

This paper presents the design and implementation of a low cost but flexible and secure
cell phone based home automation system. The design is based on a standalone Arduino
BT board and the home appliances are connected to the input/ output ports of this board
via relays. The communication between the cell phone and the Arduino BT board is
wireless. This system is designed to be low cost and scalable allowing variety of devices
to be controlled with minimum changes to its core.

2.3 Object Distance Measurement Using a Single Camera for Robotic Applications[3]

This thesis mainly focuses on the development of object distance measurement and feature
extraction algorithms using a single fixed camera and a single camera with variable pitch
angle based on image processing techniques. As a result, two different improved and
modified object distance measurement algorithms were proposed for cases where a camera
is fixed at a given angle in the vertical plane and when it is rotating in a vertical plane. In
the proposed algorithms, as a first step, the object distance and dimension such as length
and width were obtained using existing image processing techniques. Since the results were
not accurate due to lens distortion, noise, variable light intensity and other uncertainties
such as deviation of the position of the object from the optical axes of camera, in the second
step, the distance and dimension of the object obtained from existing techniques were
modified in the X- and Y-directions and for the orientation of the object about the Z-axis
in the object plane by using experimental data and identification techniques such as the
least square method.
3

2.4 Vision controlled pick and place of moving object by 3R robot[4]

This paper presents a 3R robot in eye to -hand orientation for the application of pick and
place of a moving object using vision system. The methodology consists of real time video
extraction, object detection using the motion of object as classification criterion and point
based tracking to predict future state of the moving object using Kalman filter in
MATLAB. The tracked estimate is transferred to the robot using Arduino platform. A
3R robot with three degrees of freedom is subjected to the implementation of the
methodology. A USB webcam is used to provide the visual information to the computer,
where image processing is done on the captured video and object is detected and the future
position of the object is predicted using Kalman filter algorithm.

2.5 Experiments in 3D measurements by using single camera and accurate motion [5]

A method to capture 3D coordinates of object features is described and preliminary results


of this experiments are presented. This method is based on the utilization of traditional
parallax equations, determination of undistorted image coordinates, and accurately known
motion of a CCD-camera. Error sources of the method are described and equations to
estimate the effect of these errors on the results of the 3D reconstruction derived. An
experimental setup suitable for light assembly application measurements was constructed.

2.6. Stereo vision images processing for real-time object distance and size
measurements [6]

In this project, proposed to utilize stereo vision system to accurately measure the distance
and size (height and width) of object in view. Object size identification is very useful in
building systems or applications especially in autonomous system navigation. Many recent
works have started to use multiple vision sensors or cameras for different type of
application such as 3D image constructions, occlusion detection etc. Multiple cameras
system has becoming more popular since cameras are now very cheap and easy to deploy
and utilize. The proposed measurement system consists of object detection on the stereo
images and blob extraction and distance and size calculation and object identification.

2.7. Detection and Tracking System of Moving Objects Based on MATLAB [7]

In this thesis, video surveillance system with moving object detection and tracking
capabilities is presented. This thesis is committed to the problems of defining and
4

developing the basic building blocks of video surveillance system. The video surveillance
system requires fast, reliable and robust algorithms for moving object detection and
tracking. The system can process both color and gray images from a stationary camera. It
can handle object detection in indoor or outdoor environment and under changing
illumination conditions. This paper presents detection and tracking system of moving
objects based on MATLAB. It is described for segmenting moving objects from the scene.

2.8 Interfacing of MATLAB with Arduino for Object Detection Algorithm


Implementation using Serial Communication [8]

This paper explains proposed algorithm for object detection using image processing and
manipulation of the output pin state of Arduino board with ATmega 8 controller by
tracking the motion of the detected object. The object detection algorithm has been
developed on MATLAB platform by the combination of several image processing
algorithms. Using the theory of Image Acquisition and Fundamentals of Digital Image
Processing, the object has been detected in real time. Various features of an object such as
the shape, size and color can be used to detect and track the object. The variation in vertical
and horizontal axis of detected object is moderated by serial communication port and using
serial data communication, the state of Arduino board pin has been controlled. MATLAB
programming develops a computer vision system in the real time for object detection and
tracking using camera as an image acquisition hardware. Arduino programming provides
an interfacing of a hardware prototype with control signals generated by real time object
detection and tracking.

2.9. Robotic Toolbox for MATLAB release 9 [9]

The Toolbox has always provided many functions that are useful for the study and
simulation of classical arm-type robotics, for example such things as kinematics, dynamics,
and trajectory generation. The Toolbox is based on a very general method of representing
the kinematics and dynamics of serial link manipulators. These parameters are
encapsulated in MATLAB objects — robot objects can be created by the user for any serial-
link manipulator. The Toolbox also provides functions for manipulating and converting
between datatypes such as vectors, homogeneous transformations and unit-quaternions
which are necessary to represent 3-dimensional position and orientation.
5

2.10. Inverse kinematics for underactuated robots [10]

This document describes how to determine inverse kinematics for such a robot using the
Robotics Toolbox for MATLAB. Under actuation complicates the process of finding an
inverse kinematic solution, and it frustrates those who are new to robotics. For a robot with
6 joints it’s quite straightforward, but under actuation requires some careful thought about
the problem that needed to solve. It may consider the problem in two parts. First the
problem of moving the robot tool to a position. Second, moving the tool to a position and
tool orientation.
6

3. PROJECT OBJECTIVE

This robot is designed for collecting plastic bottles in high risk areas. All the movements of robot,
towards the plastic bottles are controlled by using a remote controller. And it initially planned to
move on a certain flat area without much obstacles. It contains a web camera and a Wi-Fi module.
This allows the robot to easily move to a certain location by remotely observing the vision of robot
through its web camera.

The communication between user and the robot is done by using Wi-Fi, which allows the operator
to easily command the robot within a higher range of distance. Although currently, the robot’s
navigation is done manually, the bottle collection part will be done by automatically. After a
command from user to collect the plastic bottles is given, the robot will manage the distance
between the object and itself automatically and it will collect the plastic bottles with its robot arm.

This robot is designed to collect about four bottles at a time and after collecting four bottles, it will
send a message to user that it has collected four bottles. Then, the robot will be navigated to a
certain unloading place by user. With the command of user, it will unload the collected plastic
bottles.

The controlling process of the robot is done by both Arduino and MATLAB software. Arduino is
for control all the inputs and outputs to the robot including actuators and MATLAB is for the
image processing part. Mainly the distance calculation between camera and the object is done by
MATLAB and the calculating the arrangements for robot arm components to reach the object is
done by the Robotic Toolbox of MATLAB.
7

4. METHODOLOGY

Start

Transmit visual output of


Webcam to the Operator

Observe the camera


output of Robot

Navigate the robot Determine the bottle using image


towards a plastic bottle processing techniques

Command robot to pick


Determine movements of robot arm
the bottle
(angles) using Robotic Toolbox

The robot arm picks the bottle and


place in the basket

NO YES
Number of collected
Return to the unloading position
bottles >=4

Figure 01: Flow Chart

I. Visual development

• Transmit visual output of webcam to the operator

• Observe the camera output of the robot

• Determine the bottle using image processing techniques

• Find the end effector coordinate

II. Navigation of the robot

• Navigate the robot towards to the bottle manually

• Use the phone application to move/navigate the robot


8

III. Robot arm

• The coordinate of the end effector sends to the robotic toolbox

• Using inverse kinematics of the robotic toolbox, find the angles of the every joint

• Send to the angle of the robot arm to the servo motors through Arduino board

IV. Bottle pick up and unload process

• Collect bottle of 125 mm × 45 mm size

• Collect up to four bottles in one cycle

• Unload the bottle suitable place

V. Troubleshooting

• Adjust the hardware parts of robot according to the requirements

• Develop the programming codes with testing


9

5. RESULT

5.1 Platform

Battery

DC Motors

Figure 02: Initial design of the platform

Assembly of robot platform included,


• 360 mm × 180 mm acrylic two board
• 12 V, 80 RPM, and 6 kg.cm two DC gear motors
• 13 cm diameter four wheels
• Electronic devices used for controlling the platform
- Arduino Uno microcontroller
- Motor driver
- 12 V, 7A UPS battery
- Bluetooth module

DC
Bluetooth mot
Arduino Motor
Module
Driver
(HC-05) Uno
DC
mot

External

Figure 03: Initial Platform Control Diagram


10

In the beginning the platform control using only with Bluetooth. But after the improvement of
vision system between the bottle and platform distance will estimate by the matlab using webcam.
Then the platform move to the towards the bottle automatically for the collect the bottle from robot
arm. The robot arm have maximum and minimum length that it can move. So, it effect to the
distance between platform and bottle.

Figure 04: Final Output of Platform

DC
Bluetooth mot
Arduino Motor
Module
Driver
(HC-05) Uno
DC
mot

External MATLAB

Figure 05: Final Platform Control Diagram


11

5.1.1 Bluetooth Connection


The robot controller software is developed using Arduino microcontroller. It is used to control the
robot by navigation command as shown in Figure 17. Flowcharts of the robot controller software
are shown in Figure 18. The forward, right, backward, left, and stop buttons on android application
are used to be the forward, right, reverse, left, and stop command respectively. Code of the
platform controller attached to the Appendix 1.

Figure 06: Bluetooth Controller Android Phone Display

Figure 07: HC-05 Bluetooth Module


12

5.2 Object Distance Measurement Using a Single Camera

Image-based distance computation techniques have recently become an area of major research
interest in the fields of robotic and computer vision. Applying such superior techniques tackle
several other challenges like object detection, obstacle avoidance, and location finding.

Figure 08: Standard frame assignment

The object distance is defined as the distance of the desired object from the center of the lens. If
the desired object is not located on the optical axes, it is called oblique object distance. The image
distance is defined as the distance from the focused image to the center of the lens. The proposed
object distance measurement in this thesis is based on finding the closest point from the object to
the bottom-center of the camera’s field of view.

5.2.1 The Image Processing Algorithm


The major image processing algorithm in this section is classified into the following four parts:

• Background estimation
• Object tracking
• Feature analysis
• Depth estimating

This algorithm starts with an input video source and separates the background from the object
using a thresholding technique. Then, the desired object is tracked frame by frame. The object’s
features are extracted after completion of the tracking process from the image. Finally, using the
analyzed feature, the object distance will be calculated.
13

The idea of segmentation is to simplify or divide an image into meaningful components. There are
many approaches to segmentation that is concerned with finding features in an image, such as
partitioning the image into homogenous regions (object or background). Where each pixel
classifies to either of the two regions, the resulting image is called a binary image. Pixels with a
gray level greater than one threshold are objects, and pixels with a gray level less than or equal to
the threshold are background. In cases where multiple objects with pixels above the threshold are
presented in an image, a unique label is assigned to each connected component.

Figure 09: RGB model of the image

Figure 10: Image obtained after threshold


14

The relationship between connected components is either 4-connectivity (blob) or 8 connectivity


(blob). In other words, a 4-connectivity component has four neighbors: above, below, right, and
left of the pixel. On the other hand, an 8-connectivity component has the above neighbors along
with those pixels that are diagonally adjacent.

Figure 10 shows an image of a sample threshold using the auto-threshold technique.


Morphological opening can remove small objects from an image while preserving the shape and
size of larger objects in the image.

5.2.2 MATLAB Function


w = imaqhwinfo;
[camera_name, camera_id, format] = getCameraInfo(w);

% Capture the video frames using the videoinput function


% You have to replace the resolution & your installed adaptor name.
vid = videoinput('winvideo’);

% Set the properties of the video object


set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;

%start the video acquisition here


start(vid)

% Set a loop that stop after 100 frames of acquisition


while(vid.FramesAcquired<=300)

% Get the snapshot of the current frame


data = getsnapshot(vid);

% Now to track red objects in real time


% we have to subtract the red component
% from the grayscale image to extract the red components in the image.
diff_im = imsubtract(data(:,:,1), rgb2gray(data));
%Use a median filter to filter out noise
diff_im = medfilt2(diff_im, [3 3]);
% Convert the resulting grayscale image into a binary image.
diff_im = im2bw(diff_im,0.18);

% Remove all those pixels less than 300px


diff_im = bwareaopen(diff_im,400);

% Label all the connected components in the image.


bw = bwlabel(diff_im, 4);
% Here we do the image blob analysis.
% We get a set of properties for each labeled region.
stats = regionprops((bw), 'BoundingBox', 'Centroid');

% Display the image


imshow(data)
15

hold on

%This is a loop to bound the red objects in a rectangular box.


for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), '-m+')
a=text(bc(1),bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ',...
num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12,...
'Color', 'yellow');
end

hold off
end

Figure 11: Final Output from of the matlab function

5.3 MATLAB Robotics Toolbox

The Toolbox has always provided many functions that are useful for the study and simulation of
classical arm-type robotics, for example such things as kinematics, dynamics, and trajectory
generation.

The toolbox contains functions and classes to represent orientation and pose in 2D and 3D (SO(2),
SE(2), SO(3), SE(3)) as matrices, quaternions, twists, triple angles, and matrix exponentials. The
Toolbox also provides functions for manipulating and converting between datatypes such as
vectors, homogeneous transformations and unit-quaternions which are necessary to represent 3-
dimensional position and orientation.
16

The Toolbox uses a very general method of representing the kinematics and dynamics of serial-
link manipulators as MATLAB objects – robot objects can be created by the user for any serial-
link manipulator and a number of examples are provided for well-known robots from Kinova,
Universal Robotics, Rethink as well as classical robots such as the Puma 560 and the Stanford
arm.

Figure 12: Robotic Toolbox Interface

Advantages of the Toolbox are that:

• the code is mature and provides a point of comparison for other implementations of the
same algorithms;
• the routines are generally written in a straightforward manner which allows for easy
understanding, perhaps at the expense of computational efficiency. If you feel strongly
about computational efficiency then you can always rewrite the function to be more
efficient, compile the M-file using the MATLAB compiler, or create a MEX version;
• since source code is available there is a benefit for understanding and teaching.

5.3.1 Create the Robot Arm in MATLAB


1. Take the value of X and Y in the vision system given: (This is the end effector position)
Pos_X = round(bc(1)); % value of X in the vision output
Pos_Y = round(bc(2)); % value of Y in the vision output
Pos_Z = -60; % Constant value

2.Create all links length (length between two servos):


L_1 = 10;
L_2 = 150;
L_3 = 150;

3. Define DH (Denavit–Hartenberg) table, links using link command:


L(1) = Link([0 L_1 0 -pi/2]);
L(2) = Link([0 0 L_2 0]);
L(3) = Link([0 0 L_3 pi/2]);
17

Eg: Li = Link( [ theta(𝜃) d a alpha(𝛼) ] )


𝜃 : angle berween axes 𝑥𝑖−1 and 𝑥𝑖 about axis 𝑧𝑖−1
d : distance from 𝑜𝑖−1 to the intersection of 𝑥𝑖 and 𝑧𝑖−1 measured along 𝑧𝑖−1 axis
a : distance between axes 𝑧𝑖−1 and 𝑧𝑖 measured along axis 𝑥𝑖
𝛼 : angle between axes 𝑧𝑖−1 and 𝑧𝑖 measured about 𝑥𝑖

4. Define Robot using SerialLink command. Its arrange the all values of the DH table:
Robot = SerialLink(L, 'name', 'LAB_1');

Table 01: DH Table

5. Define end-effector position, create translation matrix for the position and add to robot using
tool command:
T = transl([Pos_X Pos_Y Pos_Z]);

6. Define Base of the robot, create translation matrix for the position and add to robot using base
command:
base = [0 0 0];

7. Create every joints angle using Inverse Kinematics:


q = Robot.ikine(T, base,'mask',[1 1 1 0 0 0]) ;

8. Take the joints angles form generate in Inverse Kinematics:


Theta_1 = q (1);
Theta_2 = q (2);
Theta_3 = q (3);

9. Plot the robotic arm position in graphically:


Robot.plot(q * pi/180);

Figure 13: Robotic Arm Position in graphically


18

5.4 Robotic Arm

In forward kinematics, the end-effector position and orientation is determined from the given set
of joint angles whereas in inverse kinematics, the vice versa is done. In robotic applications,
motion of end-effector is given in Cartesian coordinates. However, the motion of the robotic arm
is specified in terms of the joint angles, because the dynamics of the manipulator is described in
terms of these joint parameter.

The robotic arm design is influenced by many variables such as geometry of the manipulator,
dynamics involved, the structural characteristics of the linkage system (manipulator) and the
actuator characteristics. The robotic arm resembles a human arm. The stationary part of the robot
to which all other parts are attached is called its base. The links are designed to be slender members
to reduce its weight which is crucial in reducing the power consumption during its operation. The
joints are simple revolute. The hand of robot carries end-effector, might be any tool or gripping
mechanism. The design of end effector is crucial to the satisfactory performance of the robotic
arm and hence its design is dependent on the shape, size and weight of the object to be gripped.

The robotic arm joint angle generates by Robotic Toolbox send to the arm using Arduino
Mega2560 board. According to the angles, the arm will move to the position. The code for the
MATLAB data output to the servo motors through Arduino attached to the Appendix 2.

Gripper

Elbow

Shoulde
r

Base
Figure 14: Robotic Arm
19

Figure 15: Matlab Output through Arduino

5.5 Unloading

The robot has bucket, it will keep the bottle when the arm pick. If the bucket four bottle, the robot
moves to the unload position and unload the bottle. For that used one servo motor to unload the
bottle and Arduino Mega2560 board to control the servo motor. The Arduino code attached to the
Appendix 3.

Figure 16: Loading and Unloading Bucket


20

6. DIFFICULTIES

• Quality of the camera

Due to the available resources, the webcam is used low quality. It should be effect to the
detect the red color in increasing distance between robot and the bottle. As well as it given
wrong distance between robot and the bottle.

• Connection between MATLAB and Arduino

Arduino haven’t capability to store the matlab code without connection. So, whole time
arduino have to connect to the matlab to run matlab program and take the output through
arduino.

• Quality of Motors

The servo motors had power quality, because if that motors used in several time, it have a
more probability to damage the motor. Then, the servo motors were not work its accurate
range of degree.

The DC motors havn’t same quality and features, then motor to motor rotating movement
may be changed. It will effect to the platform movement.

• Weight of the robot arm


The servo motors of the robot arm had some weight and the weight of the assembly parts
of the robot also had some considerable weight. Therefore, it will effect to the end effector
postion movement. That load of the end parts will create more torque in the base and
sholder motors, it may effect to the servo motors damage.
21

7. SUGGESTIONS AND FUTURE WORKS

• Improve the vision of the robot to detect all the colours of bottles

✓ Identify the any color of bottle


✓ Find the bottle in every location such as grass, sand, mud, road...etc.
✓ Improve the system identify the other waste

• Improve the accuracy of distance between robot and bottle

✓ Range between 1 – 3 cm
✓ Improve the bottle to robot distance range using quality camera

• Expand the capability of robot to collect variety of waste

• Select a better microcontroller than Arduino to omit the wired connection and improve the
process of the robot

• Automate the robot to use around the university to collect waste without operator.

✓ Develop the program


✓ Fix the quality equipment
✓ Design the robot compatible way collect more waste
22

CONCLUSION

This project aims to develop the robot for collecting the plastic bottles at high risk areas such as
building construction sites and highway roads by incorporating navigation and sensing, and the
cooperation between human and robot using the wireless communication (Bluetooth HC-05).
Arduino Uno was used as the brain for processing all commands. So far, we developed the robot
that can move on the flat surface and incline flat surfaces via Bluetooth communication. We
developed the control process of this robot by using Arduino and MATLAB. However, this robot
still needs to be improved to operate automatically and control from further distance.
23

REFERENCE

[1] B. Wirsing, “Sending and Receiving Data via Bluetooth with an Android Device,” IEEE
Electron., p. 23, 2014.

[2] R. Piyare and M. Tazil, “Bluetooth based home automation system using cell phone,”
2011 IEEE 15th Int. Symp. Consum. Electron., pp. 192–195, 2011.

[3] P. Alizadeh, “Object Distance Measurement Using a Single Camera for Robotic
Applications by Peyman Alizadeh A thesis Submitted in partial fulfillment of the
requirements for the degree of Master of Applied Sciences ( M A Sc ) in Natural
Resources Engineering The Facult,” Object Distance Meas. Using a Single Camera
Robot. Appl., p. 126, 2015.

[4] H. Nanduri and M. Soni, “ VISION CONTROLLED PICK AND PLACE OF MOVING
OBJECT BY 3R ROBOT ,” no. 4, pp. 352–358, 2016.

[5] T. Heimonen, J. Hannuksela, J. Heikkilä, J. Leinonen, and M. Manninen, “Experiments in


3D Measurements by Using Single Camera and Accurate Motion The Unit of Technical
Education Kemi-Tornio Polytechnic * Department of Electrical Engineering University of
Oulu,” IEEE, pp. 3–8, 2003.

[6] Y. M. Mustafah, R. Noor, H. Hasbi, and A. W. Azma, “Stereo vision images processing
for real-time object distance and size measurements,” 2012 Int. Conf. Comput. Commun.
Eng. ICCCE 2012, no. July, pp. 659–663, 2012.

[7] H. M. Hussien, “Detection and Tracking System of Moving Objects Based on


MATLAB,” Int. J. Adv. Robot. Syst., vol. 3, no. 10, pp. 797–805, 2014.

[8] P. Shah and T. Vyas, “Interfacing of MATLAB with Arduino for Object Detection
Algorithm Implementation using Serial Communication,” Int. J. Adv. Robot. Syst., vol. 3,
no. 10, pp. 1067–1071, 2014.

[9] P. Corke, “Robotics Toolbox for MATLAB - Release 9,”


http://petercorke.com/wordpress/toolboxes/robotics-toolbox, p. 132, 2011.

[10] P. Corke, “4 is harder than 6 : Inverse kinematics for underactuated robots,” Int. J. Adv.
Robot. Syst., no. February, pp. 1–6, 2014.
24

APPENDIX 1

//int angle = 0;

int motorPin1 = 11;

int motorPin2 = 8;

int motorPin3 = 13;

int motorPin4 = 12;

int LD = 9;

int RD = 10;

int G = 2;

int state;

int flag=0; //makes sure that the serial only prints once the state

int trigger = 4;

int echo = 5;

float time=0, distance=0;

void setup () {

// sets the pins as outputs:

pinMode(motorPin1, OUTPUT);

pinMode(motorPin2, OUTPUT);

pinMode(motorPin3, OUTPUT);

pinMode(motorPin4, OUTPUT);

pinMode(LD, OUTPUT);

pinMode(RD, OUTPUT);

pinMode(G, OUTPUT);

Serial.begin(9600); }
25

void loop() {

//if some date is sent, reads it and saves in state

if(Serial.available() > 0){

state = Serial.read();

flag=0;

// if the state is '0' the DC motor will turn off

if (state == '0') {

digitalWrite(motorPin1, LOW); // set pin 2 on L293D low

digitalWrite(motorPin2, LOW); // set pin 7 on L293D low

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

if(flag == 0){

Serial.println("Motor: off");

flag=1;

// if the state is '1' the motor will turn right

else if (state == '1') {

digitalWrite(motorPin1, LOW); // set pin 2 on L293D low

digitalWrite(motorPin2, HIGH); // set pin 7 on L293D high

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

analogWrite(LD, 60);

analogWrite(RD, 45);
26

if(flag == 0){

Serial.println("Motor: right");

flag=1;

// if the state is '2' the motor will turn left

else if (state == '2') {

digitalWrite(motorPin1, HIGH); // set pin 2 on L293D high

digitalWrite(motorPin2, LOW); // set pin 7 on L293D low

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

analogWrite(RD, 60);

analogWrite(LD, 45);

if(flag == 0){

Serial.println("Motor: left");

flag=1;

// if the state is '3' the motor will go backward

else if (state == '3'){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

analogWrite(LD, 150);
27

analogWrite(RD, 150);

if (flag == 0){

Serial.println("Motor: backward");

flag=1;

//if the state is '4' the motor will go forward

else if (state == '4'){

digitalWrite(motorPin1, HIGH);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, HIGH);

digitalWrite(motorPin4, LOW);

analogWrite(LD, 150);

analogWrite(RD, 150);

if (flag == 0){

Serial.println("Motor: forward");

flag=1;

else if (state == '5'){

digitalWrite(G, LOW);

if (flag ==0){

Serial.println("H");

flag=1;

}
28

else if (state == '6'){

digitalWrite(G, HIGH);

if (flag ==0){

Serial.println("L");

flag=1;

else if (state == '7'){

pinMode(trigger,OUTPUT);

digitalWrite(trigger,LOW);

delayMicroseconds(2);

digitalWrite(trigger,HIGH);

delayMicroseconds(10);

digitalWrite(trigger,LOW);

delayMicroseconds(2);

pinMode(echo,INPUT);

time=pulseIn(echo,HIGH);

distance=time*34/2000;

if ( distance >= 15){

digitalWrite(motorPin1, HIGH);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, HIGH);
29

digitalWrite(motorPin4, LOW);

analogWrite(LD, 80);

analogWrite(RD, 80);

else if (distance <= 15){

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

Serial.print(distance);

Serial.print("cm");

Serial.println();

if (flag ==0){

Serial.println("Distance");

flag=1;

}
30

APPENDIX 2

function [] = Angles()

Theta=InverseKinematic;
Theta_1=(Theta(1)+180)/360;
Theta_2=(Theta(2)+180)/360;
Theta_3=(Theta(3)+180)/360;

a=arduino('COM3','Mega2560');
s1=servo(a,'D6'); %servo1 for base
s2=servo(a,'D9'); %servo2 for shoulder
s3=servo(a,'D10'); %servo 3 for elbow
s4=servo(a,'D11'); %servo 4 for gripper
writePosition(s1,0.5);
pause(2);
writePosition(s3,0.5);
pause(2);
writePosition(s2,0.5);
pause(2);
writePosition(s4,0.15);
pause(2);

writePosition(s1,Theta_1);
current_pos1 = readPosition(s1);
current_pos1 = current_pos1*180;
fprintf('Current motor position_1 is %d degrees\n', current_pos1);
pause(2);

writePosition(s2,Theta_2);
current_pos2 = readPosition(s2);
current_pos2 = current_pos2*180;
fprintf('Current motor position_2 is %d degrees\n', current_pos2);
pause(2);

writePosition(s3,Theta_3);
current_pos3 = readPosition(s3);
current_pos3 = current_pos3*180;
fprintf('Current motor position_3 is %d degrees\n', current_pos3);
pause(2);

writePosition(s4,0.25);
current_pos4 = readPosition(s4);
current_pos4 = current_pos4*180;
fprintf('Current motor position_4 is %d degrees\n', current_pos4);
pause(2);

if (current_pos4 <= 45)


writePosition(s1,0.5);
pause(2);
writePosition(s2,0);
pause(5);
writePosition(s3,0.3);
pause(5);
writePosition(s4,0.2);
current_pos4 = readPosition(s4);
current_pos4 = current_pos4*180;
fprintf('Current motor position_4 is %d degrees\n', current_pos4);
31

pause(2);
end

if(current_pos4 <= 36)


writePosition(s1,0.5);
pause(2);
writePosition(s2,0);
pause(2);
writePosition(s3,0.2);
pause(2);
writePosition(s4,0.2);
pause(2);
end
32

APPENDIX 3

#include <Servo.h>

Servo servo_test;

const int buttonPin = 2; // the number of the pushbutton pin

const int ledPin = 13; // the number of the LED pin

int buttonState = 0; // variable for reading the pushbutton status

void setup() {

// initialize the LED pin as an output:

pinMode(ledPin, OUTPUT);

// initialize the pushbutton pin as an input:

pinMode(buttonPin, INPUT);

servo_test.attach(9);

void loop() {

// read the state of the pushbutton value:

buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.

// if it is, the buttonState is HIGH:

if (buttonState == HIGH) {

digitalWrite(ledPin, HIGH);

for(int angle = 0; angle < 80; angle += 1) // command to move from 0 degrees to 180 degrees

{ servo_test.write(angle); //command to rotate the servo to the specified angle

delay(40);

} delay(2000);
33

for(int angle = 80; angle>=1; angle-=1) // command to move from 180 degrees to 0 degrees

{ servo_test.write(angle); //command to rotate the servo to the specified angle

delay(50);

You might also like