Ball And Beam System Computer Science Essay


In control engineering, there is instability of elements found in the system where the output is growing without limits. Such kind of system is known as an unstable system which is generally occurred in many industrial situations such as aircraft, nuclear reactor, and power generation. The study of control problems occurred in the unstable control system is essential for control engineering learners. But, to study these problems in the laboratory, there is an inconvenient condition in which the real unstable systems are often dangerous to learners and the environment. A more recent study (Stein, 2003) had stated that the improper operation of control systems could increase a large number of dangerous conditions to the environment and human life. So, a safe, independent model is required to understand the behaviour of unstable control system.

Petric and Situm (2008) mentioned that the non-linear, unstable ball and beam system is certainly regarded as a classical laboratory equipment to study the control principles related to unstable systems and to understand some advanced applications of control methods. In fact, it is popularly applied in teaching engineering zones because the system is simply designed to be easy for understanding the control theories. The behaviour of ball and beam system mainly includes nonlinearities and uncertainties which are complex features of real control systems.

Lady using a tablet
Lady using a tablet


Essay Writers

Lady Using Tablet

Get your grade
or your money back

using our Essay Writing Service!

Essay Writing Service

Wellstead showed the relation of ball position and beam angle with the equations shown in the below. In the system, there is a force which gives acceleration to the ball in order to roll along the beam. The force (F) is gravitational force acting parallel to the beam where F= mgsinÏ´. According to the equation force = mass x acceleration, the ball and beam model becomes mgsin Ï´ = mx where m is the mass of the ball, g is the gravitational constant, Ï´ is the angle of beam and x is the ball position on the beam. As sin Ï´ is significantly equal to Ï´ in the case of small angles, the equation turns to x=gÏ´ in which the acceleration rate of the ball is proportional to the angle of the beam. It means that the ball moves throughout the beam with its constant acceleration for a fixed input beam angle. As there is no data which could point out the ball position to provide the motor for maintaining the ball position, the system output (ball position) is obviously uncertain to the input of the system (the beam angle). These conditions lead the ball and beam system to an open loop unstable system.

The expected output is that the ball would be stable at the desired position on the beam. So, the necessary task is to maintain the ball position along the beam by adjusting the beam angle. However, in practical, the process of controlling the non-linear system is quite complex due to the instability of the system where the output of the system (ball position) acts in an unstable manner. Therefore, the system requires the feedback control which could keep the ball at the desired situation by changing the beam angle for getting a stability of the system.

Different effective controllers for ball and beam system

As the ball and beam system is an open loop unstable system, it is necessary to use effectively appropriate controller design which provides great stability of ball and beam system. There are some various types of control strategies used to stabilise non-linear and unstable systems. These are: Proportional Integral Derivative (PID) control, Linear Quadratic Regulator (LQR), Robust Control, State Observer with State Feedback Control and Fuzzy Control.

Pang et al. (2011) studied a design controller of Linear Quadratic Regulator (LQR) based on the linear dynamic equations to control the stability of the ball and beam system. In their research paper, the linear model is derived and estimated to the system from the neglecting non-linearity and disturbance of noise of the ball and beam system. According to the result in Simulink of the paper, the LQR approach gives the satisfied performance to the system and the great output is obtained as the ball rolls smoothly on the beam at the desired set point. However, the problem of non-linearity of the system must be faced in the real experimental system to solve it out effectively.

Lady using a tablet
Lady using a tablet


Writing Services

Lady Using Tablet

Always on Time

Marked to Standard

Order Now

Wellstead presented that the ball and beam system can be stabilised by using a state observer on the system in a state feedback controller. The state observer is designed to provide an estimate of the internal state to the system with the measurement of the inputs and outputs using state feedback which controls the velocity of the ball and makes the ball to be stable at the desired set point. The state control feedback leads the state feedback gain to produce the required closed loop response to the reference signal. It is important to choose a suitable value for state feedback gain which would generate a moderate slow response. This will have resulted in the fact that the ball will not jump off the beam and the impact of sensor noise will be reduced.

