Professional Documents
Culture Documents
myBall&Beam
myBall & Beam is my take on a classical control system using the myRIO as the basis of the
controller. Ball balancing systems are commonly found in universities labs, as an engaging
tool to teach fundamental control theory to students. This type of system is an example of an
open loop unstable system which is a common control problem in industry. myBall & Beam
has been designed to allow people to have practical experience with a real-world control
system and to show how this can be implemented using LabVIEW.
myBall & Beam works by controling the position of an ball on a beam by using an IR sensor
to continuiously detect the ball's current position and a servo to control the tilt of the beam.
This information is analysed on the myRIO's embedded processor and an appropriate
control algorithm is run to provide feedback to the system. myBall & Beam has been
programmed to run a PID (proportional integral derivative) algorithm to provide feedback
to the system. PID is a common control algorithm used in industry that works well for single
input single output systems (SISO). Of course, control software (develoepd in LabVIEW)
could be easily modified to impliment more advanced control stragegies such as LQR if
required.
The software has been designed to allow the user to set the desired position of the ball (the
set-point) and to dynamically adjust the PID control parameters. The ability to experiment
with the control values on-the-fly brings learning control theory to life.
Figure 3: A clean user interface enables simple interactions with the control system
Additionally, the system has developed to be scalable to allow users to add their own control
algorithms and see their effects on an actual system. The control algorithm and calibration
VI's run on the myRIO and are interfaced with a host PC to change their parameters.
The overall design also includes a custom PCB to filter the signals and to power the myRIO,
servo and IR sensor. The circuit was designed using Multisim and was exported to Ultiboard
to design the PCB. THe aim of using a PCB for this system was for ease of use.
The software was developed using LabVIEW's prebuilt library of control functions. This was
suplimented by some custom functionality, which performs easing on the servo motor to
facilitate smoother motion.
The myBall & Beam source code (including the host UI and the myRIO control application)
is attached at the bottom of the page.
Figure 6: Block Diagram of PID Controller (running on the myRIO embedded processor)
The myBall & Beam circuit files (including the multisim circuit design and the
ultiboard files ready for fabrication) are attached at the bottom of the page.
The myBall & Beam CAD files are attached at the bottom of the page.
The system has been programmed to be easy to use so to run the program. As such it uses
a RT Startup exe on the myRIO and an executable on the host PC. To run the program,
please follow the following steps:
Skip to step 3 if you have previously set the RT Startup exe to run as startup.
1. Connect the myRIO to your host PC and open myBall & Beam.lvproj.
2. Expand the RT target (myRIO-1900) > Build Secifications > Right click on My Real-Time Application and
select Run as Startup.
3. Run the host executble from Ball & Beam Code 2013 > builds > Ball&Beam.exe or by right clicking the
Ball&Beam.exe within the Project Explorer and selecting Run.
From the User Interface of the executable, select the program you want to run. The options include the
following:
Test Servo.
Test IR sensor.
Run ball and beam control system.
Requirements
Software
LabVIEW 2013 for myRIO Module, LabVIEW 2013 PID and Fuzzy Logic Toolkit, Circuit
Design Suite (Multisim & Ultiboard)
Hardware
myRIO 1900, Hitec HS-225 BB Mighty Min HT, Sharp GP2Y0A41SK0F IR Range
sensor
Additional Resources
Learn more about LabVIEW - ni.com/labview
Learn more about myRIO - ni.com/myrio
Evaluate myRIO: Request an evaluation unit - ni.com/myrio/evaluate