15
Final Year Project Report SELF ERECTED INVERTED PENDULUM B.S. Electronic Engineering, Batch 2008 Internal Advisor Mr. Sajid Khan Assistant Professor Electronics Engineering Dept. SSUET, KARACHI Submitted by: Imran Saeed Khan 2008-EE-289 Muhammad Shahid 2008-EE-265 Talha Ahmed Khan 2008-EE-266 Munam Ahmed 2008-EE-462 DEPARTMENT OF ELECTRONIC ENGINEERING i S E L F E R E C T E D I N V E R T E D P E N D U L U M

Abstract

Embed Size (px)

Citation preview

Page 1: Abstract

Final Year Project Report

SELF ERECTED INVERTED PENDULUM

B.S. Electronic Engineering, Batch 2008

Internal Advisor

Mr. Sajid Khan Assistant Professor Electronics Engineering Dept. SSUET, KARACHI

Submitted by:

Imran Saeed Khan 2008-EE-289Muhammad Shahid 2008-EE-265Talha Ahmed Khan 2008-EE-266Munam Ahmed 2008-EE-462

DEPARTMENT OF ELECTRONIC ENGINEERINGSir Syed University of Engineering & Technology

University Road, Karachi-75300

January, 2012

PREFACE

i

SE

LF

ER

EC

TE

D IN

VE

RT

ED

PE

ND

UL

UM

Page 2: Abstract

This document herein details our project. Like any technical text, it is written to be

simple yet inclusive of all essential details. The author of this report has taken great

care to ensure that the text presents itself adequately to all readers, either student or

instructor. Readers will find more emphasis been given to actual design decisions,

rather than their calculations or programming implementations because such

unnecessary details narrow down the scope of text to a selected few individuals.

This report is structured as to illustrate the phases of this project in separate detailed

chapters; a brief description of each chapter is given here under.

Chapter 1, Introduction: Establishes theoretical background and introduces reader

with fundamentals of the project.

Chapter 2, The Inverted Pendulum System: Explains overall working of the project,

physical structure and design criteria.

Chapter 3, PID: Details the working of PID as control algorithm.

Chapter 4, Motor Drive: Gives a detailed account of motor drive circuitry.

Chapter 5, GUI: Explores the control, monitor and debug facilities provided by state

of the art tools such as LabVIEW.

Chapter 6, Simulation, Testing and Tuning: SEIP system modeling in MATLAB

along with system tuning is discussed.

Chapter 7, Conclusion: Concludes the report by discussing final stage of project and

the amount of knowledge, both technical and executive gained through this venture.

Finally in appendix, Time and cost analysis is made and presented along with

reference and datasheets of major components used.

ii

Page 3: Abstract

iii

Page 4: Abstract

ACKNOWLEDGEMENT

With a deep sense of gratitude, we take this opportunity to express our most sincere

appreciation and thanks to our internal advisor, Assistant Professor Sajid Khan, for

his utmost support during our venture of Final Year Project. We also would like to

thank our co –advisor Assistant Lecturer Zain Anwar for his support.

We are indebted to the faculty of this university for their support in testing and

evaluation of our project. Finally, we are grateful for all the knowledge that our

teachers have shared with us during theses four years of study, which has greatly

helped us build a solid foundation in electronics.

iv

Page 5: Abstract

Sir Syed University Of Engineering & TechnologyUniversity Road, Karachi-75300, Pakistan.

Tel: 4988000-2, 4982393, 474583, Fax: (92-21) 4982393http://www.ssuet.edu.pk

The Faculty of Electronic Engineering

PROJECT APPROVAL

Project Title Self Erected Inverted Pendulum

Internal Advisor Sajid Khan

Academic Year 2008

Group Members:

Imran Saeed Khan 2008-EE-289Muhammad Shahid 2008-EE-265Talha Ahmed Khan 2008-EE-266Munam Ahmed 2008-EE-462

The Department of Electronic Engineering Sir Syed University of Engineering and

Technology has approved this Final Year Project. The Project is submitted in partial

fulfillment of the requirements for the degree of Bachelor of Science in Electronic

Engineering.

Approval Committee:

Mr. Sajid Khan Mr. Muhammad Sharif

Internal Advisor FYP Committee Incharge

Mr. Zain Anwar

Co-Advisor

January, 2012

v

Page 6: Abstract

ABSTRACT

Precise control of inherently unstable systems has always been a challenge for control

engineers; this motivated us to test our skills in control theory, to build a Control

System for an Inverted Pendulum which has always been a classic control problem.

Control algorithm that we chose for this purpose was PID, as it could easily be

implemented in a digital device and could easily control a nearly linear system like

Inverted Pendulum. Since we started this project from scratch, there were other

concerns like selecting an appropriate controller to implement PID into, designing the

bridge inverter and hardware model of the system. For these design decisions we

worked our way up as follows; Arduino Mega 2560, assisted MOSFET Bridge and

ball screw based cart pendulum actuating system. Like any efficient system, our

system required a robust GUI which could display our systems’ working parameters