Hussain (2012) stated that PID controller is applied to his ball and beam system to adjust the beam angle and to get a stable condition for the ball position. The ball and beam system is stabilised by providing the feedback error signal from the action of proportional integral and derivative control. Because of this, the stable result is obtained for the ball position by controlling the beam angle and tracking the ball movements. But in his paper, he added some suggestions that the fuzzy logic controller is necessarily useful to produce better result for the stability of the system because there is not a smooth response in the result obtained using conventional PID controller.

The reason to choose ball and beam system

To analyze the basics and advanced control principles, the ball and beam system is widely considered to study in the laboratory for control engineering because it is designed as a simple system to understand. It also describes the behaviour of unstable control system which has significant problems to control to be stable. The most difficult parts of control problems such as non-linear and unstable behaviour are generally happened in aerospace and related control industries, for examples, chemical process, nuclear, utility power, etc. In reality, it is utterly impracticable to deal with the problems of industrial control systems in the laboratory due to the dangerous condition and the cost. But the design of ball and beam system provides a safe, adaptable and independent performance to investigate the characteristics of uncertain control systems. It may be one of the main reasons that the ball and beam apparatus becomes obviously popular to study in the control engineering.

1.2 Aim & Objectives

The aim of the project is to understand the principles of control systems and investigate the behaviour of non-linear and unstable control systems which are typically occurred in reality and most importantly considerable part to solve. The main objective of the project is to observe systematically how the non-linear, unstable ball and beam system could be stable with the help of appropriate controller. There are also other effective objectives which would drive the project to be carried out successfully. These are: to investigate the unstable ball and beam system, to search literature reviews of current research on present methods of unstable control strategies to understand and utilize the hardware and software needed for computer control, to understand and implement a fuzzy logic controller, and to analyse feedback control systems to produce stability.

What is fuzzy logic controller?

Fuzzy logic is able to track human experience, without intensive mathematical modeling, and realize control tasks [9-10]. Fuzzy logic control could stop the ball at any position on the beam, however, fuzzy rules may be difficult and perplexing to designers, and fuzzy control has no learning ability [10].

Why fuzzy controller is better than PI controller?

Chapter 2: Ball and Beam System

2.1 The Hardware of Ball and Beam System

Ball and Beam Apparatus

A self-contained ball and beam apparatus is designed to provide opportunity to understand the behaviour of control systems especially for non-linear and unstable control systems. It composes of a beam, steel ball and electrical motor. Beam is typically horizontal and however the rotation of the beam can be an angle of +/- 10° and is made by an electrical motor which is attached to the beam and is supplied the input voltage signal. The angle of beam can be measured by a sensor called a servo potentiometer which is situated at the rear of the beam shaft. The metal ball moves on two parallel wires spread through the top of the beam. The apparatus allows one of the wires to connect with the voltage source and a fraction of the source voltage is measured at the other wire. The position of the ball is proportional to a voltage which is resulted from the voltage fraction. The motor drive signal input is supplied in the range of 0 to +10V voltage signal which makes the speed of the motor variable. The design of ball and beam apparatus can be seen in the following figure.

Lady using a tablet
Lady using a tablet

This Essay is

a Student's Work

Lady Using Tablet

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Examples of our work

Need to put the figure ball and beam apparatus

Then, the structure built inside of the apparatus will be described. There is a smaller secondary beam attached to the beam which is situated directly behind the beam. The beam is actuated by the cam motor with the action of a cam follower which is connected to the secondary shaft. It means that a specific beam angle (Ï´) is produced as an input voltage of the system in the closed loop. In the range of the beam angle +/-10°, there is a linear relationship between the motor and the beam angle. With the help of a retaining spring, the cam follower keeps remained with the cam even when there is a big change in the beam angle.

Other main hardware components of the system are beam angle transducer and ball position transducer. In any control system, a transducer or sensor is essentially applied to detect a parameter in the output of the system. So, in this case, the characteristics of two transducers for the beam angle and the ball position will be continuously explained.

The beam angle is sensed by a transducer called servo potentiometer which produces the linear relationship between the actual beam angle (Ï´) and the sensed beam angle voltage. Similarly, the transducer detected the ball position is known as the potentiometer. As it is mentioned in the above paragraph of the ball and beam apparatus, the ball is rolling on two parallel wires which is tensioned along the beam and one of the wire is connected to the voltage source while another is joined to the potentiometer to produce the voltage fraction which is directly proportional to the ball position, the output result of the system.

