You are on page 1of 11

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:

SELF ERECTED INVERTED PENDULUM

Imran Saeed Khan Muhammad Shahid Talha Ahmed Khan Munam Ahmed

2008-EE-289 2008-EE-265 2008-EE-266 2008-EE-462

DEPARTMENT OF ELECTRONIC ENGINEERING


Sir Syed University of Engineering & Technology
University Road, Karachi-75300

January, 2012

PREFACE

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.

ii

Finally in appendix, Time and cost analysis is made and presented along with reference and datasheets of major components used.

iii

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

Sir Syed University Of Engineering & Technology


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

The Faculty of Electronic Engineering PROJECT APPROVAL Project Title Internal Advisor Academic Year Group Members: Imran Saeed Khan Muhammad Shahid Talha Ahmed Khan Munam Ahmed 2008-EE-289 2008-EE-265 2008-EE-266 2008-EE-462 Self Erected Inverted Pendulum Sajid Khan 2008

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 Internal Advisor

Mr. Muhammad Sharif FYP Committee Incharge

Mr. Zain Anwar Co-Advisor January, 2012

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.

TABLE OF CONTENTS

Chapter # 1
1.1 Background 1.1.1 1.1.2 1.1.3 1.2 1.3

Introduction

1
1 1 1 2 2 2

Control Systems Digital Control PID

The Project Conclusion

Chapter # 2
2.1 2.2 2.3

Overall System Explanation

3
3 4 4 4 6 7 7 7 8 9 9 9 10 10

System Block Diagram Power Supply Unit Discrete PID Board 2.3.1 2.3.2 2.3.3 PIC18F4520 controller HTCL-2022 Quadrature Decoder IR2130 3 Phase Bridge Driver

2.4 2.5

MOSFET Bridge Inverted Pendulum System 2.5.1 2.5.2 2.5.3 Electro Craft-Servo Craft 60volt DC Motor Cart & Pendulum Incremental Encoder

2.6 2.7 2.8

LabVIEW GUI Mechanical Specifications Conclusion

Chapter # 3
3.1

Discrete PID

11
11

Discrete Systems

3.1.1 3.1.2 3.2 PID 3.2.1 3.2.2 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.4

DCS Analysis: Z-Transform DCS Stability PID Terms Implementation of PID in Digital System PIC18F4520 at a Glance [8] ECCP Module PWM Mode PID as an Interrupt Routine State Saturation

12 12 13 14 14 15 15 16 17 17 18

PIC18F4520 Based PID Controller

Conclusion

Chapter # 4
4.1.1 4.2

DC Motor Drives

19
19 19 20 20 20 21 22 23 24

Types of DC Drives 4.1.2 4.2.1 4.2.2 4.2.3 Motor Controller Types of Inverters Half Bridge Inverter Full Bridge Inverter Description of IR2130 Inverters

4.3 4.4

IR2130, High Frequency H-Bridge Driver 4.3.1 Conclusion

Chapter # 5
5.1 5.2

GUI

25
25 26 27 28 28 28

Introduction to LabVIEW NI VISA 5.2.1 5.2.2 VISA Serial Interface LabVIEW VISA Implementation Front Panel Data Communication Protocol

5.3

IP System GUI 5.3.1 5.3.2

5.4

Conclusion

30

Chapter # 6
6.1

Simulation & Debugging

31
31 32 32 34 35 35 36 37 38 38 39

Simulation of System 6.1.1 6.1.2 MATLAB Simulation Results [5] In-Circuit Serial Programming (ICSP) PIC kitTM 2 MPLAB ZieglerNichols Method [6] PID Tuning Software [6]

6.2

System Debug 6.2.1 6.2.2 6.2.3

6.3

PID Tuning 6.3.1 6.3.2

6.4

Conclusion

Chapter # 7
7.1 Limitations 7.1.1 7.1.2 7.1.3 7.2

Conclusion

40
40 41 41 41 41

Due to Mechanical Assembly Due To Motor Due to PID

Future Enhancements

LIST OF FIGURE

Figure 1.1 Figure 2.1 Figure 2.2 Figure 2.3 Figure 2.4 Figure 2.5 Figure 2.6 Figure 2.7 Figure 2.8 Figure 3.1 Figure 3.2 Figure 3.3 Figure 3.4 Figure 3.5 Figure 4.1 Figure 4.2 Figure 4.3 Figure 4.4 Figure 4.6 Figure 5.1 Figure 5.2 26 Figure 5.3 Figure 5.4 Figure 5.5 Figure 6.1 Figure 6.2 Figure 6.3

Control System System block diagram Reference Serial Comm. Implementation [2] HTCL-2022 Interface to Controller [3] Reference bridge implementation [4] Reference Inverted Pendulum assembly DC Motor Three Channel Encoder module [3] Mechanical specification Discrete Control System [5] Z-plane [5] Block diagram of PID controller [7] Comparing close loop response of PID [7] Simplified PWM Block diagram [8] A simple motor controller Half Bridge Inverter Full Bridge inverter Full Bridge inverter Wave Diagram IR2130 Block Diagram [4] LabVIEW Logo

1 3 5 6 6 7 8 9 10 11 12 13 14 16 20 21 21 22 23 25
[10]

Block diagram and its corresponding front panel The hierarchy of NI-VISA A simple VI depicting Serial read and Write IP System Front Panel ICSP Header PICkitTM 2 Programmer/Debugger [12] Programminng Header [12] 36

26 28 28 35 36

LIST OF TABLE

Table1.1 Table 6.1 Table 6.2

Comparison of digital and analog systems Effects of increasing parameters [5] ZieglerNichols method

2 38 38

You might also like