Ball and Beam Control System By Robert Tran Darius Ganzie Instructor: Gary Todd Table of Contents 1. Abstract .................................................................................................................................... 3 2. Introduction ............................................................................................................................. 3 3. Problem Description ................................................................................................................ 4 4. System Requirements .............................................................................................................. 5 5. Ball & Beam Control Theory .................................................................................................. 5 6. Ball Position Sensing ............................................................................................................... 5 Linear Potentiometer ................................................................................................................... 6 7. System Design ......................................................................................................................... 7 8. Performance ............................................................................................................................. 8 8. Conclusion ............................................................................................................................... 9 10. Billings of Materials ................................................................................................................. 9 Page 2 1. Abstract The ball and beam system is a very simple and powerful control system problem. The easy construction of this system combined with its challenging control design requirement makes it one of the most favorable example models for control engineers. The model contains a horizontal beam which can pivot about one end; a servo motor whose shaft is connected to the other end of the beam; and a ball that can freely roll on top of the beam. 2. Introduction The ultimate goal of this project is to develop a control system and create the supporting software for the ball and beam control system. In this project, a ball is free to roll along the track of a beam. A linear sensor on the beam continuously detects the ball position. The control problem involves moving the ball from one position on the track to another by controlling the beam angle. The control system is implemented using a computer interfaced to the ball and beam system via a data acquisition card. Computer inputs are obtained from the voltage signals proportional to the ball position. The computer output voltage controls the motor that changes the beam angle. The block diagram below illustrates the flow of data for the ball and beam experiment. Outputs Servo Signal A to D Computer & Control Software (LabVIEW) Inputs Ball Position D to A IN ElVIS DAQ Card Page 3 Ball & Beam Experiment 3. Problem Description The ball and beam apparatus is a simple system where a beam is tilted back and forth to control the position of a ball at a desired position, as shown in the figure 1. The ball will accelerate along the beam at a rate that is proportional to the beam angle. This system is an unstable system because for a constant beam angle the ball does not stabilize at any fixed position. At constant beam angle the ball moves at a constant acceleration until it reaches the end of the beam. The ball position sensor is a linear potentiometer which consists of one resistive rod and one copper rod. The functions of the two rods are to support and determine the position of the ball. A constant 5 volts DC power supply is applied across the resistive rod. As the ball rolls along the beam, a voltage signal in the range 0 to 5 V is fed into the analog input of the DAQ card. This input signal is internally conditioned using the PID control in LabVIEW. The output from the PID control is modulated using the pulse width modulation circuit to change the servo motor’s angle. With conditioning, the generated output signal is proportional to the ball position on the beam. The major control objective is to position the ball anywhere along the beam. This is a difficult problem because the only actuator available is the beam itself and its rotation. Moreover, this is a nonlinear and unstable system. Figure 1 Ball Ball Position Motor Beam Angle Page 4 4. System Requirements 1. The LabVIEW software must have a PID.vi control library 2. Data Acquisition Cards 3. Servo motor 4. Linear transducer 5. 5 Volts power supply 6. All other software implementation must be low maintenance. 7. Data must be acquired in at least 10 ms intervals because the ball and beam system's dynamics have a time constant in the order of 1 ms. 5. Ball & Beam Control Theory This section will present an overview of the control strategy to be used, describe the ball and beam model, and discuss controller design. The ball and beam system consists of a servo motor driven beam with a ball free to roll on the beam. Manipulating the beam angle controls the ball position. Since the ball position is measured using a linear potentiometer and the servo motor drive input controls the rate of change (velocity) of the beam angle, it is sensible to place the beam angle control loop around the motor and drive amplifier. In other words, it is necessary to first construct a motor angle controller that can position the motor shaft and beam at any angle required by the ball position controller. 6. Ball Position Sensing The ball position sensor was one of the most difficult problems in the construction of the Ball and Beam system. The accurate ball position is critical in controlling the position of the ball. Several different linear sensors have been investigated such as linear potentiometer, infrared Page 5 distance sensor, magnetic sensor…etc. The ball position sensor should produce an output linearly proportional to the ball position with a bandwidth of at least 100 Hz and very little noise. 1. Linear Potentiometer The main difficulty in constructing a linear potentiometer sensor is producing a linear voltage distribution on one rail. The steel ball makes contact at some point along the powered rail and shorts that voltage to the wiper rail. Figure 4-1 shows a functional diagram of the linear potentiometer ball position sensor. The ball rolls between two rails shown in the figure. The powered rail has a high resistance and is powered to create a linear voltage distribution along its length. The ball acts as the wiper of a potentiometer. The voltage on the wiper rail is proportional to the ball position. The resistive side of the rail was constructed by wrapping 26 gauge nickel-chromium wires around a plastic threaded rod. The threaded rod insures consistent wire spacing but increases the space between windings, resulting in a more linear, but smaller resistance. The total resistance was measured to be 80 Ohms over 24 inches rail. The wiper rail is a brass tube which makes good electrical contact with the rolling ball. A current source was connected through the track which produced a voltage distribution which followed V = IR. A constant current supply with the magnitude of 100 mA was used to produce a distribution of 8 volts across the 2 foot track. The experimental version of this sensor is shown in Figure 4-2. Page 6 7. System Design A general system block diagram of the computer control is given below: A to D CPU Control Experiment D to A The computer will retrieve actual readings from the control experiment via the analog to digital converter on the data acquisition card. The LabVIEW software will process these readings and a control voltage will be generated and sent to the analog to digital converter. This generated voltage will in turn be sent to the ball and beam apparatus. Software: All of the software developed for this project will be coded in LabVIEW. Data Acquisition: In order to retrieve information from the various experiments, a NI ELVIS DAQ card will be utilized. Also, in order to plug into the various channels on the computer interface a STP-68 screw terminal panel will be used connected by a CAB-305 cable. Algorithms: In the LabVIEW software design a PID controller algorithm will be used. The following flow chart outlines the algorithm of how the closed loop control would be implemented on a computer. Initialize D/A and A/D converters Page 7 Set Reference Ball Position Measure Ball Position Calculate Position Error (SP-PV) Generate Reference Angle Write control voltage to the motor Measure Beam Angle Calculate Angle Error Generate Control Signal 8. Performance After some fine-tuning of the PID loop gains, the demonstration system successfully stabilized the ball on the beam within 2 minutes. The system was able to bring the ball to a complete stop and successfully held the ball on various points along the beam. Figure XX shows the ball position response to a square wave driving signal. The signals displayed are the driving signal from the function generator and the output of the ball position sensor. The x-axis divisions are XX seconds per division and the y-axis divisions are YY volts per division. Figure xx Page 8 8. Conclusion The ball-on-beam system is useful for demonstrating the benefits of basic control methods and for demonstrating the effect of delay in a feedback control system. The students can see control theory in action through this project. It is an inexpensive educational tool for teaching systems and controls and for showing the value of controls education. It is also a good project for embedded control because its design and implementation involve all the basic components of an embedded control system and is simple enough to be constructed in one semester. 10. Billings of Materials Item Frame Linkages Motor Beam Ball Beam Shaft Linear Resistive Rod Nichrome Wire Quality 1 2 1 1 1 1 1 100 feet Description Aluminum Aluminum stdhwr Wrhwq4 6hw nsr ¼ in steel tube 24 in #10-32 Nylon Threaded Rod 26 gauge, 2.46 Ohms per foot 11. Team Organization LabView Programming Robert Tran – Electrical/Electronic Engineering Technology - Senior Project Hardware Construction Robert Tran - Electrical/Electronic Engineering Technology - Senior Darius Ganzie - Electrical/Electronic Engineering Technology - Senior PID Tuning Page 9 Robert Tran - Electrical/Electronic Engineering Technology - Senior Darius Ganzie - Electrical/Electronic Engineering Technology - Senior Page 10