2.2 Mathematical Description of System

2.3 The System Modelling

Firstly, basic functions of the apparatus is tested to learn the behaviour of ball and beam system and to investigate how the transducers such as the beam angle transducer and the ball position transducers perform to the system. The action of beam angle is examined when non-zero voltage is supplied to the motor.

The ball and beam system is fed a range of power supply 0V to 10 V which are positive and negative voltages respectively. Then the next step is to connect the system providing power supply with oscilloscope for collecting data of waveform period (T) and angular velocity (ω) which are shown in the following tables.

power supply (V)

Period (T)

ω=2 πf= 2 π⁄T
































































Graph of power supply (V) and angular velocity (ω)

When the system is obtained the power supply from 0V to 2V, there is no movement of the beam. The beam is found steadily moving after providing above 2V and it is clearly to see that the higher voltages the system is supplied, the quicker the movement of the beam is. As it can obviously seen in the table, the data of period (T) for the positive power supply is the same as for the negative power supply but there is one different observation that the drive motor cam turns as oppositely when negative voltages are provided as it does clockwise when supplying positive voltages. The minus sign in the data of angular velocity (ω) shows the rotation of drive motor cam (anti-clockwise).

Figure1: The waveform of +3V power supply

Figure 2: The waveform of -3V supply

When the ball and beam system has ± 3V input, there is same value of period (T) although different kinds of waveform are obtained as it can apparently seen at figure 1 and figure 2. This is because the rotation of drive motor shaft is anti-clockwise when negative voltages input are fed.

Chapter 3: Beam Angle Controller

Figure: the control of ball and beam system

As the hardware of the ball and beam system is explained in the Chapter 2, it is already known that the system is constructed with a motor driven beam and a ball free to move on the beam. Since the pattern of controlling the ball and beam system is obviously shown in the figure, the process control of the ball position can be managed by handling the beam angle which is measured with the use of potentiometer. As the rate of change in beam angle is manipulated by the motor drive input, the control loop of beam angle position has a sensible action to be in a certain situation around the motor. Adjusting the beam angle can control the control loop of the ball position in a condition which the design of the beam angle control loop performs rapidly and accurately as much as the reference beam angle.

In order to obtain the stable ball position, it is firstly needed to consider the inner loop control affecting the motor and the beam. After that, the outer loop control of the ball position must be effectively determined. As shown in figure, the inner loop is known as the slave loop and the outer loop is called the master loop which provides the reference input for the slave loop. The method of the overall process control is defined as the cascade control.

Dead zone

As the velocity of the beam angle is directly proportional to the motor input voltage, the drive amplifier gain and the movement of the motor has been relatively influenced on the beam angle. Because of the static friction, there is a dead zone non-linear behaviour which is found in the velocity of the beam angle.

Dead zone of beam velocity in the system

A dead zone is an area of band in which the system do not have any respond with the input before this input has been at the particular level. It means that the system is dead within the dead zone and consequently, the response of the system process will be delayed. Moreover, it is formed as a kind of nonlinearity and it leads instability to the system. Dead zone must be minimised for obtaining a good control in the system.

Within the inner loop of figure, the satisfied position control is supplied to the beam angle in the condition where the beam angle velocity is controlled. The inner loop controller can also be capable of the reduction in the effect of nonlinear behaviour of the velocity of beam angle.

One kind of nonlinear behaviour, dead zone is recognized as rig which needs to be overcome using minor loop feedback called inner control loop. Rosales et. al(2006) describes in their paper that the method of feedback control by PID (proportional-integral-derivative) controller is effectively able to reduce the effect of dead zone with the use of the error signal. However, Ari et. al mentioned that the control without D mode which is PI control is fed to the system when there is noise and disturbances, for example, dead zone in the process of the system operation. To overcome dead zone, the possible solution is using PI controller and a fuzzy PI equivalent controller can also alternatively used.

As the action of integral assures that the system output accepts the reference in the steady state and the fact that the velocity of the system is proportional to the error in its orientation is stated in the law of P control, the control of PI produces the forced oscillations and steady state error which performs the operation of on off controller.

