DESIGN AND CONTROL OF PID-CONTROLLED BALL AND BEAM SYSTEM

Download The control of The Ball and Beam system is very important in the aviation and space fields because of its similarity to the control of airc...

0 downloads 862 Views 2MB Size
INTERNATIONAL SCIENTIFIC CONFERENCE 22 – 23 November 2013, GABROVO

DESIGN AND CONTROL OF PID-CONTROLLED BALL AND BEAM SYSTEM Sıtkı KOCAOĞLU Kırklareli University / TURKEY [email protected]

Hilmi KUŞÇU Trakya University / TURKEY [email protected]

Abstract The control of The Ball and Beam system is very important in the aviation and space fields because of its similarity to the control of aircraft during the flight, landing and turbulent,. Since real experiments are not possible in these areas, using Ball and Beam systems in the control laboratories has become necessary. The system aims to keep the ball on the beam in desired position. Current position of the ball is measured by using various sensors and the location of the ball is changed by changing the angle of beam by using various motors. The mathematical model of this system is not linear. By using several control algorithms, system tries to move the ball to the desired position appropriately. Here system tries to set the rising time, the overshoot and offset in optimum level. In this study the PID control method is applied and system is fixed as an experimental set. The aim is lecturing the effects of PID constants to students in control laboratories. Keywords: Ball and Beam, PID, Control, Microprocessor

INTRODUCTION This study aims to control the position of the ball moving freely on a beam. The angle between the horizontal and the beam depends on the movement of the motor that controls the beam. The system brings the ball to the desired area on the beam by using closed loop control. Designed as an experimental set, this system suggests a new control method and material selection way for one of the most popular models of automatic control. The control of unstable systems is very important for many control problems. Since such systems prove dangerous to test in vertical position control of aerospace and airplanes, we can only study them in laboratories by modeling the system. In this project we used an aluminum beam, a stepper motor, a ping pong ball, and two infrared sensors to measure the position of the ball. The system attempts to measure the angle of beam and the position of the ball. We can calculate the angle between beam and horizontal because we know the motors angle per step. But we can’t calculate the linear speed of the ball which is under outer effects. We designed P, PD, PI and PID controllers for this system. The user can choose Kp, Kd and Ki coefficients freely. So

the user can see the effects of coefficients and compare the controller structures. The ball and beam system has been studied and used in the tests of new methods by many researchers. In particular, I. Petkoviç, M. Brezak, and R. Cupec have conducted artificial vision based tests of the system [1]. P. Dadios and R. Baylon did a similar study on fuzzy logic [2]. J. Whelan and J. V. Ringwood, on the other hand, used the same system for position tracking through a camera instead of sensors, using PID controllers [3]. S. Sridharan and G. Sridharan developed a new control lab device named beam and ball system sliding on a cylinder in which they used PID controllers [4]. Using PID technique on unstable systems’ control is very common and this experimental set is not dependent on computer, which makes the system a usable set for automatic control laboratories. EXPOSITION As seen in Figure 1, the system includes three mechanic components. These are the ball, the beam and the stepper motor that changes the angle of the beam. We supposed that the shaft of the motor is rigid and we took the centrifugal force as zero to simplify the function.

Международна научна конференция “УНИТЕХ 2013” – Габрово

III-41

(5) The angle is variable between 00 and 300. Also is variable between 0 and 0,5. The force on the ball is also variable between 0N and 0,0095 N. The moment of the motor is (6)

Fig. 1. The drawing of the system components

We supposed that beam’s axis is too close to ball’s contact plane and that the ball is not sliding on the beam. We must calculate the forces on the contact points of the components to find out movement equations. Initially, we can say there are two forces that effect the ball’s position on the beam. The first one is the gravity that affects the ball according to angle of the beam and second is the friction force between ball and beam according to the friction coefficient.

And we can find out the transfer function of the system by using the angle. We know that the step angle of the motor is equal to 1,8o. (7) (8) Formula 8 is not a complete transfer function, because this involves many unverified assumptions. Also, since this study is an experimental set, we are abstracting away from putting restrictions on controller type and variables like settling time or overshoot.

(1) The position of the ball on the beam is (2) where α is angular turning and r is the distance between turning axis of ball and contact position between ball and beam. r is nearly equal to radius of the ball. The momentum of the ball is (3) where

