MUHAMMAD IRSHAD BIN SHAFFAR SAMAN
MOBILE ROBOTIC ARM WITH EMBEDDED PID SYSTEM
MUHAMMAD IRSHAD BIN SHAFFAR SAMAN
This report is submitted in partial fulfilment of the requirements
for the degree of Bachelor of Electronic Engineering with Honours
Faculty of Electronic and Computer Engineering
Universiti Teknikal Malaysia Melaka
Tajuk Projek : Mobile Robotic Arm With Embedded PID System Sesi Pengajian : 2017/2018
Saya MUHAMMAD IRSHAD BIN SHAFFAR SAMAN mengaku membenarkan laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:
1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja. 3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan
pertukaran antara institusi pengajian tinggi. 4. Sila tandakan ():
SULIT*
(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)
TERHAD* (Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di
mana penyelidikan dijalankan.
TIDAK TERHAD
Disahkan oleh:
(TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)
Alamat Tetap: 4 JALAN SAGA
24 TAMAN
SAGA AMPANG 68000
SELANGOR
Tarikh : 1 JUN 2018 Tarikh : 01 Januari 2010
*CATATAN: Jika laporan ini SULIT atau TERHAD, sila lampirkan surat daripada pihak berkuasa/organisasi berkenaan dengan menyatakan sekali tempoh laporan ini perlu dikelaskan sebagai SULIT atau TERHAD.
UNIVERSITI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN
DECLARATION
I declare that this report entitled “Mobile Robotic Arm with Embedded PID System”
is the result of my own work except for quotes as cited in the references.
Signature : ………
Author : Muhammad Irshad Bin Shaffar Saman
Date : 31 MAY 2018
APPROVAL
I hereby declare that I have read this thesis and in my opinion this thesis is sufficient
in terms of scope and quality for the award of Bachelor of Electronic Engineering
with Honours.
Signature : ………
Supervisor Name : Dr Khairuddin Bin Osman
DEDICATION
Special thanks to Allah, to my family, project supervisor, friends, and other staff in
ABSTRACT
In this century, Robot has been widely used especially in Industrial Area. Robot is
used in repetitive tasks where errors take account. Robot can be either controlled by
user or to perform autonomously. In this project, the mobile robot has a 5-DOF
robotic arm to perform the pick and place task. Besides that, the mobile robot has 4
wheels for mobility. The mobile robot is powered up by 2200mAH Li-PO Battery
which can last for an hour. Furthermore, it is built with an Arduino UNO and
controlled by Android Smartphone with an app called “JoyStick Controller”.
Bluetooth is used as a connection between the Arduino and Android Smartphone.
The User Interface of the application is designed in a way to allow the user to handle
the mobile robot easier. PID controller is used in this project to make the arm
ii
ABSTRAK
Pada abad ini, Robot telah digunakan secara meluas terutamanya di kawasan
perindustrian. Robot digunakan dalam tugas-tugas yang berulang-ulang di mana
setiap kesilapan diambil kira. Robot boleh digunakan sama ada dikawal oleh
pengguna atau digunakan secara automatik. Dalam projek ini, robot mudah alih
mempunyai 5-DOF lengan robot untuk melaksanakan tugas mengambil dan meletak.
Selain itu, robot mudah alih ini mempunyai 4 roda untuk bergerak. Robot mudah alih
ini dikuasakan oleh 2200mAh Bateri Li-PO yang boleh bertahan selama satu jam.
Tambahan pula, ia dibina dengan Arduino Uno sebagai mikropengawal dan dikawal
oleh telefon pintar Android dengan aplikasi yang dipanggil “JoyStick Controller”.
Bluetooth digunakan sebagai jaringan antara Arduino dan telefon pintar Android.
Aplikasi mesra pengguna telah direka sebagai satu cara bagi membolehkan
pengguna untuk mengendalikan robot mudah alih lebih mudah. Pengawal PID
digunakan dalam projek ini untuk menjadikan lengan bergerak lancar tanpa halangan
ACKNOWLEDGEMENTS
IN THE NAME OF ALLAH, THE MOST GRACIOUS, THE MOST MERCIFUL
I would like to have this opportunity to thanks my parents for supporting me with
mentality and financially.
Next, I would also like to express my deepest gratitude to my supervisor, Dr.
Khairuddin Bin Osman. He has guide me throughout the semesters by providing
advices, comments, encouragement, and ideas on my project whenever I felt lost. He
is one of my motivation for keep on continuing this project. Furthermore, he also
performs checking on the slide, draft report and were asked to demonstrate before
the actual presentation. He has dedicatedly aiding me throughout the project.
Lastly, I would like to thank my friends especially my course mates whenever I
was having trouble especially with the coding parts. They assist me and troubleshoot
iv
TABLE OF CONTENTS
Declaration i
Approval i
Dedication i
Abstract i
Abstrak ii
Acknowledgements iii
Table of Contents iv
List of Figures x
List of Tables xiv
List of Appendices xvii
INTRODUCTION 1
CHAPTER 1
1.1 Introduction 1
1.2 Objectives 2
1.4 Scope of work 3
1.5 Limitation of work 3
literature review 4
CHAPTER 2
2.1 Background 4
2.1.1 Review the existing robot 9
2.1.2 Comparison among the project 18
2.1.3 Verdict 20
2.2 Microcontroller 20
2.3 Arduino 21
2.3.1 Arduino Board 22
2.3.2 Digital I/Ps 23
2.3.3 Analog I/Ps 24
2.3.4 Arduino Architecture 24
2.4 Android 24
2.5 Android Studio 25
2.6 Robotic Arm 26
2.7 Servo Motor 27
2.8 PID Structure 28
2.9 PID Characteristic Parameters 30
vi
2.11 L293D DC Motor Driver Shield 37
2.12 Bluetooth 38
2.13 PCA 9865 41
2.13.1Configure PCA 9865 44
2.14 5A CV Step Down Module 45
2.15 Proteus Design Suite 46
2.16 Li-Po Battery 47
2.17 MATLAB 48
METHODOLOGY 49
CHAPTER 3
3.1 Overview 49
3.2 Project Planning 50
3.3 Overall Project Flowchart 50
3.4 Block Diagram 52
3.5 Flowchart of Mobile Robot 53
3.6 Flowchart of Robotic Arm 57
3.7 Coding for Arduino 61
3.7.1 Control the DC Motor 62
3.7.2 Calculation for the Servo Motor 63
3.7.3 Control the Robotic Arm 64
3.7.5 PID Control System Code 66
3.8 Choosing the Correct Control System 67
3.8.1 P Controller 67
3.8.2 P-I Controller 67
3.8.3 P-D Controller 68
3.8.4 P-I-D Controller 68
3.8.5 Loop Tune for PID Control System 71
3.9 Construction of the Chassis of Mobile Robot 73
3.10 Construction of the Robotic Arm 74
3.10.1Upper Arm Design 76
3.10.2End Effector Design 78
3.11 Hardware Wiring 84
3.12 Design Android Application 87
3.12.1Design Layout 87
3.12.2Java Coding 88
3.12.3Android Manifest 88
RESULTS AND DISCUSSION 91
CHAPTER 4
4.1 Overview 91
4.2 Structure of the Constructed Mobile Robot 91
viii
4.2.2 Construction of Mobile Robot 93
4.2.3 Dimension of the Mobile Robot 94
4.3 Development of the Application 95
4.4 Movement of Each Servo Motor 98
4.4.1 Robotic Arm Analysis 98
4.4.2 Mobile Robot Analysis 100
4.4.3 Analysis on the Speed of Mobile Robot 101
4.5 Analysis on the Gripper 103
4.6 Analysis on the Battery Lasting 103
4.7 The Ability of the Robotic Arm 104
4.8 Analysis on the PID Control System for Each Servo Motor 105
CONCLUSION AND FUTURE WORKS 114
CHAPTER 5
5.1 Conclusions 114
5.2 Recommendations 115
REFERENCES 117
APPENDICES 120
APPENDICES A: MICROCONTROLLER SOURCE CODE 120
APPENDICES B: CODING FOR JOYSTICK CONTROLLER APP 128
1 128
1.2 Joystickclass.java 137
1.3 DeviceList.java 140
1.4 main.xml 142
1.5 device_list.xml 149
1.6 AndroidManifest.xml 149
x
LIST OF FIGURES
Figure 2.1 Robot manipulator with joint and link 5
Figure 2.2 Structure of the robotic arm [1] 9
Figure 2.3 Robot with a gripper [3] 11
Figure 2.4 Hand Gesture [3] 11
Figure 2.5 Robot with Robotic Arm Lifting Object from Higher Place. 12
Figure 2.6 Arduino UNO 22
Figure 2.7 Arduino ATmega328P Board Architecture [10] 24
Figure 2.8 Typical PID control structure 29
Figure 2.9 PID parallel form structure 30
Figure 2.10 Standard for Proportional, Integral, and Derivative control 31
Figure 2.11 Graph when Kp is high 32
Figure 2.12 Graph when Kp is small 33
Figure 2.13 Graph for proportional-integral control 34
Figure 2.14 Graph for proportional-derivative control 35
Figure 2.15 Schematic Diagram of L293D Motor Shield 38
Figure 2.17 PCA 9685 41
Figure 2.18 Block Diagram of PCA 9685 [19] 42
Figure 2.19 Definition of START and STOP conditions [19] 43
Figure 2.20 When writing to the specific register [19] 44
Figure 2.21 How PWM control the LED to turn on and off 45
Figure 2.22 5A CV Step Down Module 45
Figure 2.23 Application Circuitry of XL4005 (24V ~ 5V/ 5A) [20] 46
Figure 2.24 Start Logo of Proteus Design Suite 47
Figure 2.25 Start Logo of MATLAB 48
Figure 3.1 General Flow Chart of the Project 51
Figure 3.2 Block Diagram of the Mobile Robot 52
Figure 3.3: Block Diagram of the Mobile Robot 52
Figure 3.4 8 Directional of the Joystick with Respective Direction 57
Figure 3.5 Flow Chart of Android Sends Value Based on the Respective Seek Bar 58
Figure 3.6 Flow Chart of the Arduino Receives Signal from Android and Control the
Respective Servo Motor. 59
Figure 3.7 The interface of seek bar for each part of Robotic Arm. 60
Figure 3.8 Flow Chart of controlling the mobile robot by Android 60
Figure 3.9 Declaration of the variable and include the source code from library. 61
Figure 3.10 Setting up the Startup of Arduino. 62
Figure 3.11 Execute the signal received. 63
Figure 3.12 Function used to find the pulse width for the servo motor 64
Figure 3.13 Control the rotate part of the Robotic Arm 65
xii
Figure 3.15 Coding for Arm Mode and Normal Mode 66
Figure 4.1 3D printer is fabricating the left gear 92
Figure 4.2 End-effector of the robotic arm 92
Figure 4.3 Mobile Robot was lifting the water bottle 93
Figure 4.4 Mobile Robot leans forward while lifting the water bottle 93
Figure 4.5 Mobile Robot in gripping position 94
Figure 4.6 Mobile Robot Lifting the Water Bottle with U-bracket metal supported
underneath. 94
Figure 4.7 Side View of Mobile Robot with Label and Dimension 95
Figure 4.8 Permission to turn on the Bluetooth 96
Figure 4.9 Device List 96
Figure 4.10 Control Interface for the Mobile Robot 97
Figure 4.11 Mobile Robot in Normal Position 98
Figure 4.12 Mobile Robot in Arm Position 98
Figure 4.13 Shows the direction used to determine the angle pointed by the servo
motor. 99
Figure 4.14 Analyze the angle for each parts of the robotic arm 99
Figure 4.15 The Height of the Mobile Robot and the End Effector when in Normal
Position 101
Figure 4.16 The Height of the Mobile Robot and the End Effector when in Arm
Position 101
Figure 4.17 The Highest Reaching Point of the End Effector when in Arm Position 101
Figure 4.18 Graph of Distance over Time or each Speed 102
Figure 4.19 The gripper is holding the test tube tightly 104
Figure 4.21 Graph that compares the step response with and without PID controller
for Servo Motor 1 106
Figure 4.22 Graph that compares the step response with and without PID controller
for Servo Motor 2 107
Figure 4.23 Graph that compares the step response with and without PID controller
for Servo Motor 3 109
Figure 4.24 Graph that compares the step response with and without PID controller
for Servo Motor 4 110
Figure 4.25 Graph that compares the step response with and without PID controller
xiv
LIST OF TABLES
Table 1 Features for each of the project 18
Table 2 Specification of Arduino UNO [9] 23
Table 3 Specification of Different Type of Servo Motor 28
Table 4 PID Characteristics Parameters 31
Table 5 Specification of Wireless Device 40
Table 6 Direction of DC Motor and Corresponding Direction of Movement when
Signal Received 54
Table 7 Signal Received by Each Part of Robotic Arm 58
Table 8 Input Signal and Pin attached for each part of Robotic Arm 65
Table 9 Information of Each Part of Base and Lower Arm 75
Table 10 Information of Each Part of Base and Lower Arm 77
Table 11 The analysis for each part of the robotic arm for the angle and total angle 100
Table 12 Analyze on the time taken for each speed to reach 200m 102
Table 13 The different load that can be lifted by the robotic arm. 103
Table 14 Current used by each part of Mobile Robot 104
LIST OF APPENDICES
A MICROCONTROLLER SOURCE CODE 120
B CODING FOR JOYSTICK CONTROLLER APPS 128
1
CHAPTER 1
INTRODUCTION
1.1 Introduction
Nowadays, Robots are significantly increase as robots being immersed into our
daily tasks, machines are replacing human especially in industrial sector whereas the
automation of process has increase the efficiency while decreasing time consume
and human energy. As the technologies getting move advance, the improvement of
technologies has inspired whole generation of engineer to push the barriers of
technology. The main challenge such as to develop a robotic arm to work the way
human arm does.
Human are restricted by physical and mentally limitation whereas robot are
inversible. They can work repetitively and way more effectively and efficiency
to do. Robot do not have soul, they are lifeless. They perform what they are
programmed to be and they can work 24/7. They can lift heavy weight and can
accurately perform the job with less errors. Robots are widely used in many fields of
application including office, industrial automation, military task, hospital operations,
security system, dangerous environment, and agriculture.
Generally, industrial robotic arm widely used for pick and place task where it is
programmed to execute the task to be fast and accurate. From SMT machine to
automation, it can work independently or cooperate with human force especially in
large scale or heavy weight which human unable to handle. This can greatly reduce
the risk factor as well as increase the efficiency of work done.
Furthermore, robots are deployed especially in hazardous situation as terrorist
bomb threat, land mine patrol and nuclear disaster. They often used to deal with
hazardous materials to enhance the human safety especially in hazardous
environment such as extremely hot or cold temperature, polluted air, and
radioactivity. Human is unable to endure these hazardous environments for a long
period.
1.2 Objectives
- To design a mobile robot with robotic arm
- To apply the embedded PID controller to mobile robot
3
1.3 Problem Statement
In the chemical manufacturing company, the sample must be occasionally
checked to secure it meets the standard requirement. These checking will be done by
the laboratory technician. Although human body can give off the chemicals from
human body by the help of the liver. However, when human is exposed to these
harmful substances for a periodical time, it will bad to health effects. This means the
laboratory technician will in risk of having cancerous cell when testing the sample
periodically.
1.4 Scope of work
- To determine the complexity and DOF level of the robotic arm
- To design a mobile robotic arm with 5 DOF
- To design a robotic arm using Embedded PID controlled system
1.5 Limitation of work
- Using Embedded PID controlled system
- Control the movement of the mobile robot by controller build using Android
Studio