Moreover, Petrov, M. et al. stated a fact that the fuzzy PI controller can be used as a positioning type controller and the fuzzy PD controller can be used as a velocity type controller. Therefore, PI controller can be designed as an inner loop controller to monitor the beam angle because this controller is good for providing the better control in position and reducing the dead zone.

Fig: the control of PI controller to the position of beam angle

PI controller is one form of PID controller (proportional, integral and derivative) and so the equation of PI controller can be derived as in the following:

This equation for PI control can also be described in the method of Euler integration.

To make Euler approximation,

Replacing this value in the equation of u(t),

This equation is used in the matlab program which is needed for the specific controller to the system. In this case, the program is determined for PI controller by using Matlab software and is run in the Matlab to give a control to the system.

To obtain the stability of the system, it is relatively essential to find out the best value of proportional gain (Kp) and integral gain (Ki) for the system as the overshoot could be increased if proportional gain is too high and the system goes unstable if steady state error is quite large over the limit range of proportional gain. Even though the parameters of Kp and Ki can be obtained by the use of variable methods including Astrom's relay method, frequency response Ziegler-Nichols method and step test, these methods are not effective for the unstable system. A large number of testing determines the appropriate value of proportional and integral gain as Kp=0.5 and Ki=0.5 for PI controller.

Final set point

Beam angle position



















Figure: linear beam angle response with PI controller

The result of the beam angle output is recorded for different set points and the obtained data is plotted in the graph. Using PI controller, the velocity of beam angle is controlled and resulted as linear characteristic which needs for the stability of the system. As shown in the figure, the relation between the set point (the input voltage) and the output of beam angle position is found as linear. It means that the beam goes exactly to the set point with a constant error. These results prove that PI controller has a good effect to the control on the beam angle and to minimise the steady state error.

Chapter 4: Ball Position Controller

4.1. Relay feedback controller for Ball Position

An appropriate feedback controller is necessary to produce an error signal which is the difference between the measured signal and the reference signal in order to obtain the stability of the ball position and the adjustment of the beam angle. The required ball position is achieved by choosing the reference signal known as the set point of the output.

Figure: block diagram of closed loop feedback control system

From this above block diagram, the equation can be derived as error (e) = set point (sp) - output (y). According to the equation, the error will be positive if the output is less than the set point whereas the error will turn negative if the output is greater. Ideally, the system is on when the feedback is less than the set point, otherwise the system is changed to off. Therefore, it can be described as the system has the maximum value of the actual signal (u) at the positive error but it has the minimum value of u at the negative error. This type of control is called Bang Bang control known as On-Off control which operates the system on or off alternatively.

Such a relay controller known as Bang Bang controller is typically designed to give the prediction the ball position and make compensating adjustment of the beam angle with the identification of negative error or positive error. For an example, if the ball starts moving from the left hand side to the desired point which is at the right hand side, the beam will firstly move clockwise to let the ball roll to the set point and then the relay generates the signal which allows the beam turn anticlockwise after the ball has just passed through the set point to maintain the ball rolling at that point.

Figure: block diagram of bang bang relay controller for ball position

Before building the design of bang bang controller, it is needed to determine the voltage of the ball position on the beam and the voltage of the beam angle which are essential for the design of the relay controller.

Figure: the voltage of the ball position on the beam

Figure: the voltage of beam angle (Ѳ) with the ball position (x)

According to the measurement seen in the above figure, the equation for the setpoint of the ball position can be described as spx= 5+x if ex>0 or spx= 5-x if ex <0. As the fact related to the error is already explained above this section, the error (ex) is positive if the set point (sp) is greater than the ball position output (x) or negative error if the set point is less than the output.

Figure: ball position relay controller

In order to control the ball position at the required position, the result for the ball position is recorded and seen in figure when bang bang relay controller is applied to the system. The result showed that the ball is kept rolling from one end to the other on the beam passing through the set point. However it could be acceptable that the relay control is working for the ball and beam system because the beam is tilted to the opposite way for letting the ball roll at the set point by looking at the movement of the beam angle shown in the figure.

Figure: the movement of the ball and beam angle controlled by bang bang controller