is the moment of inertia of the ball. (4)

The radius of the ball is equal to 0,63 cm and the mass of the ball is 2 g. By calculation, the moment of inertia is equal to 0,3.107 kg/m2, which is considered approximately zero. Thus, for formula 3, the frictional force is equals to zero.

III-42

Fig. 2. Photo of experimental set

Signals from sensors have been filtered by using suitable capacitors due to high distortion. The microcontroller takes the signals through built-in 10-bit ADC ports. The microcontroller compares the signals to the reference value. After that, it calculates the number of steps it will feed into the motor.

Международна научна конференция “УНИТЕХ 2013” – Габрово

START

LCD1 LM044L

OK

b1

b2

SOL

SAG

D0 D1 D2 D3 D4 D5 D6 D7

RS RW E

b3

R1

R2

R3

R4

1k

1k

1k

1k

7 8 9 10 11 12 13 14

4 5 6

1 2 3

VSS VDD VEE

b4

+6V

d4 d5 d6 d7

rs rw e

+6V

U3

sharp_digital rw d4 d5 d6 d7

33 34 35 36 37 38 39 40

18

RA0/AN0 RC0/T1OSO/T1CKI RA1/AN1 RC1/T1OSI/CCP2/UOE RA2/AN2/VREF-/CVREF RC2/CCP1/P1A RA3/AN3/VREF+ RC4/D-/VM RA4/T0CKI/C1OUT/RCV RC5/D+/VP RA5/AN4/SS/LVDIN/C2OUT RC6/TX/CK RA6/OSC2/CLKO RC7/RX/DT/SDO OSC1/CLKI RB0/AN12/INT0/FLT0/SDI/SDA RB1/AN10/INT1/SCK/SCL RB2/AN8/INT2/VMO RB3/AN9/CCP2/VPO RB4/AN11/KBI0/CSSPP RB5/KBI1/PGM RB6/KBI2/PGC RB7/KBI3/PGD

VUSB

RD0/SPP0 RD1/SPP1 RD2/SPP2 RD3/SPP3 RD4/SPP4 RD5/SPP5/P1B RD6/SPP6/P1C RD7/SPP7/P1D RE0/AN5/CK1SPP RE1/AN6/CK2SPP RE2/AN7/OESPP RE3/MCLR/VPP

15 16 17 23 24 25 26

Q1

R5

motor_puls b1

BC556AP

sens1 1K

motor_enable

R6 sens2

RV1

RV2

100

100

Q2 BC556AP

1k

+3 48%

53%

+5

19 20 21 22 27 28 29 30

U2

b3 sens1 sens2 motor_ileri_geri b2 e rs

8 9 10 1

D1 LED-BLUE

8 1 5 7 6

VCC1 VCC2

X1

2

X1 RST SCLK I/O

CRYSTAL X2

sharp2

b4

2 3 4 5 6 7 14 13

sharp1

sharp1 sharp2 pot

3

DS1302

RV3

+5V

100k

PIC18F4550

R7

pot

1k

56%

+5V

Fig. 5. Second Sensor’s Graph

Fig. 3. Proteus Circuit Model

transformation

(10)

Voltage (V)

sensor’s

Position (cm)

and the second equation is

Table 1 Position- Voltage Values Voltage (V)

(9)

The graph of the two Sharp sensors provided in the catalogue is shown in Figure 6. As seen therein, these sensors can’t measure the positions between 0 to 15cm. Table 1 below gives the sensor’s position-voltage values.

Position (cm)

This is the longest range sensor of its type and has 1,5m distance for catalogue information. But, because of surface curvature of the ball, our sensor could measure up to 30cm only in this project. So we used two analogue sensors, a 60cm beam, and a third digital sensor to find out which half of the beam the ball is on. The values measured by sensors were calculated on MS Excel graph application as position-voltage variations, which gave us fourth degree transformation equations shown below. We can see that the two sensor equations are not identical. The first sensor’s transformation equation is

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

2,14 2,07 2,05 2,01 1,98 1,94 1,92 1,89 1,86 1,83 1,80 1,77 1,74 1,70 1,67 1,63 1,61 1,57 1,56 1,54 1,52 1,50 1,48 1,46 1,45 1,44 1,43 1,42 1,41 1,40

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