in real time, thus assisting in tuning and debugging of the system, this need was

addressed by using industry standard LabVIEW as our project GUI.

Page 7: Abstract

TABLE OF CONTENTS

Chapter # 1 Introduction 1

1.1 Background 1

1.1.1 Control Systems 1

1.1.2 Digital Control 1

1.1.3 PID 2

1.2 The Project 2

1.3 Conclusion 2

Chapter # 2 Overall System Explanation 3

2.1 System Block Diagram 3

2.2 Power Supply Unit 4

2.3 Discrete PID Board 4

2.3.1 PIC18F4520 μcontroller 4

2.3.2 HTCL-2022 Quadrature Decoder 6

2.3.3 IR2130 3 Phase Bridge Driver 7

2.4 MOSFET Bridge 7

2.5 Inverted Pendulum System 7

2.5.1 Electro Craft-Servo Craft 60volt DC Motor 8

2.5.2 Cart & Pendulum 9

2.5.3 Incremental Encoder 9

2.6 LabVIEW GUI 9

2.7 Mechanical Specifications 10

2.8 Conclusion 10

Chapter # 3 Discrete PID 11

Page 8: Abstract

3.1 Discrete Systems 11

3.1.1 DCS Analysis: Z-Transform 12

3.1.2 DCS Stability 12

3.2 PID 13

3.2.1 PID Terms 14

3.2.2 Implementation of PID in Digital System 14

3.3 PIC18F4520 Based PID Controller 15

3.3.1 PIC18F4520 at a Glance [8] 15

3.3.2 ECCP Module PWM Mode 16

3.3.3 PID as an Interrupt Routine 17

3.3.4 State Saturation 17

3.4 Conclusion 18

Chapter # 4 DC Motor Drives 19

4.1.1 Types of DC Drives 19

4.1.2 Motor Controller 19

4.2 Inverters 20

4.2.1 Types of Inverters 20

4.2.2 Half Bridge Inverter 20

4.2.3 Full Bridge Inverter 21

4.3 IR2130, High Frequency H-Bridge Driver 22

4.3.1 Description of IR2130 23

4.4 Conclusion 24

Chapter # 5 GUI 25

5.1 Introduction to LabVIEW 25

5.2 NI VISA 26

5.2.1 VISA Serial Interface 27

5.2.2 LabVIEW VISA Implementation 28

5.3 IP System GUI 28

Page 9: Abstract

5.3.1 Front Panel 28

5.3.2 Data Communication Protocol

5.4 Conclusion 30

Chapter # 6 Simulation & Debugging 31

6.1 Simulation of System 31

6.1.1 MATLAB 32

6.1.2 Simulation Results [5] 32

6.2 System Debug 34

6.2.1 In-Circuit Serial Programming™ (ICSP™) 35

6.2.2 PIC kitTM 2 35

6.2.3 MPLAB 36

6.3 PID Tuning 37

6.3.1 Ziegler–Nichols Method [6] 38

6.3.2 PID Tuning Software [6] 38

6.4 Conclusion 39

Chapter # 7 Conclusion 40

7.1 Limitations 40

7.1.1 Due to Mechanical Assembly 41

7.1.2 Due To Motor 41

7.1.3 Due to PID 41

7.2 Future Enhancements 41

Page 10: Abstract

LIST OF FIGURE

Figure 1.1 Control System 1

Figure 2.1 System block diagram 3

Figure 2.2 Reference Serial Comm. Implementation [2] 5

Figure 2.3 HTCL-2022 Interface to Controller [3] 6

Figure 2.4 Reference bridge implementation [4] 6

Figure 2.5 Reference Inverted Pendulum assembly 7

Figure 2.6 DC Motor 8

Figure 2.7 Three Channel Encoder module [3] 9

Figure 2.8 Mechanical specification 10

Figure 3.1 Discrete Control System [5] 11

Figure 3.2 Z-plane [5] 12

Figure 3.3 Block diagram of PID controller [7] 13

Figure 3.4 Comparing close loop response of PID [7] 14

Figure 3.5 Simplified PWM Block diagram [8] 16

Figure 4.1 A simple motor controller 20

Figure 4.2 Half Bridge Inverter 21

Figure 4.3 Full Bridge inverter 21

Figure 4.4 Full Bridge inverter Wave Diagram 22

Figure 4.6 IR2130 Block Diagram [4] 23

Figure 5.1 LabVIEW Logo 25

Figure 5.2 Block diagram and its corresponding front panel [10]

26

Figure 5.3 The hierarchy of NI-VISA 26

Figure 5.4 A simple VI depicting Serial read and Write 28

Figure 5.5 IP System Front Panel 28

Figure 6.1 ICSP Header 35

Figure 6.2 PICkitTM 2 Programmer/Debugger [12] 36

Figure 6.3 Programminng Header [12] 36

Page 11: Abstract

LIST OF TABLE

Table1.1 Comparison of digital and analog systems 2

Table 6.1 Effects of increasing parameters [5] 38

Table 6.2 Ziegler–Nichols method 38