But the operation of the bang bang controller gives the system an unsatified condition which could not allow the ball move around the required position. This is because this type of controller is incapable of the beam moving back to the set point and unable to control the inertia of the ball. Apparently the inertia of the ball increases the oscillation rate of the ball on the beam and thus the ball has a growth of acceleration rate every cycle. Then the obtained result will be the unstability of the system.

To overcome this problem, advanced relay controller is required to build in consideration of both the sign of error and the derivation control action which will anticipate the ball movement and will force the ball move with a uniform acceleration rate towards one end of the beam to stablise the ball position through the beam.

Proportional plus Derivation Control of the ball and beam system (PD control)

As PD control is transformed from one type of PID controller using 3 basic behavior modes such as P- proportional, I- integrative and D- derivative, PD means the combination of proportional (P) and derivative (D) action.

According to the paper of Mata and Tang (2006), with a linear control of proprotional and derivative action, PD control is avoided nonlinear compensate disturbances and hard nonlinearities by tracking a desired output to get the improvement of accuracy of the system.

D type is able to provide the prediction of the error which is the most important thing for improving control to get stability of the system. When the system has non-linear and unstablity, it could happen that there is some sudden change in the input which affects the change in the value of error signal. As a result, the control output could be changed to instablity. In such cases, the action of a controller with proportional and derivative action could be interpreted to avoid these problems because the control is made proportional to the predicted process output.

Therefore, the ball and beam system is controlled by a proportional plus derivative (PD) controller by producing the control output from the system error e and the change in error de to compensate the unstable nature of the system.

Figure: the control of proportional plus derivative (PD) to the system

In the system, a proportional controller signal is generated when the ball starts moving to a constant reference ball position with a certain velocity of the proportional controller. When Vx is larger than Vxr, this signal is changed into a negative error of the signal which is sent to the controller output. This has resulted in the reduction of the beam angle.

At that time, the derivative controller produces a correct signal which is proportional to the velocity of the ball position as the ball movements can be predicted by the derivative action. Thus, comparing with the proportional controller signal, the derivative controller signal give more effective adjustments with the beam angle.

Hence, advanced four quadratic relay controller is designed with the action of proportional plus derivative control (PD) to control the ball position. The below figure shows the design of four quadratic relay controller.

In the figure, there is the same sign in e and de at the first quadrant and third quadrant. It means that the ball is rolling to the wrong position which is away from the set point. Oppositely, the ball moves to the correct direction which is towards the set point in second quadrant and fourth quadrant. The controller produces the action of the derivative control to the reference ball position that the beam will turn to the horizontal position and let the ball to move to the set point because the ball has its own inertia. The beam will kick back again when the ball stops moving and did not reach to the set point. Effectively, the ball has the balanced position and it helps the ball moving to the required position.

Four quadratic controller with one variable input, x

In the system, there are one variable input, x where x is change in relay output about 5V (5V +/-x). the different inputs of x are applied to the system to discover the suitable value of x which give best performance made the ball be steady at the selected position.

Figure: four quadratic controller with one variable input x

The figure 1 shows that the ball rolls to the set point with a slow speed which cause the system need a certain time to reach it when x is smaller than 2V whereas frequently rapid acceleration of the ball is produced and required just a few time to the set point when x is greater than 2V which is the best value of x to allow the ball keep rolling at the desired point (5V).

Fig1: set point 5 with different x when one input x is fed to the system

When x=2, the controller leads the ball retain at a steady position. Figure 2 describes the performance of the ball along the beam on different set points. Obviously, the ball starts rolling from 10V to the selected set position and it is much quicker to reach to the set position where the ball keeps rolling if the desired point is closed to the starting point. As it can be seen in the figure 2, it takes a certain time to the set point which is significantly far away from the starting point.

Fig2: the ball position at the different set point when x=2

Fig3: the action of ball position and beam angle at the set point 5V when x=2

Four quadratic controller with two variable inputs, x and v

According to the above experiment, the input x is determined as 2V where the controller provides the steady ball position to the system.

Figure: four quadratic controller with 2 variable inputs x and v

