BTP Sem2 Final

download BTP Sem2 Final

of 116

Transcript of BTP Sem2 Final

  • 8/2/2019 BTP Sem2 Final

    1/116

    i

    Project Code: D06

    CONTROL AND STABILITY OF AN INVERTED

    PENDULUM SYSTEM:

    STRATEGIES AND IMPLEMENTATION

    VYOM JAIN MUDIT GOEL VINAYAK SINGH

    2007ME10532 2007ME10508 2007ME10531

    Supervisor (s)

    Prof. S.P.Singh Prof. S.K.Saha

    Examiner

    Prof. K. Gupta

    Department of Mechanical Engineering

    IITD

  • 8/2/2019 BTP Sem2 Final

    2/116

    ii

  • 8/2/2019 BTP Sem2 Final

    3/116

    iii

    Certificate

    This is to certify that the project on Control and Stability of Inverted

    Pendulum is being pursued to my satisfaction and that the goals set upon at the

    outset of this endeavour have been worked upon to the best of the students

    abilities and resources.

    I hereby allow this project to be presented for evaluation and dissertation with

    full consent.

    Supervisors:

    Prof. S.K.Saha Prof. S.P.Singh

    Mechanical Engineering Department Mechanical Engineering Department

    Indian Institute of Technology, Delhi Indian Institute of Technology, Delhi

  • 8/2/2019 BTP Sem2 Final

    4/116

    iv

  • 8/2/2019 BTP Sem2 Final

    5/116

    v

    Acknowledgment

    We would like to express our sincere gratitude to Prof. S.P. Singh and Prof.

    S.K. Saha for giving us the opportunity to work under their supervision. Their

    never ending support, close supervision, monitoring and expedient tips helped

    us immensely in our work.

    We would also like to thank Mr. Madhu (Vibration Research Lab) and Mr.

    Jaitley (Mechatronics Lab) for extending their full support towards the

    realization of this project.

    We would also like to thank Mr. Arun, Ph.D student under Prof. S.K. Saha, for

    helping us throughout the semester regarding all the electronics-related issues.

    Also, we would like to thank Kamal Gupta and Sanjay Dhakar, members of the

    Robotics Club, IIT Delhi for helping us in the manufacturing of motor driver

    circuit.

    MUDIT GOEL VYOM JAIN VINAYAK SINGH

    2007ME10508 2007ME10532 2007ME10531

  • 8/2/2019 BTP Sem2 Final

    6/116

    vi

  • 8/2/2019 BTP Sem2 Final

    7/116

    vii

    Abstract

    The work seeks to implement a control strategy to carry out the self-balancing of an

    inverted pendulum mounted on a cart moving on a slider and powered by a DC motor. The

    project entails both simulation as well as manufacturing. A rig, details of which are

    mentioned later, was manufactured to carry out the implementation physically. Selection of

    various parts for the system has been done and the selected components have been mentioned

    appropriately. CAD models of the various parts manufactured were also developed.

    LABVIEW is used to simulate the control strategy. Finally, various control strategies have

    been implemented and studied on which included SISO control strategies to balance

    pendulum angle and cart position individually. Also cascaded PID logics to balance both cart

    position and pendulum angle simultaneously has been implemented.

    Keywords: Inverted pendulum, PID, Self-balancing, LABVIEW Simulation

  • 8/2/2019 BTP Sem2 Final

    8/116

    viii

    Contents

    Certificate ............................................................................................................................................... iii

    Acknowledgment .................................................................................................................................... v

    Abstract ................................................................................................................................................. vii

    List of Figures ......................................................................................................................................... ix

    List of Tables ......................................................................................................................................... xii

    Nomenclature ...................................................................................................................................... xiii

    Chapter 1. Introduction .................................................................................................................... 1

    Chapter 2. Literature Review and Objectives ................................................................................... 3

    Chapter 3. System Modelling ............................................................................................................ 6

    3.1 Analytical Modelling ............................................................................................................... 6

    3.2 Modelling in MATLAB ............................................................................................................ 15

    3.3 Modelling in LabVIEW ........................................................................................................... 18

    Chapter 4. Parts Selection and Procurement ................................................................................. 23

    4.1 Mechanism Comparison ....................................................................................................... 23

    4.2 Slider Mechanism .................................................................................................................. 23

    4.3 Motor Selection .................................................................................................................... 26

    4.4 Encoder Selection ................................................................................................................. 28

    4.5 Motor Driver ......................................................................................................................... 28

    4.6 Data Acquisition Card (DAQ) ................................................................................................. 29

    Chapter 5. Equipment Design and Fabrication ............................................................................... 31

    Chapter 6. Developing of Sensing and Actuation of system ........................................................... 43

    6.1 Encoder Interfacing ............................................................................................................... 43

    6.2 Motor Driver Fabrication ...................................................................................................... 45

    Chapter 7. Control Implementation ............................................................................................... 50

    7.1 SISO Control of Cart Position(x) ............................................................................................ 50

    7.2 SISO Control of Pendulum Angle(

    ) ...................................................................................... 57

    7.3 Cascaded PID logic to control Pendulum Angle and Cart Position ....................................... 65

    Chapter 8. Conclusions and Future Scope ...................................................................................... 80

    References ............................................................................................................................................ 82

    Appendix-A ............................................................................................................................................ 83

    Appendix B ............................................................................................................................................ 88

    Appendix C ............................................................................................................................................ 93

    Appendix D .......................................................................................................................................... 100

    Appendix E .......................................................................................................................................... 103

  • 8/2/2019 BTP Sem2 Final

    9/116

    ix

    List of Figures

    Figure 1.1: Schematic of an inverted pendulum ..................................................................................... 1

    Figure 2.1 Gantt Chart of Part 1 of the work .......................................................................................... 5

    Figure 2.2 Gantt Chart of Part2 of work ................................................................................................. 5

    Figure 3.1 FBD of the inverted pendulum setup ..................................................................................... 6

    Figure 3.2: DC Motor block diagram (Ogata[2008]) ............................................................................... 9

    Figure 3.3 Schematic for SISO theta control ......................................................................................... 13

    Figure 3.4 Schematic of cascaded PID logics for control ...................................................................... 14

    Figure 3.5 Schematic of Parallel PID logics for control ......................................................................... 15

    Figure 3.6 - Quadrant-wise division of pendulum angle ....................................................................... 16

    Figure 3.7 - Pendulum Angle with time ................................................................................................ 17

    Figure 3.8 - Cart Position with time ...................................................................................................... 17

    Figure 3.9 - Cart velocity with time ....................................................................................................... 18

    Figure 3.10: LabVIEW Code for simulation of control of cart position X of inverted pendulum .......... 19

    Figure 3.11: Front Panel of simulation for PID control of only cart position ........................................ 19

    Figure 3.12: Block Diagram of simulation for only angle theta control ................................................ 20

    Figure 3.13: Front Panel for only theta-control .................................................................................... 20

    Figure 3.14: Block Diagram for simulating cascading control of PID logics .......................................... 21

    Figure 3.15: Front Panel for simulating cascading of PID logics ........................................................... 22

    Figure 4.1 - Igus Toothed Belt Axis ........................................................................................................ 24

    Figure 4.2 - Dry LIne - Low Profile Linear Guide System NK-01/02-40 ................................................. 25

    Figure 4.3 - Dry Line - Low Profile Linear Guide Systen NK-02-80 ....................................................... 25Figure 4.4 - Moment rating of selected igus slider ............................................................................... 26

    Figure 4.5 - Characteristic curves of selected igus slider ...................................................................... 26

    Figure 4.6 - RoboKits Motor - selected motor ...................................................................................... 27

    Figure 4.7 - Incremental Encoder BI-52S-2500-PU ............................................................................... 28

    Figure 4.8 - Motor Driver (www.dimensionengineering.com) ............................................................. 29

    Figure 4.9 - DAQ NI-PC 6221 Port Drawing ........................................................................................... 30

    Figure 5.1 - Final CAD model ................................................................................................................. 31

    Figure 5.2 - Igus Slider ........................................................................................................................... 32

    Figure 5.3 - Cart along with the pendulum ........................................................................................... 32

    Figure 5.4 - Driving Mechanism ............................................................................................................ 33

    Figure 5.5 - Driven Mechanism Assembly ............................................................................................. 33

    Figure 5.6 - Stand on the ends of the slider .......................................................................................... 34

    Figure 5.7 - Middle Stand ...................................................................................................................... 34

    Figure 5.8 : Stands after TIG Welding ................................................................................................... 35

    Figure 5.9 : 5mm Aluminium plates ...................................................................................................... 35

    Figure 5.10 : Plates used to support the driving and the driven shaft assemblies ............................... 35

    Figure 5.11 : Timing belt 3.5m long and 10mm wide ........................................................................... 36

    Figure 5.12 : Profile of the timing pulleys ............................................................................................. 36

    Figure 5.13 : 8mm roller bearing .......................................................................................................... 36Figure 5.14 : Bearing with housing ....................................................................................................... 37

    http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499553http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499558http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499559http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499560http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499561http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499561http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499560http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499559http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499558http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499553
  • 8/2/2019 BTP Sem2 Final

    10/116

    x

    Figure 5.15 : Driving Motor with housing ............................................................................................. 37

    Figure 5.16 : Encoder along with housing ............................................................................................. 38

    Figure 5.17 ; Driving shaft assembly ..................................................................................................... 38

    Figure 5.18 : Driven shaft assembly ...................................................................................................... 39

    Figure 5.19 : Cart assembly ................................................................................................................... 39

    Figure 5.20 : Pendulum ......................................................................................................................... 40

    Figure 5.21 : Joint between cart and timing belt .................................................................................. 40

    Figure 5.22 : Joint between wooden block and stand .......................................................................... 41

    Figure 5.23 : Support for the slider ....................................................................................................... 41

    Figure 5.24(a) and (b) : Final setup of inverted pendulum ................................................................... 42

    Figure 6.1 : 2 output signals generated by incremental encoder(NI Developer Zone forum) ............. 43

    Figure 6.2 : Simplified Counter/Timer Model of DAQ........................................................................... 43

    Figure 6.3 : Layout of the connector block of NI-6221 ......................................................................... 44

    Figure 6.4 : Block diagram of the code to measure encoder's position ............................................... 44

    Figure 6.5: L7805 chip (http://www.mindkits.co.nz/store) .................................................................. 45Figure 6.6: picture showing pinouts of L7805 chip(http://www.mindkits.co.nz/store) ....................... 45

    Figure 6.7: ATmega16 chip (http://www.futurlec.com/Atmel/ATMEGA16.shtml) .............................. 46

    Figure 6.8: Pinouts of Atmega 16 (Appendix B) .................................................................................... 46

    Figure 6.9: Soldering in progress for Atmega 16 Base .......................................................................... 47

    Figure 6.10: Soldered Atmega 16 Base, crystal, ISP port and L7805 chip on matrix board .................. 47

    Figure 6.11: L298 chip (Appendix C) ..................................................................................................... 48

    Figure 6.12: Connections for L298N for driving DC motor (Appendix C) .............................................. 48

    Figure 6.13: Soldered L298 chip ............................................................................................................ 49

    Figure 6.14: Motor Driver card ............................................................................................................. 49

    Figure 7.1: Block Diagram for real time x-control ................................................................................. 51

    Figure 7.2 Simulation results for Kp=10, 25,50,100 .............................................................................. 52

    Figure 7.3 Real-time results for Kp=100, 150, 300, 500 ........................................................................ 53

    Figure 7.4 Simulation results for Ki=100,500,1000,5000 ...................................................................... 54

    Figure 7.5 Real-time results for Ki=3000, 30000, 60000, 80000 .......................................................... 55

    Figure 7.6 Simulation results for kd=0.001, 0.01, 0.1, 1 ....................................................................... 56

    Figure 7.7 Real-time results for Kd=0.003, Kd=0.3, kd=3 ...................................................................... 57

    Figure 7.8: Block Diagram for theta-control real-time implementation............................................... 58

    Figure 7.9 Simulation results for Kp=40, 75, 200, 500 .......................................................................... 59

    Figure 7.10 Real-time results for Kp=200, 450, 700.............................................................................. 60

    Figure 7.11 Simulation results for KI=0.005, 0.01, 0.05 ........................................................................ 61

    Figure 7.12 Real-time results for Ki=5, 10, 50, 100 ............................................................................... 62

    Figure 7.13 Simulation results for Kd=0.002, 0.02, 0.2 ......................................................................... 63

    Figure 7.14 Real-time results for Kd=0.35, 0.1, 1 .................................................................................. 64

    Figure 7.15: Block Diagram for real-time implementation fo cascading of PID logics ......................... 65

    Figure 7.16 Simulation results for Cart Position Gains Kp=0.25, Ki=0.001, kd=0.01(Cascaded PID) .... 66

    Figure 7.17 Simulation results for Cart Position Gains Kp=0.6, Ki=0.001, kd=0.01(Cascaded PID) ...... 66

    Figure 7.18 Simulation results for Cart Position Gains Kp=0.8, Ki=0.001, kd=0.01(Cascaded PID) ...... 66

    Figure 7.19 Real-time results for Cart Position Gains Kp=0.2, Ki=0, kd=0.001(Cascaded PID) ............. 67

    Figure 7.20 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.001(Cascaded PID) ........... 67Figure 7.21 Real-time results for Cart Position Gains Kp=0.7, Ki=0, kd=0.001(Cascaded PID) ............. 67

    http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499619http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499620http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499621http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499622http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499623http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499624http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499626http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499627http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499628http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499629http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499630http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499631http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499631http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499630http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499629http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499628http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499627http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499626http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499624http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499623http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499622http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499621http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499620http://e/Download/BTP/Sem2/MED412%20D06%20Mudit_Vyom_Vinayak%20Final%20report%20(Repaired)%20(Repaired).docx%23_Toc284499619
  • 8/2/2019 BTP Sem2 Final

    11/116

    xi

    Figure 7.22 Simulation results for Pendulum Angle Gains Kp=40, Ki=3000, kd=0(Cascaded PID) ....... 68

    Figure 7.23 Simulation results for Pendulum Angle Gains Kp=50, Ki=3000, kd=0(Cascaded PID) ...... 68

    Figure 7.24 Simulation results for Pendulum Angle Gains Kp=100, Ki=3000, kd=0(Cascaded PID) ..... 68

    Figure 7.25 Real-time results for Pendulum Angle Gains Kp=200, Ki=45, kd=0.45(Cascaded PID) ...... 69

    Figure 7.26 Real-time results for Pendulum Angle Gains Kp=450, Ki=45, kd=0.45(Cascaded PID) ...... 69

    Figure 7.27 Real-time results for Pendulum Angle Gains Kp=700, Ki=45, kd=0.45(Cascaded PID) ...... 69

    Figure 7.28 Simulation results for Cart Position Gains Kp=0.6, Ki=0.0001, kd=0.01(Cascaded PID) .... 70

    Figure 7.29 Simulation results for Cart Position Gains Kp=0.6, Ki=0.001, kd=0.01(Cascaded PID) ...... 70

    Figure 7.30 Simulation results for Cart Position Gains Kp=0.6, Ki=0.01, kd=0.01(Cascaded PID) ........ 70

    Figure 7.31 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.001(Cascaded PID) ........... 71

    Figure 7.32 Real-time results for Cart Position Gains Kp=0.45, Ki=0.1, kd=0.001(Cascaded PID) ........ 71

    Figure 7.33 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.001(Cascaded PID) ........... 71

    Figure 7.34 Simulation results for Pendulum Angle Gains Kp=50, Ki=1000, kd=0 (Cascaded PID)....... 72

    Figure 7.35 Simulation results for Pendulum Angle Gains Kp=50, Ki=3000, kd=0 (Cascaded PID)....... 72

    Figure 7.36 Simulation results for Pendulum Angle Gains Kp=50, Ki=3500, kd=0 (Cascaded PID)....... 72Figure 7.37 Real-time results for Pendulum Angle Gains Kp=450, Ki=10, kd=0.45 (Cascaded PID) ..... 73

    Figure 7.38 Real-time results for Pendulum Angle Gains Kp=450, Ki=45, kd=0.45 (Cascaded PID) ..... 73

    Figure 7.39 Real-time results for Pendulum Angle Gains Kp=450, Ki=70, kd=0.45 (Cascaded PID) ..... 73

    Figure 7.40 Simulation results for Cart Position Gains Kp=0.6,Ki=0.0005,kd=0.001 (Cascaded PID) ... 74

    Figure 7.41 Simulation results for Cart Position Gains Kp=0.6,Ki=0.0005,kd=0.01 (Cascaded PID) ..... 74

    Figure 7.42 Simulation results for Cart Position Gains Kp=0.6,Ki=0.0005,kd=0.015 (Cascaded PID) ... 74

    Figure 7.43 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.0005 (Cascaded PID) ........ 75

    Figure 7.44 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.001 (Cascaded PID) .......... 75

    Figure 7.45 Real-time results for Cart Position Gains Kp=0.45, Ki=0, kd=0.005 (Cascaded PID) .......... 75

    Figure 7.46 Simulation results for Pendulum Angle Gains Kp=50, Ki=3000,kd=0.01 (Cascaded PID) .. 76

    Figure 7.47 Simulation results for Pendulum Angle Gains Kp=50, Ki=3000, kd=0.1 (Cascaded PID).... 76

    Figure 7.48 Simulation results for Pendulum Angle Gains Kp=50, Ki=3000, kd=1 (Cascaded PID)....... 76

    Figure 7.49 Real-time results for Pendulum Angle Gains Kp=450, Ki=45, kd=0.1 (Cascaded PID) ....... 77

    Figure 7.50 Real-time results for Pendulum Angle Gains Kp=450, Ki=45, kd=0.45 (Cascaded PID) ..... 77

    Figure 7.51 Real-time results for Pendulum Angle Gains Kp=450, Ki=45, kd=0.7 (Cascaded PID) ....... 77

    Figure 7.52 Settling time variation with change in Kp values for cart position .................................... 78

    Figure 7.53 Settling time variations with change in Ki values for cart position .................................... 78

    Figure 7.54 Settling time variations with change in Kd values for cart position .................................. 78

    Figure 7.55 Settling time variations with change in Kp values for pendulum angle............................. 79

    Figure 7.56 Settling time variations with change in Ki values for pendulum angle .............................. 79

    Figure 7.57 Settling time variations with change in Kd values for pendulum angle............................. 79

  • 8/2/2019 BTP Sem2 Final

    12/116

    xii

    List of Tables

    Table 4.1 Table showing comparison of various mechanism considered ............................................ 23

    Table 4.2 Comparative Analysis of various sliders ................................................................................ 24

  • 8/2/2019 BTP Sem2 Final

    13/116

    xiii

    Nomenclature

    Symbol Meaning

    mc Mass of Cart

    mp Mass of pendulum

    Angle of pendulum from vertical

    F Force transferred from the motor to the cart

    mb Mass of bob Length of pendulum

    Inertia of cart and pendulum about pulley

    Inertia of pendulum about hinge point Acceleration due to gravity Total mass of cart, pendulum and bob Friction coefficient DC Motor Torque current constant DC motor armature inductance

    DC motor armature resistance

    Radius of pulley Cart positionN Reaction force between cart and pendulum in x-direction

    P Reaction force between cart and pendulum in y-direction

    Kb Motor Back Emf Constant

    Tm Torque applied by motor

  • 8/2/2019 BTP Sem2 Final

    14/116

    1

    Chapter 1. Introduction

    Inverted Pendulum designs are not based on obscure or abstract mechanics. The simple

    example of a walking man can be considered conceptually equivalent. The inverted

    pendulum problem is one of the most important problems in control theory and has been

    studied excessively in control literatures. It is well established benchmark problem that

    provides many challenging problems to control design. The system is nonlinear and unstable.

    Our project deals with the implementation of this idea to balance an inverted pendulum with

    respect to a reference (= 0).

    In simple understandable terms, it depends on the torque generated by a motor to counteract

    any perturbation in the natural inverted position of the pendulum in the non inertial reference

    frame of the cart the pendulum is attached to.

    According to control purposes of inverted pendulum, the control of inverted pendulum can be

    divided into two aspects. The first aspect is the swing-up control of inverted pendulum. The

    second aspect is the stabilization of the inverted pendulum. This project mainly focuses on

    stabilization of inverted pendulum. Various strategies to control inverted pendulum along

    with its base (cart) position are also discussed and implemented.

    The stroke length, RPM and torque requirements of the motor were determined using the

    cardinal values obtained rigorously (Lagrangian Modeling) and the assumed reasonable

    values of parameters like mass of the cart, mass of the pendulum etc.

    Figure 1.1: Schematic of an inverted pendulum

  • 8/2/2019 BTP Sem2 Final

    15/116

    2

    The other portion was the comparison of various designs to implement the idea of an inverted

    pendulum. A brief idea of the implementation is also presented to give a sense of the project.

    In nut shell, the design consists of a slider mechanism (ideally frictionless), a cart with the

    pendulum and an encoder mounted on it, a motor according to the torque and RPM

    requirements, a compatible motor driver card, bearings to support the rotating shafts, belt

    type mechanism to transfer the power of the motor, an encoder as the input to the control

    system and a PID controller.

    The applications of the model are aplenty. Any two wheeled drive like skate boards, the

    robot torsos, and even unicycles can incorporate this to achieve balancing in one plane.

  • 8/2/2019 BTP Sem2 Final

    16/116

    3

    Chapter 2. Literature Review and ObjectivesThe literature on control strategies for inverted pendulum can be roughly split into two parts:

    local control (i.e. in a region slightly displaced from the desired upright position) and global

    control (including swing up say from the bottom most position of the pendulum). While the

    local control is essentially linear, global control is grounded in the use of switching logics or

    advanced mathematical tools for linearization. The control itself can differ on the basis of the

    type of control strategy (PID, fuzzy logic etc) or the mode of implementation (type of

    software used, like MATLAB or LABVIEW). Finally, system itself can be different with

    respect to the number of pendulums, type of base used (rotary base, moving cart etc).

    The basic analytical modelling procedure of an Inverted Pendulum has been shown in

    Altas(2005). The Free Body equations of the system are linearized and their Laplace is taken.

    Then the author describes the derivation of the transfer function between pendulum angle and

    applied force and illustrates elementary state space modelling. Further, he applies basic

    Proportional-Integral-Derivative (PID) controller and studies the response by varying the

    constants in PID controller.

    Saha S.K. (2008) presents a detailed analysis of the Lagragian modelling and focuses on thetechniques for doing so.

    Craig(2007) talk about taking sensor inputs in LabVIEW and gives a walk through of the

    necessary steps to implements a basic controller.

    Dockhorn(2006) describes the steps from data acquisition, simulation of the system,

    development of the PID controller circuit, and implementation of the controller applied to a

    real system. One of the challenges in the case of cart type inverted pendulum is to prevent the

    cart from going off the tracks. This problem is dealt with by adding an offset to the angle

    measured. The offset is proportional to the distance of the cart from the centre. Thus cart is

    mostly around the centre of the rail.

    Ogata(2008) discusses the modelling parameters and modelling procedure for a DC motor.

    The relevant literature comprise of transfer function between torque and voltage. This

    transfer function is directly used (in this project) in conjunction with the plant (inverted

    pendulum) model and the overall transfer function has been developed.

  • 8/2/2019 BTP Sem2 Final

    17/116

    4

    Vizins(2010)examines various control strategies that can be adopted to control a two degree

    of freedom system by just one output. The first strategy is of modifying the effective set-point

    of pendulum angle and is similar to that discussed by Dockhorn(2006).The second strategy

    comprises of simultaneous control of cart position and pendulum angle by adding the

    individual control actions of each input variable, viz. Pendulum angle and cart position. So,

    the net control signal or the voltage sent to the motor is algebraic summation of two control

    signal.

    Lam(2004)describes swing up pendulum control. This paper describes two methods to swing

    a pendulum attached to a cart from an initial downwards position to an upright position and

    maintain that state. A nonlinear heuristic controller and an energy controller have been

    implemented in order to swing the pendulum to an upright position. After the pendulum is

    swung up, a linear controller has been implemented to maintain the balanced state. The

    heuristic controller outputs a repetitive signal at the appropriate moment and is finely tuned

    for the specific experimental setup. The energy controller adds an appropriate amount of

    energy into the pendulum system in order to achieve a desired energy state. The linear

    controller is a stabilizing controller based on a model linearized around the upright position

    and is effective when the cart-pendulum system is near the balanced state.

    Objectives of the Project

    In order to study the control logics on an inverted pendulum, it was essential to setup a basic

    test bench so that the control logics can be applied. The current work mainly focuses on the

    practical implementation of inverted pendulum using PID control. So, the objectives of the

    work have been defined as the following:-

    Simulation of the Inverted Pendulum Dynamics using MATLAB by doing ananalytical modeling of the system before

    Designing of the entire setup for implementation of Inverted Pendulum Control Fabricating the setup along with the electrical hardware to actuate the system Interfacing of the setup to the computer using NI-DAQ Card and LabVIEW Implementation of PID control in the form of a stabilized inverted pendulum design Simulating PID control of Inverted Pendulum in LabVIEW

  • 8/2/2019 BTP Sem2 Final

    18/116

    5

    Work Plan

    The figure 2.1 and 2.2 show the work methodology followed in the part 1 and part 2 of the

    project respectively.

    Figure 2.1 Gantt Chart of Part 1 of the work

    Figure 2.2 Gantt Chart of Part2 of work

    W1 W2 W3 W4 W1 W2 W3 W4 W5 W1 W2 W3 W4 W1 W2 W3

    Literature Review

    System Modeling

    Simulation on MATLAB

    Mechanism Options

    Market Survey

    Finalizing Mechanisms

    Electrical Components Study

    SelectionOrdering

    CAD

    Market Visit

    Manufacturing

    LABVIEW Study

    Simulation Techniques

    Report Making

    NOVEMBER

    GANTT CHART

    M

    i

    n

    or

    1

    M

    i

    n

    or

    -

    2

    M

    i

    d

    S

    e

    m

    B

    r

    e

    a

    k

    AUGUST SEPTEMBER OCTOBER

    W 1 W 2 W 3 W 4 W 1 W 2 W 3 W 4 W 2 W 3 W 4 W 1 W 2 W 3 W 4

    Learning LabVIEW

    Procurement of material

    Manufacturing

    DAQ Card Repair

    Encoder Testing

    Setting up of system in lab

    Motor Driver card manufacturing

    Testing of motor driver card

    Report Making

    Control Study

    Testing of motor

    Learning control on Labview

    Implementation of SISO control on pendulum angleImplementation of SISO control on cart position

    Implementation of MISO control

    PID Gains tuning

    Report Making

    S

    E

    M

    B

    RE

    A

    K

    M

    I

    N

    O

    R

    S

    M

    I

    N

    O

    Rs

    GANTT CHART

    JANUARY FEBRUARY MARCH APRIL

  • 8/2/2019 BTP Sem2 Final

    19/116

    6

    Chapter 3. System ModellingThe system was modelled and the results were simulated on several platforms. Before

    working on any platform, analytical modelling of the system which is done in Section 3.1.

    Analytical modelling helps in calculating all the transfer functions required which are then

    used to simulate the system on MATLAB and LabVIEW covered under Section 3.2 and

    Section 3.3respectively.

    3.1 Analytical Modelling

    Figure 3.1 FBD of the inverted pendulum setup(Altas[2005])

    Starting from basic Free Body Equations as described by Altas(2005), the cart position

    function and pendulum angle functions are derived. Figure 3.1 shows the FBD of the

    inverted pendulum system.

    Putting the values of constants as

    Mass of cart, = 620 Mass of pendulum, = 40 Mass of bob, = 135 Length of pendulum,

    = 325

  • 8/2/2019 BTP Sem2 Final

    20/116

    7

    Inertia of cart and pendulum about pulley, = 1.13 1032Inertia of pendulum about hinge point, = 4 1 03 2

    = 9.81

    /

    2

    = + mp + mb = 0.79 Frictional drag, = 1 /Motor Torque Constant, = 0.3 /Motor Back Emf Constant, = 0.3 /Motor Inductance,

    = 4

    Motor armature resistance, = 1.5 Radius of cart, = 0.0325Tm=Torque applied by motor

    F = Force applied by motor on cart

    V = Voltage supplied to motor

    P and N are the reaction forces between cart and pendulum in x and y directions respectively

    Free Body Equations:

    For cart:

    + = . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 1 ) + + = . . . . . . . . . . . . . . . . . . . . . . . . . . (3 .2)

    For pendulum:

    = + + + 2 cos + 2 2 sin . . . . . .(3 .3)For Pendulum: Force balance along the pendulum length:

    sin

    +

    cos

    +

    sin

    =

    + 2

    +

    +

    cos

    . . . .(3.4)

    For Pendulum: Force balance perpendicular to the pendulum length:

  • 8/2/2019 BTP Sem2 Final

    21/116

    8

    sin cos = . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 5 )Substituting N in equation 3.1

    + + 2 cos + + 2 2

    sin =

    . . .(3.6)[ + ( + 2)2] + ( + ) sin = + cos . . . . . . . . . . . . . ( 3 . 7 )

    On linearizing the above equation, we get

    [ + ( + 2)2] + ( + ) = ( + ) . . . . . . . . . . . . . . . . . . ( 3 . 8 ) [

    2

    + (

    +

    )]

    +

    + 2

    =

    . . . . . . . . . . .

    . . .(3.9)

    On solving for x by taking Laplace Transforms, we have:

    = [+ + 22 + 2 () . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 1 0 )On substituting the values in equation 3.10, we get

    =

    0.004 +

    0.04 + 0.27

    0.1625

    2

    0.04 + 0.1350.1625 10

    2

    (

    ) . . . . . . . . . . . . . . . . . . . . ( 3 . 1 1 )

    = 0.428 102 . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 1 2 )On substituting the values in equation 3.9, we get

    1.07 + 0.1752 + 0.052 = 1.245

    2 +

    0.05

    2 =

    . . . . . . . . . . . . . . . . .

    . . . . . . .(3 .13)

    On substituting for x from Equation 3.12, we get

    1.245 0.428 102 2 + 0.428 102 0.052 = . . . . . . . . . . . . . . . . . . . . ( 3 . 1 4 ) 0.5322 12.45 + 0.428 10 0.052 = . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 1 5 )

    0.4828

    3

    12.45

    10

    + 0.428

    2

    =

    . . . . . .

    . . . . . . . . . . . . . . . . . . ( 3 . 1 6 )

  • 8/2/2019 BTP Sem2 Final

    22/116

    9

    = 0.48283 + 0.4282 12.45 10 . . . . . . . . . . . . . . . . . . .(3.17)

    On substituting for from Equation 3.12, we get = 0.428 102 0.48283 + 0.4282 12.45 10 . . . . . . . . . . . . . . . ( 3 . 1 8 )

    = (0.4282 10)(0.4284 + 0.4283 12.452 10) . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 1 9 )

    Modelling of DC Motor

    Figure 3.2: DC Motor block diagram (Ogata[2008])

    Motor Torque Constant, = 0.3 Motor Back Emf Constant, = 0.3 Motor Inductance, = 4 Motor Armature Resistance, = 1.5 Radius of pulley,

    = 0.0325

    Ogata (2008) gave a detailed analysis of the modelling of DC motor. This modelling is

    applied here for deriving open loop transfer function for control for rotation angle.

    = = . . (3.20) =

    (

    +

    ) . . . (3.21)

    Substituting the value of F from Equation 3.21 in Equation 3.19, we get:

  • 8/2/2019 BTP Sem2 Final

    23/116

    10

    0.48283 12.45 10 + 0.4282 = + . (3.22)On simplifying, we get:

    =

    [0.4824 + 0.482 + 0.4283 + 0.428 12.45 0.4282 12.45 10 (10 + 10) ..(3.23)On substituting the motor constants in equation 3.23:

    = 9.23 0.0001934 + 0.7243 + 0.67552 18.68 15.9 . . . (3.24)

    The model presented above incorporates the fact that the mechanical system/plant is perfectly

    ideal, and does not give desired results. So, further assumptions can be made and the model is

    more simplified in order to obtain desired results. As per the real system/rig, the friction

    present in the cart is significant and the pendulum motion does not result in counter motion in

    cart. Therefore, for the cart position control, the cart and the pendulum can be assumed to

    lumped masses. The resulting modelling is presented below.

    = + + . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 2 5 )On taking Laplace, we obtain

    = + + 2 . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 2 6 ) = 1 + + 2 + . . . . . . . . . . . . . . . . . . . . . . . . .(3.27)

    =1

    0.792 + . . . . . . . . . . . . . . . . . . . . . . . . . .(3.28)On combining equations 3.28 and 3.12, we get:

    = 10.792 + 20.4282 10 . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 2 9 )

    =

    0.338

    3 + 0.428

    2

    7.9

    10

    . . . . . . . . . . . . . . . . . . . . . . . . . . ( 3 . 3 0 )

  • 8/2/2019 BTP Sem2 Final

    24/116

    11

    On substituting for F from equation 3.25 in Equation 3.21, we get:

    ( + ) = + . . 3.31On taking Laplace Transforms and simplification, we get:

    = 3 + + 2 + + . . 3.32On substituting values in equation 3.26, we get

    = 0.30.00010273 + 0.0385 + 0.000132 + 0.0487 + 2.77 = 10.0003423 + 0.1282 + 9.4 . . . . . . . . . . . . . . . . . . . . . . (3.33)

    Similarly solving for

    = . = 20.4282 10 3 + + 2 + + On substituting the values, we get

    = 20.4282 10 0.30.0001033 + 0.038 + 0.000132 + 0.0487 + 2.77 . . (3.34)

    = 2

    0.4282 100.3

    0.0001033 + 0.038132 + 2.8187 . . (3.35) = 0.0001464 + 0.05433 + 42 1.271 94 . (3.36)Equations 3.36 and Equation 3.33 are the equations that are used as transfer functions to

    model the plant in the simulation.

  • 8/2/2019 BTP Sem2 Final

    25/116

    12

    Control equations:

    For implementing State space control, the requisite modelling has been done below:

    Putting values in Equation 3.8 and 3.9, we get:

    = 10.64 + 12.34 + 10.64 0.0325

    . (3.37) = 2.08 + 25.95 + 2.088

    0.0325 . (3.38)

    Writing in State-Space notation:

    = 0 1 0 0

    0 10.64 12.34 00 0 0 10 2.08 25.95 0 + 0

    10.640

    2.088 . (3.39)

  • 8/2/2019 BTP Sem2 Final

    26/116

    13

    Now first PID SISO control of pendulum angle is illustrated.

    = = = + + . . (3.40)

    Let plant Transfer function be H1 for

    Let plant Transfer function be H1for

    = = 0.0001464 + 0.05433 + 42 1.271 94 . (3.41)

    On combining, we get:

    =

    1 +

    =

    + + 0.0001464 + 0.05433 + 42 1.271 941 + + + 0.0001464 + 0.05433 + 42 1.271 94 ..(3.42)

    Controller Plant0

    Figure 3.3 Schematic for SISO theta control

  • 8/2/2019 BTP Sem2 Final

    27/116

    14

    Now simultaneous control of pendulum angle and cart position is presented through two

    strategies.

    Control Strategy 1Cascaded- Offsetting of setpoint of pendulum angle

    = = 0.428 102 = 0 = + + . . . (3.43)

    So combined Closed Loop Control Transfer Function:

    So combined Closed Loop Control Transfer Function:

    = 1 + . . . (3.43)

    Figure 3.4 Schematic of cascaded PID logics for control

    Plant H2Controller x

    Controller Plant H10

    x

  • 8/2/2019 BTP Sem2 Final

    28/116

    15

    Control Strategy 2Parallel- Addition of control actions of pendulum angle and cart

    position

    =

    = 0.428

    10

    2

    = 0 = + + . (3.44)

    So combined Closed Loop Control Transfer Function:

    So combined Closed Loop Control Transfer Function:

    =

    1 + .

    . (3.45)

    3.2 Modelling in MATLABThe main purpose of simulating the system on MATLAB was to understand the amount of

    force required to move the cart. Also, before actually proceeding to manufacturing, it was

    important to calculate the stroke length of the carriage rails.

    So, to simulate the actual control algorithm, the force applied on the cart was kept constant.

    But only its direction was changed on the basis of the quadrant in which the pendulum was

    present and the angular velocity of the pendulum. The convention used for the quadrants has

    been shown in the Figure 3.6.

    Plant H2Controller x

    Controller Plant H10

    x

    Figure 3.5 Schematic of Parallel PID logics for control

  • 8/2/2019 BTP Sem2 Final

    29/116

    16

    1. If the pendulum was in the II or III quadrant, the direction of the force will be same asthat of the angular velocity of pendulum, that is, if the angular velocity of pendulum is

    clockwise, then a positive force will be applied to the cart.

    2. If pendulum lies in I quadrant and the pendulums angular velocity is greater than 0,negative force will be applied to the cart.

    3. If the pendulum lies in IV quadrant and the pendulums angular velocity is lesser than0, positive force will be applied to the cart.

    Mass of the cart, mass of the pendulum and the force applied by the motor are taken

    as inputs. Since it is difficult to solve the equations analytically, hence the equations

    are solved numerically using ode45 solver. The complete code used for the purpose is

    attached in the appendix-A.

    The simulation was done for Mass of Cart=2 Kg and Mass of pendulum=0.5kg.

    The results obtained were plotted and the following were results.

    Figure 3.6 - Quadrant-wise division of pendulum angle

    First

    Quadrant

    IV

    III II

    Positive Direction

    of Force

    Negative Direction

    of Force

    Horizontal Slider

    V

    ertical

    Second

    Quadrant

    Fourth

    Quadrant

    Third

    Quadrant

  • 8/2/2019 BTP Sem2 Final

    30/116

    17

    Figure 3.7 - Pendulum Angle with time

    As can be seen from the Figure 3.7, pendulum is brought to the upright position from the

    lowermost position within 3 seconds. After the pendulum reaches this position, linear control

    will be implemented and the system will be controlled in the upright position. A sharp drop

    seen in the above figure is due a change in the angle from 360 degrees to 0.

    Figure 3.8 - Cart Position with time

    As can be seen from the Figure 3.8, the cart position varies within [-0.6.0.6] m. Hence, a

    stroke length of 1.2 m is suitable for our system. So, an igus slider of length 1.5 m is used to

    accommodate for the mechanical blockers at the ends of the slider.

  • 8/2/2019 BTP Sem2 Final

    31/116

    18

    Figure 3.9 - Cart velocity with time

    As can be seen from the Figure 3.9, the cart velocity varies within [-2, 2] m/s. Hence, the

    motor selected for this purpose has been selected so as that the speed of the motor can

    account for this range.

    The force used for the simulation was 10N and a frictional force of 5N is also taken into

    account. So, in a nutshell, we can say that the motor selected has to meet the torque and the

    rpm required. If we select a pulley of diameter 80mm, the motor required should have a

    torque of 0.4Nm. To incorporate the account of resistance of air and also to have some safety

    limits, the motor required has to have a torque of 1Nm.With this diameter of pulley.

    Speed of the motor =260

    2 = 4703.3 Modelling in LabVIEW

    To implement the control system in real, it was necessary to build the control platform on the

    computer. LabVIEW files were created to interface the input and output to the computer via

    DAQ cards thereby enabling the user to manipulate the control logic and the gain values

    chosen easily for the control.

    SISO control on cart position X: Before creating the files to do real-time control,

    simulation was done by modelling the plant with a transfer function. Figure 3.10 shows the

  • 8/2/2019 BTP Sem2 Final

    32/116

    19

    LabVIEW graphical code for simulating an inverted pendulum system. Only feedback of the

    cart position X has been taken i.e. only PID control with 1 input has been implemented.

    Figure 3.10: LabVIEW Code for simulation of control of cart position X of inverted pendulum

    Figure 3.11 shows the front panel of the LabVIEW code shown in Figure 3.10. The panel

    provides user the options to change the set point for the cart position and PID gains. These

    can be varied before the start of the simulation as well as during run-time.

    Figure 3.11: Front Panel of simulation for PID control of only cart position

  • 8/2/2019 BTP Sem2 Final

    33/116

    20

    SISO Control on angle theta: Here cart position X was not taken into account. The transfer

    function for calculation of angle from the motor voltage was used to do the simulation. Figure

    3.12shows the block diagram for the simulation of the control of only angle theta.

    Figure 3.12: Block Diagram of simulation for only angle theta control

    Figure 3.13shows the front panel for theta-control. Here, again like Figure 3.11, user has the

    options to carry the gains of the PID logic and set-point.

    Figure 3.13: Front Panel for only theta-control

  • 8/2/2019 BTP Sem2 Final

    34/116

    21

    Cascading of PID logics for cart position x and angle theta:

    This logic has been unsuccessfully implemented byDockhorn[2]. In this work, this logic has

    been used successfully in simulation.

    Since a PID can handle only 1 input and 1 output at a time, it is not possible to give both cart

    position and theta as inputs and hence cant give separate gains to each of them. Hence this

    technique takes use of the concept of cascading of PID logics. So, first PID logic is

    implemented on the cart position and the resultant output is used to adjust the set-point of

    theta for the next PID logic. It takes the form

    0

    =

    0 +

    +

    +

    (3.46)

    As can be seen in the equation 3.46, the set-point of theta gets adjusted every time cart

    position sways away from its set-point. Hence, the only stable position for the system

    becomes the point where set-points of both theta and cart position are reached. For example,

    if the cart is moving in positive direction to control theta, set-point of theta changes so to

    maintain it, cart has to move in opposite direction so as to ensure that cart position doesnt

    sway away much from its set-point. Figure 3.14 shows the block diagram of the simulation

    for cascading of this technique.

    Figure 3.14: Block Diagram for simulating cascading control of PID logics

  • 8/2/2019 BTP Sem2 Final

    35/116

    22

    Figure 3.15 shows the front panel displaying all the parameters like the current values of

    pendulum angle theta, cart position and control action value.

    Figure 3.15: Front Panel for simulating cascading of PID logics

  • 8/2/2019 BTP Sem2 Final

    36/116

    23

    Chapter 4. Parts Selection and ProcurementSystem comprises of many components and hence all of them were dealt individually. This

    chapter focuses on all those various components.

    4.1 Mechanism ComparisonTable 4.1 shows comparison of various mechanisms considered.

    Table 4.1 Table showing comparison of various mechanism considered

    ACTUATOR

    TYPE/

    Parameter

    Rack and

    Pinion

    (Rack

    Moving)

    Rack and

    Pinion

    (Pinion

    Moving)

    Chain Rubber BeltLinear

    Actuator

    Inertia + ++ +++ +++ ++++

    Friction +++ ++ +++ +++ +++

    Space

    Considerations+ ++ ++ ++ +++

    Stroke

    Adjustability

    Rack+Bench

    length to be

    increased

    Rack+Bench

    length to be

    increased

    Chain+Bench

    length to be

    increased

    Belt+Bench

    length to be

    increased

    No

    Adjustibility

    Reference: +++ Good ++ Average + Bad

    From the above comparison, it was decided to use chain or Belt actuated mechanism.

    According to our requirements of stoke length of 1.2 m, on doing the calculations, the length

    of the rubber belt comes out as 3.3 m. To prevent backlash error, a module of at least lessthan 6mm should be used. Finally, a timing belt and gear pulleys of module 4mm were used.

    4.2 Slider MechanismComparative analysis of various slider mechanism was done and has been shown in the Table

    4.2

  • 8/2/2019 BTP Sem2 Final

    37/116

    24

    Table 4.2 Comparative Analysis of various sliders

    SLIDER TYPE/

    Parameter

    IGUS Sliders Conventional

    Rails

    Telescopic

    Channels

    Smoothness +++ ++ +++

    Load Bearing

    Capacity

    +++ ++ +

    Length

    Available

    +++ +++ +

    Cost ++ +++ ++

    Weight ofCarriage

    +++ ++ +

    Reference: +++ Good ++ Average + Bad

    From the above comparison, it was decided to use IGUS Sliders.

    The following parts were considered for the mechanism.

    IGUS ZLW Belt Drive

    Figure 4.1 shows the sliding drive system considered for the system.

    Figure 4.1 - Igus Toothed Belt Axis

    Although this belt drive system from IGUS, would have simplified the designing process but,

    due to very high cost, it was rejected

    IGUS Dryline N Series Guide Systems width 40 mm

    Figure 4.2 shows the slider rails considered for the system.

  • 8/2/2019 BTP Sem2 Final

    38/116

    25

    Figure 4.2 - Dry LIne - Low Profile Linear Guide System NK-01/02-40

    Reason for rejection: Since the width of the cart required was about 100 mm,

    therefore, we would have to use two of the above sliders in parallel. This would cause

    problems of misalignment between the two sliders.

    IGUS Dryline N Series Guide Systems width 80 mm

    Figure 4.3 shows the slider mechanisms of width 80mm finally selected for the system.

    Figure 4.3 - Dry Line - Low Profile Linear Guide Systen NK-02-80

    Since the product fulfilled all the purposes and the cost was within the acceptable limit. So,

    further analysis for the above slider was done and shown below.

    Selection of IGUS Sliders

    The IGUS slider with width 80 mm was selected.

  • 8/2/2019 BTP Sem2 Final

    39/116

    26

    The maximum moment and load carrying capacity of the sliders is shown in the figure 4.4:

    Figure 4.4 - Moment rating of selected igus slider

    The maximum speeds possible at various loads is shown in the figure 4.5.

    Figure 4.5 - Characteristic curves of selected igus slider

    The following criteria were satisfied:

    1. The maximum vertical load and maximum moment applied is far less than thecapacity of the slider.

    2. Since, the applied load is far less than applied, sufficiently high speeds can bereached.

    4.3 Motor SelectionThe servo motor has some control circuits and a potentiometer (a variable resistor, aka pot)

    that is connected to the output shaft. In the picture above, the pot can be seen on the right side

    of the circuit board. This pot allows the control circuitry to monitor the current angle of theservo motor. If the shaft is at the correct angle, then the motor shuts off. If the circuit finds

  • 8/2/2019 BTP Sem2 Final

    40/116

    27

    that the angle is not correct, it will turn the motor the correct direction until the angle is

    correct. The output shaft of the servo is capable of travelling somewhere around 180 degrees.

    Usually, its somewhere in the 210 degree range, but it varies by manufacturer. A normal

    servo is used to control an angular motion of between 0 and 180 degrees. A normal servo is

    mechanically not capable of turning any farther due to a mechanical stop built on to the main

    output gear.

    To modify a motor so that it can rotate more than 180 degrees, the mechanical stop inside the

    motor needs to be removed. By doing this, we lose position control, although speed control is

    gained. So, a potentiometer based servo motor cant be used. Hence, we have to used an

    optical based servo motor which essentially is a DC motor along with an optical encoder.

    Therefore, it was decided to use a DC motor and an encoder separately.

    The figure 4.6 shows the motor finally selected and used.

    Figure 4.6 - RoboKits Motor - selected motor

    Motor specifications:

    450RPM 12V DC motors with Metal Gearbox 25000 RPM base motor 6mm shaft diameter Gearbox diameter 37 mm. Motor Diameter 28.5 mm Length 63 mm without shaft Shaft length 15mm

    300gm weight 20kgcm torque

  • 8/2/2019 BTP Sem2 Final

    41/116

    28

    No-load current = 800 mA(Max), Load current = upto 9.5 A(Max) Price: Rs. 900

    4.4 Encoder SelectionTwo encoders are required for the application; one to measure the rotation of the motor and

    the other one to measure the angle of the pendulum. Since the angle of the pendulum moves

    only varies from 0-360 degrees, to know the number of rotations of the pendulum an absolute

    encoder has to be used for that purpose. On the other hand, to note the current position of the

    cart, it is required to note more than one rotation and hence, an incremental encoder has to be

    used.

    The encoders have been procured from BTH which is a multinational company and providesservice for its products and hence the parts are standard which can be procured for the project

    later on.

    An incremental encoder has 4 signals which ultimately calculate the direction of rotation of

    the shaft and also the speed of movement. The encoder has been shown in the Figure 4.7.

    Figure 4.7 - Incremental Encoder BI-52S-2500-PU

    4.5 Motor DriverA motor driver has to be used to control the voltage given to the motor. This motor driver

    takes analog inputs provided by the DAQ Card. This motor driver takes analog voltage as

    input and then calculates the voltage that has to be supplied to the motor.

    Input Voltage Range=0-5V

    Input Current Range = 0-30mA

    Output Voltage Range= 0-12V

  • 8/2/2019 BTP Sem2 Final

    42/116

    29

    This has been procured from the Robotics Club, IIT Delhi as this has been tried and tested

    successfully by them. This is made by the companyDimensionEngineering and is a standard

    part that can be procured later at any stage of the project. The figure 4.8 shows the motor

    driver. The data sheet of this has been attached in the Appendix-E.

    Figure 4.8 - Motor Driver (www.dimensionengineering.com)

    4.6 Data Acquisition Card (DAQ)DAQ Card is required to transfer the reading from the encoders to the computer and then givethe controlled outputs back to the motor. The Data Acquisition card present in the Lab was

    studied and checked for compatibility. Two models were available in the lab but the model

    relevant for the project has been selected.

    Model Number: NI PCI-6221

    Specifications:

    OUTPUT PORTs: Two 16-bit analog outputs (833 kS/s) INPUT/OUTPUT PORT: 24 digital I/O COUNTER: 32-bit counters

    Required Inputs:

    Two Angular EncodersDigital Inputs

    Required Outputs:One Motor Driver CardAnalog output

  • 8/2/2019 BTP Sem2 Final

    43/116

    30

    The figure 4.9 shows the port of the DAQ which has 68 pins and all the pins have been

    marked for their corresponding functions.

    Figure 4.9 - DAQ NI-PC 6221 Port Drawing

  • 8/2/2019 BTP Sem2 Final

    44/116

    31

    Chapter 5. Equipment Design and FabricationThe Figure 5.1 shows the final CAD Drawing of the complete system.

    Figure 5.1 - Final CAD model

  • 8/2/2019 BTP Sem2 Final

    45/116

    32

    The figure Figure 5.2 shows the CAD Model of the Igus slider that has been ordered.

    Figure 5.2 - Igus Slider

    After this, the cart along with the pendulum has been designed and the Figure 5.3 shows the

    CAD Model for that.

    Figure 5.3 - Cart along with the pendulum

    This cart has now been attached to the slider. After this, to move the cart along the slider, a

    chain and sprocket system has been designed. So, on one side of the slider, we have a drivingmechanism. On the other side, there is a driven mechanism. The driving mechanism consists

  • 8/2/2019 BTP Sem2 Final

    46/116

    33

    of a motor attached to a shaft which is further connected to an incremental encoder to

    measure the rotation of the motor so as to calculate the position of the cart. The assembly is

    supported by the bearings which in turn are mounted on a plate. The Figure 5.4 shows the

    CAD model of the driving mechanism.

    Figure 5.4 - Driving Mechanism

    The driven mechanism assembly consists of a idler sprocket supported by 2 bearings on a

    plate. The Figure 5.5 shows the CAD Model of the driven mechanism.

    Figure 5.5 - Driven Mechanism Assembly

    To support the slider, the driving mechanism and the driven mechanism, three stands are

    made. Two of the three stands are identical which are at the ends and the Figure 5.6 shows

    the CAD model of that stand. The shape of this stand has been made so as to support the

  • 8/2/2019 BTP Sem2 Final

    47/116

    34

    driving (or driven) mechanism and the slider. Also, provision has been made to accommodate

    the chain of the pulley.

    Figure 5.6 - Stand on the ends of the slider

    The Figure 5.7 shows the CAD Model of the middle stand.

    Figure 5.7 - Middle Stand

    After procuring the components for the setup like aluminium box channels, shafts, couplers

    etc. in the last semester, the manufacturing was started. First of all, the stands were made

    which had to support the complete setup. The channels were cut as per the requirements and

    were taken to a manufacturer outside IIT where they were welded using TIG Welding. Figure

    5.8 shows the welded stands. One fork of the left stand supports the driving motor and the

    other stand supports the IGUS Sliders.

  • 8/2/2019 BTP Sem2 Final

    48/116

    35

    Figure 5.8 : Stands after TIG Welding

    Then plates were cut using sheet metal cutter to support the sliders. Figure 5.9 shows the

    5mm Aluminium plates used in the setup.

    Figure 5.9 : 5mm Aluminium plates

    To support the driving shaft assembly and the driven shaft assembly, the 5mm plates were

    bent so as to take in account the profile of the gear. Figure 5.10 shows both the plates.

    Figure 5.10 : Plates used to support the driving and the driven shaft assemblies

  • 8/2/2019 BTP Sem2 Final

    49/116

    36

    Further, to drive the system, timing belt was selected. To prevent any mismatch, the timing

    pulleys of the same module as the belt were obtained. Figure 5.11 shows the timing belt and

    figure 5.12 shows the profile of the timing pulleys thus obtained.

    Figure 5.11 : Timing belt 3.5m long and 10mm wide

    Figure 5.12 : Profile of the timing pulleys

    To drive the system, 8mm shaft was selected and was cut according to the CAD Model. Thus

    8mm bearings were selected. Outer diameter of the selected bearings was 16mm. Figure 5.13

    shows the selected bearings.

    Figure 5.13 : 8mm roller bearing

  • 8/2/2019 BTP Sem2 Final

    50/116

    37

    To mount the bearings in the system, aluminium housing was made from a 25mm diameter

    aluminium rod. The bearings were fitted into the housing with a tight fit. A 2mm strip was

    welded tangentially to the rod for base of the housing. Figure 5.14 shows the close-up view of

    the bearing fitted into housing.

    Figure 5.14 : Bearing with housing

    To mount the motor and the encoder on the support, L-shaped housings were made and

    connected to them. Figure 5.15 and figure 5.16 shows the motor and the encoder along with

    their housings. Two incremental encoders were used and both have the similar housings.

    Figure 5.15 : Driving Motor with housing

  • 8/2/2019 BTP Sem2 Final

    51/116

    38

    Figure 5.16 : Encoder along with housing

    To connect the motor and the encoder to the 8mm shaft, muff couplings were used as per the

    CAD drawings. The driving assembly was made by assembling the motor with the shaft and

    that with the encoder. The shaft was supported by 2 bearings and to level the bearings, the

    bearing supports were made. Figure 5.17 shows the driving shaft assembly.

    Figure 5.17 ; Driving shaft assembly

    Similarly, the driven shaft assembly was made. The shaft was simply mounted using the two

    bearings and their stands. Figure 5.18 shows the driven shaft assembly.

  • 8/2/2019 BTP Sem2 Final

    52/116

    39

    Figure 5.18 : Driven shaft assembly

    Now, to make the cart, a 5mm plate was first attached to the Igus slider. The remaining

    assembly was fixed over the cart. To hold the pendulum, a shaft was made with provision to

    attach the encoder on one side and pendulum on the other side. The shaft along with the

    bearing and encoder were supported on the cart plate. The bearing was supported by a

    bearing support to level the encoder with the bearing. The complete cart assembly including

    the encoder, its housing, shaft, cart, bearing is shown in the figure 5.19.

    Figure 5.19 : Cart assembly

    The pendulum was made by attaching an 8mm aluminium rod to a steel cylinder. The steel

    cylinder was attached as a bob to increase the moment of inertia of the pendulum about the

    pivot point so as to reduce the air drag caused while oscillations. Figure 5.20 shows the

    pendulum.

  • 8/2/2019 BTP Sem2 Final

    53/116

    40

    Figure 5.20 : Pendulum

    The complete system was mounted on the sliders and the stands. Now to drive the cart, the

    motor was attached to the cart using a timing pulley. The belt was wound tightly on the

    pulley and the open ends of the belt were fixed to the cart by attaching 2 plates on the cart.

    The bolts on the pulley could be tightened to hold the belt in tension. Figure 5.21 shows the

    close-up view of the joint between cart and belt.

    Figure 5.21 : Joint between cart and timing belt

  • 8/2/2019 BTP Sem2 Final

    54/116

    41

    The complete setup was assembled and placed in the Vibrations Research Lab. Due to the

    uneven heights of all the stands, the setup was not stable. To solve the problem, it was

    required that the system be fixed to a heavy base. Hence, a wooden board with the

    dimensions of the setup was obtained from the carpentry workshop. The setup was joined to

    the setup using 6mm bolts and the joint is shown in the figure 5.22. Further, counter-boring

    was done on each of the holes so that the setup rests on the wooden base and not on the heads

    of the bolt.

    Figure 5.22 : Joint between wooden block and stand

    Since, the slider was of the shape of a strip, to prevent bending, it was necessary to provide it

    some support. Hence, to increase the stiffness of the slider a 3x1 cross-sectional aluminium

    channels was attached. Figure 5.23 shows the arrangement done for the same.

    Figure 5.23 : Support for the slider

    Finally, the setup was assembled and the figure 5.24(a) and (b) shows the final setup thus

    made.

  • 8/2/2019 BTP Sem2 Final

    55/116

    42

    Figure 5.24(a) and (b) : Final setup of inverted pendulum

  • 8/2/2019 BTP Sem2 Final

    56/116

    43

    Chapter 6. Developing of Sensing and Actuation of systemTo interface the system with the computer, it was required to interface the encoder(Section

    6.1) to the DAQ Cards and the voltage generated by the DAQ Card should be sent to the

    motor. But since DAQ Card can only supply a very small current, a motor driver is required

    to amplify the signal via a battery. This has been discussed in Section 6.2.

    6.1 Encoder InterfacingAn incremental encoder takes 2 signals as inputs one 5V and the other one, ground. It

    generates various output signals. For the current purpose, it was required to measure the

    angular rotation of the encoder. So, only 2 signals are required one is waveform A and

    other is waveform B. Figure 6.1 shows a general output of the 2 waveforms. When

    waveform A leads waveform B by a phase of 90 degrees, it implies that the encoder is

    moving in clockwise direction, and when it lags, it indicates that encoder is moving in

    counter-clockwise direction.

    Figure 6.1 : 2 output signals generated by incremental encoder(NI Developer Zone forum)

    Hence, the measurement must be made continuously to ensure that the final reading takes

    into account this. THE NI-DAQ has 2 counters to do this function. Each counter has a source

    and up/down line which automatically calculates the final output. Figure 6.2 illustrates this.

    Figure 6.2 : Simplified Counter/Timer Model of DAQ

  • 8/2/2019 BTP Sem2 Final

    57/116

    44

    The NI-6221 DAQ card has 2 counters and the figure 6.3 shows the pins of connector block

    SCB-68 that correspond to the source and up/down line.

    Figure 6.3 : Layout of the connector block of NI-6221

    As can be seen from the figure 6.3, pin 37 correspond to the source of counter 0 and pin 45

    corresponds to auxiliary line of counter 0.To test the counter, a labview code was made to

    read from the counter and display the final angle in a numeric indicator. Figure 6.4 shows theblock diagram of the code.

    Figure 6.4 : Block diagram of the code to measure encoder's position

    The encoder was tested and the code worked fine. The numeric indicator continuously

    showed the current position of the encoder as per a reference position given.

  • 8/2/2019 BTP Sem2 Final

    58/116

    45

    6.2 Motor Driver FabricationA motor driver has to be used to control the voltage given to the motor. This motor driver

    takes analog inputs provided by the DAQ Card. This motor driver takes analog voltage as

    input and then provides the required amount of voltage, current and energy to the motor.

    The whole motor driver circuit is composed of three modules:

    1. L7805: The L7806 chip is three-terminal positive regulator package, making it usefulin a wide range of applications. This regulator can provide local on-card regulation,

    eliminating the distribution problems associated with single point regulation. Each

    chip employs internal current limiting, thermal shut-down and safe area protection,

    making it essentially indestructible. If adequate heat sinking is provided, they can

    deliver over 1A output current. Although designed primarily as fixed voltage

    regulators, these devices can be used with external components to obtain adjustable

    voltage and currents. Figure 6.5 shows a typical L7805 chip. Data-sheet of L7805

    chip is attached in Appendix-D.

    Figure 6.5: L7805 chip (http://www.mindkits.co.nz/store)

    This chip was used to generate a regulated supply of +5 Volts to be given to Atmega

    16. The pinouts and connections are shown in figure 6.6.

    Figure 6.6: picture showing pinouts of L7805 chip(http://www.mindkits.co.nz/store)

    http://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5ahttp://www.mindkits.co.nz/store/components-ics-breakout-boards/silicon-chips-ics/5-x-l7805-7805-voltage-regulator-5v-1-5a
  • 8/2/2019 BTP Sem2 Final

    59/116

    46

    2. Atmega 16: This takes the analog input voltage corresponding to the rpm of themotor from the DAQ card and then calculates the energy to be given to the motor.

    The output is in the form of PWM (Pulse Width Modulation) at a high frequency. The

    voltage at the output is only +5 Volts and the current is also in milli-amperes. So, this

    has to be stepped up to 12 V and the current current ~ 2 Amperes has also to be

    provided. The Atmega 16 is shown in Figure 6.7. Data-sheet of AtMega 16 is attached

    in Appendix-B.

    Figure 6.7: ATmega16 chip (http://www.futurlec.com/Atmel/ATMEGA16.shtml)

    The pinouts of this micro-controller are shown in Figure 6.8.

    Figure 6.8: Pinouts of Atmega 16 (Appendix B)

    The Atmega 16 controller was connected to a base before mounting on the matrix

    board. The input signals were given on Pin 40 (Analog Input) and the PWM output is

    obtained on pin 19. Figure 6.9 shows the soldering in progress for the base.

    http://www.futurlec.com/Atmel/ATMEGA16.shtmlhttp://www.futurlec.com/Atmel/ATMEGA16.shtmlhttp://www.futurlec.com/Atmel/ATMEGA16.shtmlhttp://www.futurlec.com/Atmel/ATMEGA16.shtml
  • 8/2/2019 BTP Sem2 Final

    60/116

    47

    Figure 6.9: Soldering in progress for Atmega 16 Base

    The status of matrix board after soldering of Atmega 16 base, crystal, ISP and L7805

    chip is shown in figure 6.10.

    Figure 6.10: Soldered Atmega 16 Base, crystal, ISP port and L7805 chip on matrix board

    3. L298N: It is a high voltage, high current dual full-bridge driver designed to acceptstandard TTL logic levels and drive inductive loads like DC motors. Figure 6.11

    shows a typical L298N chip. Data-sheet of L298N is attached in Appendix-C.

  • 8/2/2019 BTP Sem2 Final

    61/116

    48

    Figure 6.11: L298 chip (Appendix C)

    The L298 chip takes the following inputs:

    Power supply: 12 V Logic Supply: 5V Ground PWM (logic form) Direction of rotation (logic Form)The L298 chip gives the output to the motor by two terminals. Figure 6.12 shows all

    the pin connections of the L298 chip.

    Figure 6.12: Connections for L298N for driving DC motor (Appendix C)

  • 8/2/2019 BTP Sem2 Final

    62/116

    49

    The L298 chip was soldered onto a base to allow for easy dismounting of the chip. The view

    of soldered L298 chip is shown in Figure 6.13.

    Figure 6.13: Soldered L298 chip

    All the chip connections were made and soldered. Figure 6.14 shows the final motor driver

    card.

    Figure 6.14: Motor Driver card

  • 8/2/2019 BTP Sem2 Final

    63/116

    50

    Chapter 7. Control Implementation

    After the complete setup has been installed and the necessary electrical connections have

    been setup, control implementation was done. To get familiarity with the labVIEW, basic

    experiments were done e.g. synchronising counter with the encoder to calculate the final

    displacement of the encoder, and taking measurement from a simple potentiometer. As has

    been discussed in Section 3.3, before proceeding to the real-time control implementation,

    labVIEW codes were created to simulate the plant using values from the analytical model of

    the plant. After the simulation was done, real-time implementation was done and the results

    were compared. As the trend observed with the change in control logic parameters in

    simulation were similar to real-time system, trends in simulation results were used to vary the

    parameters in real-time system to obtain the desired characteristics.

    As discussed in Section 3.3, first of all SISO controls for cart position and pendulum angle

    were applied individually and then cascaded PID logic was used to balance both cart position

    and pendulum angle simultaneously. This section focuses on the results obtained from

    simulation and real-time system and their comparison with each other.

    7.1 SISO Control of Cart Position(x)For real-time implementation, the voltage calculated by the PID logic was supplied to motor

    as voltage and values of cart position and angle theta of the pendulum were taken by the

    encoders mounted on the plant. Figure 7.1 shows the block diagram of the labVIEW code

    used for real-time control.

  • 8/2/2019 BTP Sem2 Final

    64/116

    51

    Figure 7.1: Block Diagram for real time x-control

    The PID logic used consists of 3 parameters Kp, Kd, Ki. To understand the variation and

    the effect of each of these on the control characteristics, each of them was varied keeping the

    other two fixed. First of all, proportional constant Kpwas varied keeping Kd, Ki constant.

    Figure 7.2shows the simulation results for 3 different values of Kp and values of Ki and Kd

    have been kept constant at 500 and 0.01 respectively. The set-point of the cart has been set at

    0.08m and simulation is done for 10 seconds at a sampling time of 1 ms. Results show the

    value of 2 parameters cart position X and control action.

  • 8/2/2019 BTP Sem2 Final

    65/116

    52

    As can be seen from Figure 7.2,with increase in Kp values from 10 to 100, damping of the

    system increases and the settling time decreases monotonously. Also, rise times constantly

    decrease. Similar analysis is also done for the real-time system. But since there are unwanted

    differences in the modelling and the actual system, the values obtained are different from the

    simulation results. Hence, only trends have been focussed at in this work.

    Figure 7.3shows the results obtained with the real-time system for change in Kp values from

    100-300.

    Figure 7.2 Simulation results for Kp=10, 25,50,100

  • 8/2/2019 BTP Sem2 Final

    66/116

    53

    For real-time system also, damping of the system increases monotonously with increase inKp values. Settling time of the system and rise time also decrease continuously. Hence, the

    trends match exactly with the simulation results.

    As with Kp, similar operations were performed with Ki and Kd. Figure 7.4 shows the results

    obtained for the simulation by varying Ki from 100 to 4000 whereas Kp and Kd have been

    kept constant at 25 and 0.01 respectively.

    Figure 7.3 Real-time results for Kp=100, 150, 300, 500

  • 8/2/2019 BTP Sem2 Final

    67/116

    54

    As can be seen from Figure 7.4, damping decreases with increase in Ki and settling time

    increases continuously. To compare the results with the real-time system, their results are

    displayed in Figure 7.5. Here, Kp and Kd have been kept constant at 300 and 0.003

    respectively but Ki has been varied from 3000 to 80000.

    Figure 7.4 Simulation results for Ki=100,500,1000,5000

  • 8/2/2019 BTP Sem2 Final

    68/116

    55

    For the real-time system also, results match with the simulation. With increase in Ki,

    damping decreases and settling time increases continuously.

    Finally, trends were studied were studied for variation in Kd. Figure 7.6 show variation of

    results on changing values of Kd from 0.001 to 1 whereas Kp and Ki have been kept constant

    at 25 and 500 respectively.

    Figure 7.5 Real-time results for Ki=3000, 30000, 60000, 80000

  • 8/2/2019 BTP Sem2 Final

    69/116

    56

    Results from the simulations suggest that with increase in Kd, damping decreases and settling

    time increases continuously.

    Figure 7.7 shows the variation in a real-time system. Values of Kp and Ki have been kept

    constant at 300 and 30000 respectively whereas Kd has been varied from 0.003 to 3

    respectively.

    Figure 7.6 Simulation results for kd=0.001, 0.01, 0.1, 1

  • 8/2/2019 BTP Sem2 Final

    70/116

    57

    The results show that with increase in values of Kd, damping of the system increases and

    settling time does not change significantly. Unlike Kp and Ki, trend of Kd is different from

    what is observed in simulation. This signifies that there is feature of the system that has bot

    been captured in the simulation models.

    7.2 SISO Control of Pendulum Angle(

    )

    To do real-time control implementation, like Figure 7.1, motor voltage was given to the

    motor via DAQ Card and similarly, angle theta and cart position are measured by encoders

    and supplied to the labVIEW code via DAQ Cards. Figure 7.8shows the block diagram for

    the simulation.

    Figure 7.7 Real-time results for Kd=0.003, Kd=0.3, kd=3

  • 8/2/2019 BTP Sem2 Final

    71/116

    58

    Figure 7.8: Block Diagram for theta-control real-time implementation

    Like Section 7.1, in this section also, 3 parameters of the PID logics Kp, Ki, and Kd are

    varied to study and observe the trends. Both simulation and the real-time system have been

    studied so that any differences, if any, can be commented upon.

    Figure 7.9 shows the simulation results for 3 different values of Kp. The set-point of the

    angle has been set at 0.057 radians and simulation is done for 2 seconds at a sampling time of

    1 ms. Results show the value of 3 parameters cart position X, pendulum angle and controlaction.

  • 8/2/2019 BTP Sem2 Final

    72/116

    59

    As can be seen from Figure 7.9, with increase in values of Kp from 40 to 500, damping of the

    system decreases monotonously. The settling time also decreases continuously.

    Figure 7.10 shows the results obtained for the real-time system. Here Ki and Kd have been

    kept constant at 5 and 0.35 respectively but Kp is varied from 200 to 700. Since, the position

    of the cart is not controlled, hence the cart goes out of the desired limits very soon. So,

    pendulum can be kept within limits only for 1-2 seconds without any manual intervention.The graphs have been obtained only for the region where there was no manual intervention.

    On start-up, pendulum was left at its swing up position, and unlike simulation, stability of the

    pendulum is studied only.

    Figure 7.9 Simulation results for Kp=40, 75, 200, 500

  • 8/2/2019 BTP Sem2 Final

    73/116

    60

    As can be seen from the Figure 7.10, as values of Kp increases, the stability of the pendulum

    increases and hence, its tendency to sway away from the centre decreases. But due to noise in

    the surroundings, the control action keeps fluctuating and hence theta keeps on oscillating.

    The pendulum stays within range only for 2-3 seconds because in its effort to control

    pendulum angle, it moves rapidly on the cart and hence crosses the boundaries. Hence,

    similar analysis has been done for Ki and Kd.

    Figure 7.11 shows the results for the simulation of variation in values of Ki. Kp and Kd have

    been kept constant at 75 and 0.002 respectively.

    Figure 7.10 Real-time results for Kp=200, 450, 700

  • 8/2/2019 BTP Sem2 Final

    74/116

    61

    As can be seen from Figure 7.11, as values of Ki increase from 0.005 to 0.1, damping of the

    system decreases. Steady state error of the system also increases with time continuously

    whereas the settling time decreases continuously.

    In real-time system also, results were measured for changing values of Ki from 5 to 100

    keeping Kp and Kd constant at 450 and 0.35 respectively. Figure 7.10 show the results

    obtained.

    Figure 7.11 Simulation results for KI=0.005, 0.01, 0.05

  • 8/2/2019 BTP Sem2 Final

    75/116

    62

    Figure 7.12 suggest that with increase in values of Ki from 5 to 100, system becomes more

    stable and less sensitive to noise. Its tendency to sway away from the centre decreases. This is

    explicit from noticing that that oscillations in the system decrease due to noise with increase

    in Ki.

    Finally, simulation was done by varying values of Kd from 0.002 to 0.2 respectively. Kp and

    Ki have been kept constant at 75 and 0.05 respectively. Figures 7.13 show the results

    obtained.

    Figure 7.12 Real-time results for Ki=5, 10, 50, 100

  • 8/2/2019 BTP Sem2 Final

    76/116

    63

    Figures 7.13 suggest that as value of Kd increases from 0.002 to 0.2, damping decreases

    continuously. Also, settling increases continuously.

    Now, similar readings are obtained for the real-time system. The graphs obtained are shown