1,33 1,34 1,35 1,36 1,365 1,37 1,385 1,40 1,405 1,41 1,44 1,47 1,49 1,51 1,55 1,58 1,64 1,68 1,74 1,79 1,81 1,88 1,93 1,98 2,02 2,05 2,07 2,10 2,18 2,25

Fig. 4. First Sensor’s Graph Международна научна конференция “УНИТЕХ 2013” – Габрово

III-43

Fig. 6. GP2Y0A0 Voltage-Distance Graph Fig. 7. Control Panel

By stabilizing rotation speed and input pulse rate in open-loop control systems, stepper motors ensure exact position correctness by stabilizing rotation speed and pulse frequency, i.e. input pulse rate, and by minimizing angular fault to negligible levels [5]. In this project we used Nema23 model hybrid stepper motor. Hybrid stepper motors are used for precise position control. Such motors can produce high torque particularly when they are used with bipolar drivers. [6]. This motor, has a step angle of 1,8o and is appropriate for frequencies up to 20000Hz. Our square wave frequency is 2000Hz and the driver switch is at 25600 puls/rev. position. This provides us with a resolution 128 times higher than normal in using micro stepping, thus reducing the stepping angle all the way to 0,014o. Steps fed into the motor are calculated as a function of the difference between reference and desired positions of the ball and the coefficients Kp, Kd and Ki. Steps obtained through PID calculation are fed to the motor driver approximately every 300ms. As shown in Figure 7, an LCD display with 4 lines and 20 characters has been preferred as the user interface. The reference position selected by the user, the actual position, and the coefficients Kp, Kd, Ki are displayed on the LCD. The 3rd line of LCD is reserved to display the date and time. Also integrated into the system are 4 buttons for menu operations.

III-44

The block diagram of the system is shown in Figure 8. Here, we have the sensors for the position of the ball and a potentiometer for beam’s angle, providing a control system of two closed loop. Figure 9 gives the signal flowchart of the system.

Fig. 8. Block Diagram of the System

By comparing the actual position to the reference, the system determines the direction of rotation for stepper motor and calculates the number of steps. For this, the microcontroller uses digital PID calculation. Every time the ball passes by the middle point of the beam, one sensor is turned off and the other on by the third infrared sensor integrated for that purpose specifically. The potentiometer constantly measures beam’s angle. The shaft of potentiometer is coupled with the shaft of stepper motor, thus moving together. The system stops when ball arrives at the reference position. The system starts working again in case the position of the ball changes because of outer effects.

Международна научна конференция “УНИТЕХ 2013” – Габрово

Table 4 PI Controller Experimental Results

Kp

Ki

0,2 0,2 0,2 0,4 0,4 0,4 0,6 0,6 0,6 0,8 0,8 0,8

0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9

Time (s) 30 47 91 -

Offset (cm) +2 -1 -0,5 -

Result Success Success Unstable Unstable Unstable Success Unstable Unstable Unstable Unstable Unstable Unstable

Table 5 PID Controller Experimental Results

Fig. 9. Flowchart of the System Table 2 System Parameters

Kp

Time (s)

0,2 0,4 0,6 0,8

36 74 11 -

Offset (cm) +2 +1,5 +0,5 -

Result Success Success Success Unstable

Table 3 PD Controller Experimental Results

Kp

Kd 0,3

Time (s) 9

Offset (cm) +9

0,2 0,2

0,6

22

+9

0,2 0,4 0,4 0,4 0,6 0,6 0,6 0,8 0,8 0,8

0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9

30 15 5 51 118 77 107

-1,5 0 -0,5 -2 -1 +0,5 +0,5

Result Big Steadystate Error Big Steadystate Error Success Success Success Unstable Success Delayed Unstable Unstable Success Delayed

Kp

Kd

Ki

Time (s)

0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,4 0,6 0,6 0,6 0,6 0,6 0,6 0,6 0,6 0,6 0,8 0,8

0,3 0,3 0,3 0,6 0,6 0,6 0,9 0,9 0,9 0,3 0,3 0,3 0,6 0,6 0,6 0,9 0,9 0,9 0,3 0,3 0,3 0,6 0,6 0,6 0,9 0,9 0,9 0,3 0,3