The results will be continuously explained if there are two inputs x and v to the system (change in relay output about 5 V where 5V +/- x and 5V +/- v. As the controller is performing the required task when x=2, the next test is examined with variable values of v when x is kept constant to 2V.

Figure: the ball position at set point 5V with variable values of v when x is constant at 2V

When v=1, the ball is too free to bound along the beam and it takes quickly to move to the required position which is 5V. The system has the better condition where the ball keeps rolling at the set point with a certain acceleration rate at v=1.5. Then the value of v is increased to 3 and the result is found out that it takes so longer to force towards the set point and the ball is retained around 10V without moving to the required position. With the analysis of the result shown in figure, a quick movement of the ball to the set point causes big range of the ball bouncing through the beam when small amount of v under 1.5V is applied to the system. However, the large value of v such as 3V brings the slow result of moving to the set point which could keep the ball away from that point.

The only sensible value range for v is established that the value of v must be less than x according to the results seen in figure and figure. If the system has greater value of v than x, the controller produces a very slow motion which maintains the ball around 10V away from the set point.

Fig 4: the ball position at set point 5V with different values of x for constant V=1.5V

This figure 4 shows the fact in which the various input x affects the movement of the ball on the beam at a desired position. In order to keep the ball at the set point, the action of rolling the ball along the beam are described by changing the input x when v is fed the constant 1.5V to the system and the set point is at 5V. When x=1, the ball moves very slowly on the beam and it takes longer to let the ball reach the set point. As it can be seen in the graph, the ball keeps moving around 9V and 10V instead of going to the desired set point (5V). Next, when the input x is changed to 2V, the controller allows the beam balance at horizontal position (5V) so that the ball rolls steadily to the set point and keeps moving around the set point after it has reached to the desired position. Then, if x=3, the ball can be seen bouncing faster to the set point rather than when x=1 or x=2. Increasing the bouncing speed of the ball causes the ball roll passing over the set point and the beam is tilting to the other direction to let the ball kick back to the set point. Similarly, the ball moves with a much faster speed which forces the ball bounce quickly to 4V to 7V and keep rolling 2V to 9V even though the desired set point is 5 when x=4. According to the testing results, small value of x which is under 2V produces a slow acceleration of rolling the ball which is insufficient to get the set point. However, the swift motion of ball is created by greater x to jump to the desired position but the rate of bouncing ball is much higher around the set point. Comparing to all results, the ball keep rolling at the stable position (5V) when x=2 and v=1.5. This is the best result so far which can be seen in the below figure 5.

Fig5: set point 5V when x=2 and v=1.5

As a result, comparing to figure 3 and figure 5,the behaviour of ball position and beam angle is the same when only one variable input x is provided to the system as much as when there is two variable inputs x and v. Even though all of the experiment results are proved that the PD feedback controller has an ability to attain the ball at the steady state, this controller could not produce a smooth response of the ball in the system. Hence, a better smooth result may be obtained with the artificial aids of fuzzy logic controller.

Chapter 5: Fuzzy Logic Controller

Amjad et al. (2010) described the comparison between Fuzzy Logic Controller and PID controller and mentioned that fuzzy controller provides a better function in non linear control processes and complex systems rather than the conventional PID controller as fuzzy control could produce less overshoot and zero steady state error. If PID controller is used in the system, the model of the system is necessary to improve an algorithm of the controller and to investigate the limitation of the controller. On the other hand, complicated mathematic equations or the model of the system are not needed if using fuzzy control in which there are a small number of rules which may need to show various conventional software code for the description of the system. An obvious advantage of this is less complexity to the design.

Emhemed (2013) explained about the artificial intelligence of fuzzy controller. Artificial intelligence means the development of machines and robots by giving human knowledge to work out the complex problems happened in the real world. Fuzzy logic is applied to many engineering field by the contribution of control theory to artificial intelligence. Based on the fuzzy set rules, fuzzy logic controller is designed to control the system with the human knowledge (If-Then laws) using uncertainty and suitable information which produces the effective decision and best solution for the occurred problems. Hence, fuzzy logic control is absolutely useful for non-linear control systems that are too complex to make decision and solve the problems in the use of human intelligence due to the more accuracy to control action and the simplified design.

Chapter 6: Conclusion