Design of A Portable Levitating Ball PID Control T
Design of A Portable Levitating Ball PID Control T
Design of A Portable Levitating Ball PID Control T
net/publication/354036617
Design of a Portable Levitating Ball PID Control Trainer System and Curriculum
for Electrical Engineering Technology Students
CITATIONS READS
0 61
4 authors, including:
Nathir A Rawashdeh
Michigan Technological University
54 PUBLICATIONS 159 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
Gentle Electromagnetic Pump for Fluids with Stress-Sensitive Microparticles View project
All content following this page was uploaded by Nathir A Rawashdeh on 18 April 2022.
Nathir Ahmad Rawashdeh joined the College of Computing and Department of Applied Computing fac-
ulty in August 2019. Prior to this appointment, he was an associate professor in the Mechatronics Engi-
neering Department at the German Jordanian University, where he spent 10 years. He served as the Acting
Vice Dean of the School of Applied Technical Science, the Chair of the Department of Mechatronics En-
gineering, and the academic Exchange Coordinator with German partner universities. He spent two years
as a Senior Software Engineer, in the laser division’s Color Science and Imaging Department, at Lexmark
International, Inc. in Lexington, Kentucky. Between 2000 and 2003, he was with The MathWorks, Inc. in
Natick, Massachusetts working on software quality engineering for embedded DSP programming using
MATLAB and Simulink. He has experience with European Union funded projects and served on several
organizing and review committees. He is fluent in English, German and Arabic. His interests include
unmanned ground vehicles, electromobility, robotics, image analysis, and color science. Dr. Rawashdeh
is a Senior Member of the IEEE.
American
c Society for Engineering Education, 2021
Design of a Portable Levitating Ball PID Control Trainer
System and Curriculum for Electrical Engineering
Technology Students
Abstract
This paper details the design of a levitating ball portable training system for in-depth learning of
Proportional Integral Derivative (PID) control theory. This system can be incorporated into the
Electrical Engineering Technology bachelor degree curriculum laboratories at our university.
Based on the prevalence of PID control applications in industry, and it being a relatively
advanced concept in traditional, theory heavy, control system courses, it is important to address
this topic with a practical system. This has inspired the idea of designing a PID training lab
course for the department. Focusing on analog circuits and programmable logic controllers, this
lab course would give an in-depth look at the physical layout of the PID control system and how
it operates. The laboratory procedures themselves include a physical demonstration of the
software implementation of the PID calculation, with access to manipulate the code. PID tuning
and understanding how gains at each stage affect the overall outcome of the control system
response will be the highlights of the laboratory procedures. The overall layout of the design of
this training lab could function as a framework curriculum, meaning that it could be used at other
learning institutions other than our university. There are 3 existing courses within the Electrical
Engineering Technology (EET) bachelor curriculum that have the flexibility to implement this
form of training. This project looks to aid the preparation of future undergraduates interested in
automatic control implementations.
Introduction
PID control is an integral component of industrial automation [1, 2]. It is used to automatically
control process variables such as temperature, liquid level, pressure, flow rates, etc. Although
programmable logic controllers (PLCs) have software functions for implementing PID control
using analog input and output modules, all major manufacturers offer stand-alone PID
controllers since they are easier to program, monitor and maintain [3]. This creates a need to
teach this cornerstone control calculation to university-level engineering students. The
applicability of PID in many different career fields, implies that many degree programs could
benefit from adding it to their curriculum. Mechanical Engineering, Electrical Engineering,
Chemical Engineering, Electrical Engineering Technology, Mechanical Engineering
Technology, etc. are all degrees that either already offer disciplines or courses that study the
design and use of automated control [5].
Part of the Advanced PLC laboratory at our university, the Amatrol Process Control System,
shown in Fig. 1, is used to teach programming of industrial equipment for controlling the flow
rate and level of fluids [3]. It is not concerned with the theory of PID control, rather it focuses on
the programming of industrial equipment and the application. A multitude of automatic control
laboratory education kits exists[6]. These use various applications including process,
temperature, motor speed, angle, altitude, and pressure control. These education systems are
typically expensive, application-oriented, and proprietary. This paper outlines the design of a
smaller, more easily replicable, PID demonstration unit, as well as curriculum for three short lab
experiments to interact and learn with it. This will let the PID education fit into existing courses
that cover automation control, and be more accessible to a larger number of students.
The developed trainer implements PID control of a ball’s position, i.e. the process variable, in a
vertical transparent tube, through a base mounted air fan as the actuator. The ball height is
measured, i.e. fed back, and compared to the setpoint, that is the desired ball height. The PID
gains can then be tuned to change the system time response to disturbance of the height, or
changes in the height setpoint. Figure 2 illustrates the feedback control loop of the ball height
PID control system trainer. The PID gains, Kp, Ki, and Kd, respectively, are tunable via
potentiometers by the student and their value displayed on the interactive system screen. The
disturbance to the ball height is an additive or subtractive change to the ball height induced by
restricting or increasing airflow, say by the student briefly placing their palm on top of the tube
where the air is exhausted.
Figure 2. Feedback control loop of the ball-height controller system
The PID controller’s output is used to control the fan speed through a Pulse Width Modulation
(PWM) function, and is a function of the ball height error e(t) and the PID gain, as shown in
eq.(1):
𝑡𝑡 𝑑𝑑
𝑢𝑢(𝑡𝑡) = 𝐾𝐾𝑝𝑝 × 𝑒𝑒(𝑡𝑡) + 𝐾𝐾𝐾𝐾 × ∫𝑜𝑜 𝑒𝑒(𝑡𝑡) 𝑑𝑑𝑑𝑑 + 𝐾𝐾𝐾𝐾 × 𝑒𝑒(𝑡𝑡) (1)
𝑑𝑑𝑑𝑑
The PID controller equation shows how the controller output, u(t) is a weighted sum of the
current error e(t), as well as the accumulator error, and the change in error.
Mechanical Design
The trainer device is used as an interactive visual representation of Proportional, Integral and
Derivative control schemes. A similar design was created at ETSI Informatica [7]. The ball
inside a clear tube is used to demonstrate the controls effect on the system; as the ball moves
further from the setpoint, the system will control the speed at which the fan spins, affecting the
amount of air moving through the tube, which affects the position of the ball. Gravity acts as a
constant downward force on the ball, and the fan is a variable control to create upwards force on
the ball. Holes drilled into the cap of the vertical tube are used as interactive disturbance on the
system.
The mechanical design seen in Fig. 3 was designed to fulfill the niche of this trainer device. The
vertical cylinder was made from a 2" OD x 1/8" wall acrylic tube [8] and the base for the
components and fan are constructed from 3/16” acrylic [9], which provides students with clear
observation of the process for the educational benefit. The VL53L0X sensor [10] is mounted to a
3D printed cap on the top of the tube. The cap also includes drilled holes to allow for air to exit
the chamber and simultaneously provides a manageable means to introduce outside disturbance
to the system by covering the holes. The base mount for the fan [11] and tube is used to house
the electrical components and control panel for interactive variable control. Potentiometers [12]
and double pole - double throw switches [13] provide students with variable control, and a 4 inch
display screen. Between these input and output components, the achieved design is a standalone
unit, without the need for outside equipment.
Electrical Design
The trainer deceive has several requirements. Firstly, it must sense the position, i.e. height, of the
ball in the cylinder. It must also actuate the fan through a PWM control signal, demonstrate
on/off control, and calculate a PID gain control based on variable user inputs. As an added bonus
it should be able to display important quantitative data to students in real-time, such as individual
PID gains and the position of the ball in reference to time.
A circuit was designed to handle all of these functions. In Fig. 4, an Arduino Leonardo [14]
receives an analog signal from the resistance potentiometers [12] for variable control, and
discrete signals from throw switches [13] to achieve on/off control. The Arduino also receives a
digital signal from our laser sensor [10] to identify ball position. The microcontroller also
handles the PID calculation and converts the resultant into a PWM control signal for the fan [11].
A separate Raspberry Pi Microcontroller [15] receives serial communication from the Arduino in
real time, and can plot relevant data to a screen for student observation.
Software Design
The program that was developed for the trainer utilizes different programming software across
two microcontrollers. Most importantly, the Arduino Leonardo Microcontroller board [14] is
used as the primary controller of the device, reading data from the sensor and user input
components and sending a digital control signal to the fan [11]. Figure 5 describes the general
execution of the developed code.
Figure 5. Microcontroller Program Flow Diagram
First the Arduino reads the ball’s position from the VL53L0X sensor [10] and sends that data to
the Raspberry Pi 4 4GB Model B [15] via a serial transmission. Then the Arduino reads the user
P, I and D status switches (each switch has corresponding on/off control over the corresponding
PID gain)[13]. If the switch is high, the arduino reads the analog potentiometer value [12] and
writes it into the corresponding gain value. If the switch is low, the arduino will overwrite the
existing gain to 0, removing that control (P, I or D) from the equation. Given a small P
(proportional) gain value in the calculation, the system output response is minimal, thus it is used
as an on/off control for power to the fan. After the gain for each expression has been calculated
the Arduino sends the gain values to the Raspberry Pi as well. Then the Arduino calculates the
PID sum value, and converts it to a PWM signal, which it uses to control the speed of the fan.
The Python code generated for the Raspberry Pi has one purpose, to display real time data to the
user with the Muizie Raspberry Pi 4 touchscreen. The Pi charts the Ball position in real-time
onto the displayed graph, and reads the P, I, and D gain values into the display as well. This
gives the student access to real time data that is being calculated and then the immediate control
feedback for that data.
Curriculum Design
To strengthen student understanding of PID and ensure the feasibility of the curriculum as a
supplementary work to preexisting courses, the lab was written to be split into three separate
sections. It was assumed that this lab would be taught after or during the explanation of PID in
traditional resuscitation, so students should know of PID and its importance. This lab curriculum,
then, exists to demonstrate to students some common understandings of the Fig. 5. flow diagram
of PID control, such as the importance of each calculation, developed software and PI or PD
control schemes.
The first section of the lab will introduce students to the problem and goal of the demonstration;
the ball should be at the setpoint, and the most efficient way to keep it there respectively - as
seen in Fig. 6. Students will be asked to use P alone to control the ball, and to identify its
advantages compared to on/off control. Then students will be instructed to introduce Derivative
control, and asked to demonstrate its use in the scope of the control scheme and identify
specifically what has been achieved by this calculation. The conclusion of the first section
introduces Integral control and its ability to reduce steady state error.
The third and final part of the lab section instructs students to use PI and PD. As the introduction
states in Fig. 8, students will identify strengths, drawbacks, and uses for both PI and PD by
observing firsthand the capabilities of the limited controls. Completion of this section shows that
students understand the use of P, I and D control and the benefits that each calculation brings to
the summation.
Conclusions
The developed PID trainer unit is affordable, small, and simple to use. When paired with the
proposed curriculum, the system will offer students a learning opportunity on a highly applicable
and popular control scheme. The concise nature of the trainer allows several groups of students
to have access to different units and allow them to focus on the core aspects of PID control. The
fast-paced visuals of the mechanical system, as well as the real time data from the screen, allows
for students to make several individual tests to affirm their understanding of the process. The
software is developed as part of the trainer, so students don't need to spend time learning
supplemental programming languages, and instructors can modify and fit this into several
courses without constraint issues. Further study can be done on the curriculum to improve its
performance. As students go through this program and use the trainer, professors can observe
what about the curriculum is teaching as intended and what portions are maybe missing the
mark. As changes in industry occur, the curriculum could be additionally changed to better suit
modern developments. Additionally the Arduino microcontroller could be completely replaced
with the Raspberry Pi, as the Pi has all of the necessary electrical connections and the capability
of generating a PWM signal.
References
[1] V. Saravana and R. B. Kumar, "Design and Analysis of an Intelligent PID Controller for
Sugar Industry Process," 2019 International Conference on Computational Intelligence
and Knowledge Economy (ICCIKE), Dubai, United Arab Emirates, 2019, pp. 784-789,
doi: 10.1109/ICCIKE47802.2019.9004285.
[2] W. Chen and X. Yang, "An Application of Adaptive Fuzzy PID Controller in Packing
Industry," 2007 International Conference on Machine Learning and Cybernetics, Hong
Kong, China, 2007, pp. 651-654, doi: 10.1109/ICMLC.2007.4370225.
[3] PID Controller Module, T5552-C1, Amatrol Inc., [Online]. Available: Amatrol,
https://amatrol.com/coursepage, [Accessed January 28, 2021].
[4] Learning Systems for Industry 4.0, Festo Didactic, [Online]. Available: Festo-Didactic
https://www.festo-didactic.com/int-en/learning-systems/, [Accessed March 6, 2021]
[5] E. I. Merzlikina and O. G. Prochina, "Laboratory Works on Control Theory Using
Scilab/Xcos," 2020 V International Conference on Information Technologies in
Engineering Education ( Inforino ), Moscow, Russia, 2020, pp. 1-4, doi:
10.1109/Inforino48376.2020.9111704.
[6] PID Loop Educational Tool, SAB3T, Hackaday.io, [Online] Available: Hackaday.io,
https://hackaday.io/project/, [Accessed March 6, 2021].
[7] Chacon, Jesus, Jacobo Saenz, Luis De la Torre, Jose Manuel Diaz, and Francisco
Esquembre. "Design of a low-cost air levitation system for teaching control engineering."
Sensors 17, no. 10 (2017): 2321.
[8] Wall Clear Cast Acrylic Tubing, 2" OD x 1/8", United States Plastic Corp., [Online]:
Available: USPC, https://www.usplastic.com/catalog, [Accessed March 6, 2021]
[9] Acrylic Extruded Clear Sheet, 3/16” 24”x48”, AcmePlastics, [Online] Available:
AcmePlastics.com, https://www.acmeplastics.com/acrylic-sheets, [Accessed March 6,
2021]
[10] Time of Flight Micro-LIDAR Distance Sensor, VL53L0X, Adafruit, [Online] Available:
Adafruit, https://learn.adafruit.com, [Accessed: March 6, 2021]
[11] Noctua Cooling Fan, NF-R8 1800, Noctua, [Online] Available: https://noctua.at/en/nf-r8,
[Accessed March 6 2021]
[12] Potentiometer, RK09L1140A65, Mouser Electronics [Online]. Available: Mouser
Electronics, https://www.mouser.com, [Accessed March 6, 2021]
[13] Alcoswitch Gemini A Series, Toggle Switches, 2-1825138-8, Alcoswitch, [Online]
Available: TE Connectivity, https://www.te.com/usa-en [Accessed March 6, 2021]
[14] Arduino Leonardo Micronctonroller, ATmega32u4, Arduino [Online] Available:
Arduino, https://www.alliedelec.com, [Accessed March 6, 2021]
[15] Raspberry Pi , Raspberry Pi 4, Raspberry Pi, [Online] Available: Raspberry Pi,
https://www.raspberrypi.org/products, [Accessed March 6, 2021]