0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6 0,9 0,3 0,6

11 44 9 27 37 20 15 25 29 31 59 88 40 52 30 -

Международна научна конференция “УНИТЕХ 2013” – Габрово

Offset (cm) +1 0 -2 +1 -0,5 0 0 0 +1 -0,5 -0,5 +0,5 -0,5 +0,5 +1,5 -

Result Success Success Unstable Success Success Unstable Success Unstable Success Unstable Unstable Unstable Success Success Unstable Unstable Success Unstable Success Success Success Unstable Success Unstable Success Success Unstable Unstable Unstable III-45

0,8 0,8 0,8 0,8 0,8 0,8 0,8

0,3 0,6 0,6 0,6 0,9 0,9 0,9

0,9 0,3 0,6 0,9 0,3 0,6 0,9

131 -

+0,5 -

Unstable Delayed Unstable Unstable Unstable Unstable Unstable

CONCLUSION This study presents a new model and design of Ball and Beam system for one of the most popular models of automatic control. The set developed can be used in automatic control labs. The goal of in this study is not to bring the ball to the desired position in the most optimal way, but rather to observe the effects of coefficients Kp, Kd and Ki clearly. To that end, we kept working independently from the computer and created a control panel to conduct experiments with the system easily and rapidly. Upon getting the system to work as desired, we conducted a number of experiments to observe the effects of the coefficients by increasing and decreasing them. Approximately 52% of the trials were successful, and the ball settled in a reasonable period by an appropriate steady-state error (Tables 2, 3, 4, 5). During this experiment P, PD, PI and PID controllers were tested separately. P controller was successful in 75% of the trials, but if a very large coefficient Kp is selected, the oscillations continued (Table 2). ..PD controllers succeeded in 83% of the cases, but when the proportional coefficient is increased, it failed too (Table 3). Proportional coefficient is significant for PI-controlled first order systems. This is because, when ramp input is applied, steadystate error is proportional to the amplitude of the input, but high may render the system unstable [7]. PI controller was successful in 25% of the cases, with no attempt with zero offset, and all the attempts with higher values of the proportional coefficient failed (Table 4). PID controller attempts had a success rate of 48%, 25% of which had zero offset (Table 5). PD controller structure came out as the most

III-46

successful in practice. Given that the control signal continuous in integral controllers even with zero offset, the success of PD controllers can be attributed to the lack of an integral controller in its structure. In future studies, different controller structures should be tested on this experiment set. Due to the close overlap between the model developed here and the conditions in aviation and spacecraft trajectory tracking steps, further research on this system could contribute to the future developments in the field.

REFERENCE [1] E. P. Dadios, R. Baylon, R. D. Guzman, A. Florentino, R. M. Lee ve Z. Zulueta, Vision Guided Ball-Beam Balancing System Using Fuzzy Logic, 26th Annual Conference of the IEEE Industrial Electronics Society, Cilt 3, pp. 1973-1978, 2000. [2] J. Whelan ve J. W. Ringwood, A Demonstration Rig for Control Systems Based on the Ball and Beam with Vision Feedback, Proc.3rd IFAC Symposium on Control Education, Tokyo, 1994. [3] S. Sridharan ve G. Sridharan, Ball and Beam on Roller: A New Control Labrotary Device, Proceedings of the 2002 IEEE International Symposium on Industrial Electronics, Cilt 4, pp. 1318-1321, 2002. [4] T. Tez, Manyetik Askı Sisteminde Kullanılan Kontrol Algoritmalarının Deneysel ve Teorik Araştırılması, Master Thesis, Trakya Uni. Inst. of Science, p. 64., Edirne, 2011, [5] Quin Tep;Tamagawa Seiki Co., Ltd., 5 Phase Step Motor and Driver, Motro Compo, No. T12-1596N2, 1989. [6] D. Uygun, Hibrit Adım Motorunun Sayısal Kontrolü, Master Thesis, Marmara Uni. Inst.of Science, İstanbul, 2006. [7] H. N. Hurma, PID Kontrolör ve PLC Uygulaması, Master Thesis, İstanbul Technical Uni. Inst. of Science, pp. 1130,İistanbul, 1998.

Международна научна конференция “УНИТЕХ 2013” – Габрово