Design of Robotic ARM Controller Using Matlab
Design of Robotic ARM Controller Using Matlab
This Report Is Submitted In Partial Fulfillment of Requirements For The Bachelor Degree of Electronic Engineering (Computer Engineering) with Honours
Fakulti Kejuruteraan Elektronik Dan Kejuruteraan Komputer Universiti Teknikal Malaysia Melaka
APRIL 2011
ii
: :
Saya
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut: 1. 2. 3. 4. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi pengajian tinggi. Sila tandakan ( ) :
*(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972) **(Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)
SULIT*
TERHAD**
TIDAK TERHAD
Disahkan oleh:
No. 44, Jalan Putri 7. Taman Putrimas, 86200 Simpang Renggam Johor
iii
I hereby declare that this report is the result of my own work except for quotes as cited in the references.
iv
I hereby declare that I have read this report and in my opinion this report is sufficient in terms of the scope and quality for the award of Bachelor Degree of Electronic Engineering (Computer Engineering) with Honours. Signature : .
Supervisor Name: En. Khairul Azha Bin A. Aziz Date : 3 MAY 2011
This project and research work is dedicated to my beloved parents for their devoted caring throughout my life, my loving brother and sisters also my friends for their encouragement and love.
vi
ACKNOWLEDGEMENT
First of all, I would like to express my sincere thanks and indebted to En Khairul Azha Bin A. Aziz as my supervisor, thank you very much for accept me as one of your PSM student and the collaborative leadership that you show will always I remembered. I also would like to thank to my PSM1 panel En. Ahmad Nizam and En. Muzaffar who gave me idea on my project. I would like to express my special thanks and a very down to earth and full with sense of humor-great experience to the Faculty of Electronic Engineering and Computer Engineering (FKEKK) on putting into practice the Final Year Project as a compulsory chore for the final year students prior to complete their course. I also wish to extend heartfelt thanks to my friends Farahiyah, Siti Aminah, Siti Dhamirah, Baira, Hajar, Fira, Basha and my entire classmate for your help and support during this three years in University Technical Malaysia Melaka. The memory we spent together will not I forget. Finally, I wish to thank to my lovely parents and my siblings, I love you so much and also to my lectures and friends for their encouragement, strength and support. Thank you.
vii
ABSTRACT
This project is about designing a robot arm control using MATLAB. It is designed to be used in the movement either to the left and right and is also used to lift an object using a robot arm is controlled using MATLAB. This project also uses a PIC 16F877A microcontroller circuit as the basic circuit. 3 servo motors will be used as an application extension to make movements and lifting an object. In this project, the PIC microcontroller to be programmed instructions to control the servo motor. This project uses MATLAB as a graphical user interface (GUI) for controlling the movement of this robot. The microcontroller software will be standardized to achieve the simulation is not always limited to the convergence between the tools used by the circuit. The project is also designed in such electronics industry and the manufacturing industry.
viii
ABSTRAK
Tugas projek ini adalah tentang rekabentuk kawalan lengan robot menggunakan Matlab. Ia adalah rekabentuk yang digunakan dalam melakukan gerakan sama ada ke kiri dan ke kanan dan juga digunakan untuk mengangkat sesuatu benda dengan menggunakan lengan robot yang dikawal dengan menggunakan MATLAB. Projek ini juga menggunakan litar mikropengawal PIC 16F877A sebagai litar asas. 3 motor servo akan digunakan sebagai aplikasi sambungan untuk membuat pergerakan dan juga mengangkat sesuatu benda. Di dalam projek ini, mikropengawal PIC akan diprogram kepada arahan untuk mengawal motor servo. Projek ini menggunakan perisian MATLAB sebagai Antaramuka Pengguna Grafik untuk mengawal pergerakan robot ini. Perisian yang diseragamkan dengan pengawalmikro ini akan sentiasa mencapai simulasi yang tiada terhad daripada percantuman antara alat yang digunakan dengan litar. Projek ini juga direka dalam industri contohnya industri elektronik dan juga industri pembuatan.
ix
TABLE OF CONTENTS
CONTENT
DECLARATION
SUPERVISOR DECLARATION
DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF APPENDIXES I INTRODUCTION 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 Robot Robot Arms Introduction of Project Objectives of Projects Problem Statements Scope of project
Thesis Organization
1 2 2 2 3 3 3 4
Methodology
5 5 6 7 9 9 11 11 13 14 16 17 18 18 19 20 20 21 21 22 23 25 25 26 28 28 28
2.4 2.5
RS232 Serial Port Servo Motor 2.5.1 2.5.2 2.5.3 Type of servo motor Advantages and disadvantages of servo motor and stepper motor The PWM Signal MATLAB General definition of GUI MATLAB GUI MATLAB GUIDE Two Basic in Process of implementing a GUI
2.6
2.6.6 Designing Graphical User Interfaces 2.6.7 2.6.8 2.7 2.7.1 2.7.2 2.7.3 2.7.4 How a Graphical User Interface Works Operation of GUI Introduction The PICmicros Command Line Options PICBASIC PRO Statement Reference 2.7.4.1 PULSIN
xi 2.7.4.2 2.7.4.3 II METHODOLOGY 3.1 3.2 3.4 Introduction Project Outline Review
Hardware Implement
PULSOUT PWM
29 30
31 31 32 34 34 35 38 39 39 40 41 43 44 47 48 50 50 50 51 51
Fabrication process for PIC microcontroller circuit 3.4.3.1 3.4.3.2 3.4.3.3 3.4.3.4 3.4.3.5 3.4.3.6 3.4.3.7 Design circuit using Proteus 7 Professional Ultra Violet light emission process Developing Process Etching Process The process of drilling holes in the PCB Installing Process the components on the PCB Soldering Process
3.4.4 RS232 Serial Communication 3.4.5 Power Supplies for Digital Circuits Review 3.4.6 Servos Review 3.4.6.1 3.5 Servo Connections Software Implementation 3.5.1 Overall Robot Arm programming
3.5.4 Build PIC Programming using PICBASIC PRO Compiler 3.5.4.1 3.5.4.2 IV PULSOUT Command FOR and NEXT
RESULT AND DISCUSSION 4.1 4.2 Introduction Introduction to PIC controller circuit 4.2.1 Programming Using PICBASIC PRO COMPILER 4.3 4.4 4.5 4.6 Experiment 1: Testing to determine the degree of servo motor Experiment 2: Testing using the serial port connected with the PIC and MATLAB Testing MATLAB to Robot Arm
Project Prototype Design
62 62 63 64 66 67 70 70 71 71 71 72 72
xiii V CONCLUSION AND RECOMMENDATION 5.1 5.2 5.3 Conclusion Problems Recommendation 5.3.1 5.3.2 Hardware Improvement Software Improvement 73 74 74 74 75
76 77 80
xiv
LIST OF TABLES
NO 2.1 2.2 2.3 2.4 2.5 3.1 3.2 3.3 4.1 4.2 4.3 4.4
TITLE RS232 pin assignments (DB9 PC signal set) Servo motor Stepper motor Some Basic GUI Components List of Options Pin connection of PIC16F877A for servo motor
Basic MATLAB GUI Component Kind of Callback
PAGE 12 16 17 24 28 36 56 58 65 66 66 66
Degree of analysis for each servo motor First analysis Second analysis Third analysis
xv
LIST OF FIGURES
NO 1.1 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 3.1 3.2 3.3 3.4 3.5 3.6
TITLE Flow chart for whole project Robotic arm Forward kinematics scheme Inverse kinematics scheme PIC Microcontroller PIC 16F877A Handshake looping a PC serial connector 20 The servo motor and servo motor connector Internal servo motor PWM wave at 50Hz MATLAB GUIDE layout of a wavelet analysis GUI (top) together with the completed interface (bottom). A Figure Window showing examples of MATLAB GUI elements Example for DEFINE coding Example for PULSOUT coding Flow chart for methodology IC LM7805 Schematic circuit of +5V power supply Power supply circuit design on protoboard Schematic circuit of PIC16F877A IC PIC 16F877A
PAGE 4 6 6 7 9 10 12 15 16 18 19 22 25 29 29 33 34 35 35 37 37
xvi 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 3.35 3.36 PIC Circuit in ISIS software PIC PCB Layout in ARES software Tools to make the process of UV UV radiation Developing process Drying process Automatically Etching Process Manually Etching Process Clean PCB process Examples of drill bit used for drilling holes Drilling machine PCBs are ready drilled Resistor Crystal Oscillator Capacitor LED PIC 16F877a LM7805 Tools used for soldering processes Soldered circuit completed NRZ (Non Return to Zero) format data 31 Connection between D9 Female serial port, MAX232 and PIC16F877A Connection between serial port and computer Servo motor connection Flowchart for robot arm programming Flowchart MATLAB programming
MATLAB GUIDE Layouts Property Inspector Example GUI Example M-files for GUI
38 39 39 40 41 41 41 42 43 43 43 44 44 45 45 46 46 46 47 47 49 48 48 50 52 53 54 55 57 57
xvii 3.37 3.38 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 Example pulsout program for servo motor Example For and Next program for servo motor
PCB layout for PIC circuit
60 61 63 67 67 67 68 68 69 69 70 70 71
Block diagram for testing robot arm using LCD Display LCD displayed terima = 10cm LCD displayed terima = 20cm MATLAB GUI have designed Program for MATLAB GUI Testing robot arm with MATLAB GUI Program for PIC control 3 servo motor Gripper for robot arm Frame for robot arm Prototype Robotic Arm
xviii
LIST OF ABBREVIATIONS
- Random Access Memory - Read-Only Memory - Programmable Read-Only Memory - Integrated Circuit - Input / Output - Programmable Interface Controller - Universal Serial Bus - PICBASIC PRO
xix
LIST OF APPENDIXES
NO A B
PAGE 77 80
CHAPTER I
INTRODUCTION
1.1
Robot Robots are indispensable in many factoring industries. The reason is that
the cost per hour to operate a robot is a fraction of the cost per hour to operate a robot is a fraction of the cost human labor needed to perform the same function. More than this, once programmed, robots repeatedly perform function with a high accuracy that surpasses that of the most experienced human operator. Human operators are, however, for more versatile. Humans can switch job tasks easily. Robots are built and programmed to be job specific. You wouldnt be able to program a welding robot to start counting parts in a bin [5]. Todays most advanced industrial robot will soon become dinosaurs. Robots are in the infancy stage of their evolution. As robots evolve, they will become more versatile, emulating the human capacity and ability to switch job tasks easily. While the personal computer has made an indelible mark on society, the personal robot hasnt made an appearance. Obviously theres more to a personal robot than a personal computer robots require a combination of elements to be effective: sophistication of intelligence, movement, mobility, navigation and purpose [5].
2 1.2 Robot Arms The simplest arm is the pick-and-place type. In this case the parts are moved from one location to another without caring how the part is picked up or down. However, these days robot arms are designed to manipulate objects having complicated shapes and fragile in nature. These may be used to assemble parts or fit them into clamps and fixture. This is possible due to high accuracy attainable in robots arm [1].
1.3
Introduction of Project This final project is about design robotic arm control using MATLAB. It is
the robot that will make movement and grip something then put to another place. The project focuses on programming that use to move the robotic arm. The objective of this project is developing a program that can control robotic arm using MATLAB. To make the movement for robotic arm, 3 servo motor is used as a joints. In this particular project, PIC microcontroller is programmed into the instructions to control the servo motor. This project used the MATLAB software to create the program of robotic arm. This software emulator of the microcontroller will always suffer limited simulation from the combination device interaction with the circuit.
1.4
Objectives of Projects PSM is a subject that require student to make their own project based on
what they learn. The main core of this project is to develop a program that can control robotic arm using MATLAB. The system will be developing using MATLAB and PIC based circuit. Other than that, we also able to program the movement of servo motor.
3 1.5 Problem Statements In the industry at this time were used for the robot arm as a tool to facilitate the work. There are many problems that arise in the existing robot arm: i. ii. Difficult to control and time consuming to control. Getting securities using MATLAB is very rarely used in industry as such a system will be developed using MATLAB to control the robotic arm.
1.6
Scope of project In order to achieve the objective of the project, there are several scope had
been outlined. The scope of this project includes using PICBASIC PRO programming to program microcontroller PIC16F877A, build PIC microcontroller circuit and robotic arm for the system, and interface the microcontroller to computer by using RS232 serial port communication. Servo motors are also used for robotic arm and control by MATLAB. MATLAB is used to control PIC microcontroller which is connected to robotic arm. Robotic arm movement can be done by moving to the left or right to take and put things in different places.
1.7
Thesis Organization
This thesis consists of five chapters including this chapter. The contents of each chapter are outlined as follows, Chapter 2 contains a detailed description each part of project. It will explain about the robot arm, PIC Microcontroller, servo motor, RS232 serial port, servo motor, PICBASIC PRO Compiler and MATLAB GUIDE. Chapter 3 includes the project methodology. This will explain how the project is organized and the flow of the process in completing this project. Chapter 4 presents the expected result of simulation runs using MATLAB GUIDE and the analysis of the project. Finally the conclusions for this project are presented in Chapter 5.
No
MATLAB programming writing and GUI for control Robotic rm Interfacing with computer and robotic arm
Test robotic arm using GUI MATLAB Yes Feedback from robotic arm
No
End
CHAPTER II
LITERATURE REVIEW
2.1
Introduction This chapter will describe about the knowledge of robotic arm or the
literature review which is as a reference before develop this project, literature is one of the important part need to be consider before develop new project because it can be a good reference which is give a lot of information, theories, design and idea about the project develops. Literature review can be an article, journal, statement, research and the previous thesis done by others. Below show a few literature review referred before develop this project.
2.2
Robotic Arm Reference is to build a robotic arm similar to this project. This robot
quite simply, a robot to lift objects. More specifically, this is a robot arm with shoulder, elbow and wrist joints.