Next Article in Journal
A Black Start Recovery Strategy for a PV-Based Energy Storage Microgrid, Considering the State of Charge of Energy Storage
Previous Article in Journal
A Review of Battery Electric Public Transport Timetabling and Scheduling: A 10 Year Retrospective and New Developments
Previous Article in Special Issue
Measuring Model Parameter Setting Errors’ Effects in the Control of an Order 4 Underactuated System
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Compensator with Weighted Input Parameters for Automatic Ball-Balancing Mechatronic System

Institute of Automotive Mechatronics, Faculty of Electrical Engineering and Information Technology, Slovak University of Technology in Bratislava, Ilkovičova 3, 841 04 Bratislava, Slovakia
*
Author to whom correspondence should be addressed.
Electronics 2025, 14(9), 1695; https://doi.org/10.3390/electronics14091695
Submission received: 7 March 2025 / Revised: 18 April 2025 / Accepted: 21 April 2025 / Published: 22 April 2025

Abstract

:
This paper presents an Automatic Ball-Balancing Mechatronic System (ABMS) with a lever transmission, which provides higher positioning accuracy for the ball. The system was identified by a double integrator, and the results confirmed the suitability of the chosen mathematical model. Then, we designed and tested a new compensator with weighted input parameters, which was firstly successfully implemented in real time on a microprocessor platform. Both simulation and then also experimental results demonstrated that the proposed controller provides stable and accurate control of the system under various step changes in the input signal.

1. Introduction

The “ball and beam” system represents a class of nonlinear systems and serves as a typical academic example for illustrating various real-world problems and practical applications. One such application is the stabilization of cameras on drones or other platforms, where the camera must track a target and maintain its position despite platform movement or external disturbances. Similarly, the stabilization of mirrors in optical telescopes or platforms in weapon systems follows the same control principles. Stabilized platforms on ships and aircraft also commonly employ similar control strategies, wherein an object must be precisely positioned and maintained at a specified location.
Controlling the ball and beam system is not a trivial task. Without considering friction, the ball moves freely due to gravity and cannot maintain a stable position without controller intervention. Traditional approaches such as PID controllers or state feedback often fail to achieve optimal results when system parameters change or external disturbances occur.
The ball and beam system belongs to the class of underactuated systems; i.e., it is not possible to directly control the movement of the ball but only to adjust the tilt of the beam. To address this limitation, more sophisticated control algorithms are usually used. A review of the literature offers insight into various control strategies developed for such systems.
The system can be controlled by an adaptive controller [1] or fractional order PD controller [2]. Another way to control the system is by using the underactuated back-stepping method [3], or λ -method matching control law, which was shown in [4]. Another paper [5] suggests using an advanced velocity observer-based self-tuning stabilizing controller. A tracking controller based on the approximate input–output linearization was introduced in [6]. A sliding mode controller was derived in [7,8]. Other authors developed a nonlinear active disturbance rejection control using a predictive nonlinear extended state observer [9]. Based on the energy approach and the passivity properties of the system, Lyapunov function candidates were defined in [10], and a passivity-based control approach was also used in [11].
Apart from these analytical controllers, there is also a category of advanced intelligent control methods that utilize artificial intelligence and learning to improve control performance. This category includes controllers that make use of fuzzy logic, neural networks, and machine learning techniques.
In practical applications of ball and beam systems, a variety of controller designs have been implemented. Among the most relevant examples are a fuzzy PID controller [12], simplified fuzzy controller [13], adaptive fuzzy sliding mode controller [14], and fuzzy fractional order PID controller, which were tuned via the particle swarm optimization algorithm [15].
Another approach was shown in [16] where the authors introduced the detail-reward function in the deep reinforcement learning algorithm.
Finally, let us also mention an example of a PID controller whose parameters are determined using three optimization algorithms: genetic algorithm, particle swarm optimization, and differential evolution [17].
This paper presents a novel compensator with weighted input parameters that enables more precise ball and beam control. The goal is to propose a straightforward design procedure that, based on a simple and relatively imprecise experimental identification of the device dynamics (using a double integrator), ensures that the system output follows the desired prescribed behavior. The whole procedure consists of only three steps that can also be replicated for other systems. The algorithm is validated on a newly developed modular device that is distinguished by its adaptability, ease of reproduction, and flexibility in selecting the actuator and microprocessor based on user preferences.
The following sections of the paper first present various structural solutions for the system (Section 2), which were followed by the implementation of the developed Automatic Ball-Balancing Mechatronic System (Section 3), which required system identification to obtain a mathematical model (Section 4). Then, the design and implementation of the proposed compensator are described (Section 5). The final section presents the results of simulations and experiments.

2. Alternative Design Solutions for the System

The ball and beam system can be implemented through several approaches. The specific design attributes of each implementation differ in two main characteristics: the position of the pivot joint responsible for the arm tilting and the actuator point of action, which inclines the arm out of its horizontal alignment. Typically, the system allows two primary mounting configurations of the swing arm with possible adjustments for further needs.
In the initial configuration, the pivot joint is positioned at the center of the arm, and the actuator applies action directly at this location, enabling straightforward mechanical operation (Figure 1). This design is distinguished by its straightforward implementation, which was primarily attributed to a decrease in the number of components required. The accuracy of the arm’s angular movement is fundamentally dependent on the actuator’s ability to achieve precise rotational steps. This particular configuration has been empirically verified through earlier studies, as highlighted in the research conducted by Wang in 2007 [18], by Lieberman in 2004 [19], and by Hirsch in 1998 [20].
The enhancement of tilt precision, with only slight changes in design, is achievable by altering the primary configuration using diverse transmission configurations. The first possible option is the use of a simple friction drive using smooth wheels at the arm pivot point (Figure 2). This type of transmission mechanism causes the arm to tilt in the opposite direction of the actuator action. Since smooth wheel transmissions can result in undesirable slippage, a suitable solution to this issue is the use of spur gears. Such a system configuration approach was described, e.g., by Rosales (2004) [21] or Ito (2004) [22].
Another alternative to the previous configuration is the use of a belt or a chain drive (Figure 3). The larger pulley, permanently connected to the arm, is driven by the smaller pulley, which is attached to the actuator output. This type of transmission ensures that the arm inclines in the same direction as the action of the actuator. Furthermore, the use of gears in a belt or chain drive configuration significantly reduces the potential risk of unwanted belt slippage. Implementations of these concepts are used in the Amira BW500 [23] and TecQuipment CE106 [24] commercial ball and beam systems. Their practical application has been described, e.g., by Chien et al. (2010) [25], Colón et al. (2013) [26] or Kagami et al. (2020) [27].
The second possible configuration is to attach one end of the arm to a support structure using a pivot joint. The other end of the arm is coupled to the actuator output via mechanical linkage (Figure 4). This setup is more complex by design, as it requires more additional components and supplies. A key benefit of the described configuration is increased flexibility concerning the arm tilt range, which can be further adjusted by moving the linkage action point on the arm or altering the linkage component lengths. In general practice, the second configuration is most commonly used, especially in commercial solutions, such as Quanser [28], RYC-BB [29] or GBB1004 [30] as utilized in the studies conducted by Al-Dujaili et al. (2021) [31] as well as Yongun, Seok-Kyoon, and Choon (2021) [32]. A similar approach, based on the described configuration, can be found in proprietary, custom, or academic construction solutions of the ball and beam system, e.g., Nowoposki (2013) [33], Awadalla et al. (2017) [34], Hadipour et al. (2021) [35], and Versloot et al. (2020) [36].
Modification of the second configuration by displacing the pivot point to the center of the arm provides a greater range of arm tilt angle while preserving its initial length without the need to modify the linkage mechanism (Figure 5). This design is particularly convenient for actuators with a limited range of output shaft rotation or for the installation of the lever mechanism in tight conditions. A possible drawback of this configuration may occur when less precise actuators are used, resulting in the inaccurate setting of the arm tilt angle. This setup is implemented in commercial solutions like Acrome [37] and GBB2004 [30] systems with practical implementation proposed by Bao et al. (2021) [8].
Looking back at the presented configurations, it is possible to classify them according to two major groups: in the first case, the actuator is situated in the middle of the arm and acts directly at the pivot point, and in the second case, the actuator is offset to the side and acts on the arm via a linkage transmission. The first implementation is structurally more straightforward as it involves fewer mechanical components. In addition, the ball behaves symmetrically on both sides of the pivot point, which makes it easier to model the entire system. Although the second design is more complex to build, it enhances the beam positioning precision, thereby increasing the accuracy of ball position control. Moreover, the lever linkage mechanism enables the utilization of more compact actuators and minimizes the deterioration of motor gears, thereby prolonging their operational life.
We designed and constructed a custom system based on the second configuration, implementing a lever-linkage actuator mechanism. We decided to adopt a modular approach to the system’s architecture to enable easy modification. This approach allows for multiple system configurations, utilizing different actuators, sensors, and control units, thereby enhancing both the evaluation process and the broader applicability of the device in educational environments.

3. Automatic Ball-Balancing Mechatronic System

The Automatic Ball-Balancing Mechatronic System (ABMS) is an experimental platform that is being developed for educational purposes, enabling users to test and validate control algorithms for a selected class of nonlinear systems. The system is designed to be compact, portable, and robust enough to perform various experiments.
The central component of the system is the beam, which is composed of two smooth aluminium profiles on which a stainless steel ball rolls (Figure 6). Figure 6b shows a detailed cross-section of the beam. One of the aluminium profiles is embedded in a plastic casing, which enables the attachment of a pressure-activated position sensor. The arm profiles are capped with a pivot joint mechanism that incorporates two ball bearings on one side, ensuring smooth movement of the arm in the vertical plane. The opposite end of the arm is connected to the actuator output via a linkage mechanism. The system frame components are manufactured using a 3D printer with the FFF (Fused Filament Fabrication) method. These components are made from a strong, lightweight material that ensures the stability of the device while minimizing the overall weight. The components are assembled and fastened with metal screws, facilitating the easy swapping or replacement of individual parts.
From a functional point of view, the ABMS system is composed of three main parts: the control unit, the ball position sensors, and the actuator.
The control unit is responsible for communication with the sensors, processing the acquired data, and controlling the actuator. The platform is designed to be compatible with the Arduino Due and STM32 Nucleo64 development boards, both of which use 32-bit ARM processors. Specifically, the Arduino Due features a SAM3X8E ARM Cortex-M3 processor, while the STM32 Nucleo64 is equipped with an ARM Cortex-M4 processor. The ability to choose between development boards allows customization of the system to meet different needs. The Arduino platform offers an easy-to-use interface and broad community support, while the STM32 provides higher performance and more flexible configuration options, making it suitable for professional applications.
The system can utilize two independent position sensing methods to accurately determine the position of the ball. The primary method is direct contact detection, in which the rolling ball applies pressure to a Spectra Symbol ThinPot membrane potentiometer mounted on one of the aluminium profiles (see the blue section in Figure 6b). This potentiometer acts as a voltage divider with the ball’s position determined by the voltage difference across the potentiometer terminals. The ball, with a diameter of 36.4 mm and a weight of 0.2 kg, applies sufficient pressure to the diaphragm, allowing accurate and reliable measurements. However, a limitation of this method is that the ball is pushed into the diaphragm, resulting in insensitivity due to dry friction. The effect of dry friction must be addressed when designing the system controller.
The second method for determining the ball’s position is non-contact measurement using the ST VL53L1X laser sensor, which is mounted at the end of the arm near the pivot joint. This sensor employs the time-of-flight (ToF) technology to measure the distance between the ball and the sensor. The use of redundant sensors enhances system reliability and allows for comparison of the performance of different sensing methods.
However, discrepancies in the measurement between a touch potentiometer and a laser time-of-flight sensor must be accounted for. The potentiometer determines the position of the center of the ball, whereas the laser sensor measures the distance, which includes the radius of the ball. As a result, the zero positions of the two sensors are different, which requires necessary software or hardware compensation. Additionally, it should be noted that the used laser sensor has a minimum detectable measurement threshold of 4 cm. We were able to mitigate this limitation by appropriately positioning the sensor at a sufficient distance from the possible ball positions (Figure 6).
The actuator of the system consists of a single servomotor that controls the tilt of the arm, thereby influencing the movement of the ball. During development, we tested several structural options using both digital and analogue servomotors. The digital servomotors considered, such as the Waveshare ST3020 or SC15, offer higher torque and more precise control but require an additional proprietary UART converter for communication. In contrast, analogue PWM-controlled servos, such as the Waveshare MG996R or JX RD-5622-MG, are easier to integrate and do not require an additional interface for control.
The ABMS device design is based on a modular architecture approach in terms of its functional components. The assembly, composed of separate 3D-printable parts, supports the integration of various types of servomotors and control units. Multiple mounting components have been developed to enable a straightforward interchangeability of both servomotors and control units. This significantly enhances the system’s adaptability for diverse experimental setups and ensures compatibility with a wide range of platforms. Currently, two functional prototypes of the system are in use, supporting ongoing development of hardware components, the software package, and testing of the complete ABMS platform solution.
The configuration used for the results presented in this publication consists of an Arduino Due microcontroller, a Spectra Symbol ThinPot 200 mm potentiometer, a JX RD-5622-180-MG servomotor, and a smooth steel ball with a diameter of 36.4 mm. The device that was used in this configuration for the purposes of this publication is shown in Figure 6a. The microcontroller can be found beneath the casing that supports the installation of the swing arm. Components for mounting a DC motor with a gearbox and a counterweight arm to offload the actuator’s action are currently under development.
The used servomotor has an operating range of the output shaft in the span from −90° to +90°. In the context of the ABMS system, only a partial segment of this range is used for the arm tilting movement. Utilizing a servomotor with a reduced output shaft rotation range, e.g., (−30°, +30°) can improve the precision of the arm’s inclination while maintaining equivalent input signal resolution. An illustrative example demonstrating how the pulse width of the input signal impacts servomotor rotation is provided in [38].
The system’s control and data acquisition are facilitated by a serial communication interface utilizing a standard USB connection. The interaction is achieved using a custom communication protocol based on ASCII-encoded text messages. This protocol provides instructions for the operation and control of the actuators as well as for transmitting sensor data between the system and a computer.
To control the inclination of the arm, the system can receive messages that determine the position of the servomotor. These messages contain information about the desired rotation of the actuator’s output relative to the arm’s horizontal position. The user can accurately manipulate both the direction and the rotation angle. The movement of the arm takes place within a predefined range, allowing the position of the steel ball to be adjusted. The system’s algorithm incorporates a safeguard that limits the actuator’s maximum rotational increment, thereby protecting both the components and the overall structure from inadvertent tampering and potential damage.
The ABMS system also provides output feedback messages containing information about the actual position of the ball and the rotation of the servomotor. This allows the user to monitor the system’s behavior in real time. More details on the format of the messages can be found in [39].

4. System Identification

In several publications dedicated to the control of the beam and ball system, the mathematical model is derived based on Newton’s second law or Lagrange equations, considering the real physical characteristics of the device and the ball [40,41].
The mathematical model is often represented as a double integrator (see, e.g., [2,5,42,43,44])
S 1 ( s ) = K s ( T s s ) 2 = Y M ( s ) U P W M ( s )
to which the dynamics of the servomechanism approximated by a first-order system is added (in some cases, e.g., [45])
S 2 ( s ) = K s ( T s s ) 2 ( T M s + 1 )
The time constant T M can be replaced by a dead time [46]
S 3 ( s ) = K s e s D ( T s s ) 2
However, the dead time is also influenced by the A/D converter, the measurement filter, dry friction, and the implementation of calculations in the control structure.
Our system consists of a servosystem [47], which receives a PWM signal as input (Figure 7).
According to the datasheet, the PWM signal has a repetition frequency f P W M = 50 Hz. Instead of setting the PWM duty cycle, we specify the duration of the logical value 1 in microseconds ( μ s). The zero position is given by a pulse of 1500 μ s. A higher or lower tilt angle of the servosystem is achieved by adjusting the pulse duration. In our case, the range is 1500 μ s ± 330 μ s. This corresponds to a rotation angle of α = ± 5 ° (Figure 8). Similar behavior can also be found in [38].
The values of the key system parameters were determined experimentally by applying a step input to the device and comparing its response with a real-time simulation implemented on a microcomputer. Figure 9 shows a comparison of the response y M ( t ) to a step change of u P W M = ± 100 μ s for the model described by the transfer function (1), where K s = 1.25 mm/ μ s a T s = 1 s. The variables y f i l t ( t ) and y f i l t N ( t ) denote the measured filtered and non-filtered output, respectively.
The response is limited by the physical constraints of the beam along which the ball can move. The graph also clearly indicates that the gain is not the same for both movement directions of the ball.
By considering T s = 1 s, we reduced the identification process to determining a single parameter K s , which will represent all the variable factors of the system (servosystem properties, gears and also the processing of information from the A/D converter to the Arduino Due).
When searching for a dynamic model of the system, we also considered the transfer function (3). We found that the dead time is approximately D = 100 ms. Due to its small value, we decided to neglect it for the purposes of this paper.
For the proposed system model, we designed a controller that was first tested in the MATLAB/Simulink (2023b) environment. After successful simulation verification, the system was implemented on a microprocessor platform, where the control process was executed in real time. Finally, the controller was applied to the physical system. This step-by-step approach allowed us to minimize the accumulation of errors.

5. Control Structure Design

The whole controller design was implemented in the continuous domain, while the final implementation was in digital form (Figure 10). The sampling periods of the individual blocks are set so that the resulting system exhibits behavior similar to that of a continuous system. Minor deviations arising in the digital implementation are compensated by the controller and by the principle of negative feedback.
System control design is usually based on a pre-designed controller structure, where the controller parameters are calculated using a chosen synthesis method. The PID controller structure is very commonly used, for which the individual synthesis methods are summarized, e.g., in [48]. The main limitation of this approach is that the controller’s action is often calculated solely based on a single input: the control error e ( t )
e ( t ) = r ( t ) y ( t )
where r ( t ) is the reference signal and y ( t ) is the system output.
We based the controller design on the control structure shown in Figure 11, where the input to the controller is not the control error but rather the output of the system and its desired value.
As already mentioned, for simplicity, we will describe the mathematical model of the ABMS system using a double integrator (1). The control of such a system has been addressed in publications such as [49,50].
The whole design of our controller will consist of three steps: stabilizing the S ( s ) system, ensuring the desired behavior of the F ( s ) system, and ensuring the realizability of the entire control structure [51].

5.1. System Stabilization

The transfer function (1) that describes the motion of the ball is not stable. The first step in the controller design is to stabilize the system, to which we want to impose the desired feedback behavior using stabilizing feedback. For this reason, in the control scheme shown in Figure 11, we can replace the controller block C ( s ) with blocks C 1 ( s ) and C 2 ( s ) (Figure 12).
The controller structure can be derived from the equation
U ( s ) = C 1 ( s ) [ R ( s ) Y ( s ) ] C 2 ( s ) Y ( s ) = F ( s ) 1 F ( s ) 1 M ( s ) [ R ( s ) Y ( s ) ] C 2 ( s ) Y ( s )
where M ( s ) represents the desired behavior of the system achieved by the internal feedback C 2 ( s ) , and F ( s ) is the desired behavior of the control loop as a whole. The order of the transfer function M ( s ) is influenced by the order of the controlled process.
M ( s ) = S 1 ( s ) 1 + C 2 ( s ) S 1 ( s )
In our case, we require the transfer function M ( s ) to behave like a second-order system
M ( s ) = K M a M 2 s 2 + a M 1 s + a M 0
The transfer function C 2 ( s ) represents the stabilizing feedback
C 2 ( s ) = 1 M ( s ) 1 S 1 ( s )
Following (7), we obtain
C 2 ( s ) = a M 2 K M s 2 + a M 1 K M s + a M 0 K M T s 2 K s s 2 = a 2 s 2 + a 1 s + a 0
Since the second derivative is difficult to implement, we will require a 2 = ! 0 . This approach allows us to eliminate the number of differential equations to be solved and to significantly reduce the computation time. Therefore, we require
a M 2 K M T s 2 K s = ! 0
from which we obtain
K M = a M 2 K s T s 2
Therefore, the stabilizing feedback is described by a first-order polynomial
C 2 ( s ) = a 1 s + a 0

5.2. Desired System Behavior

After stabilizing the system, we can design the transfer function C 1 ( s ) , which ensures the desired behavior of the control structure.
Since the transfer function (7) is of second order, we can require that the desired transfer function of the closed-loop system F ( s ) is also of second order
F ( s ) = 1 a F 2 s 2 + a F 1 s + 1 = 1 ( T F s + 1 ) ( T F ρ F s + 1 ) = Y F ( s ) R ( s )
If we consider the block diagram shown in Figure 12, then for the regulator C 1 ( s ) , we have
C 1 ( s ) = F ( s ) 1 F ( s ) 1 M ( s )
Substituting (13) and (7)
C 1 ( s ) = a M 2 s 2 + a M 1 s + a M 0 a F 2 s 2 + a F 1 s 1 K M
In the design, we have ensured that the transfer functions M ( s ) and F ( s ) correspond to an improper second-order system, ensuring a stable system without overshoot. Choosing any value for a M 1 could lead to oscillations or even instability. This can be eliminated by appropriate adjustment of the controller parameters C 1 ( s ) . If we choose the following
a M 2 = T M 2 ρ M
a M 1 = ( ρ M + 1 ) T M
a M 0 = 1
then
C 1 ( s ) = T M 2 ρ M s 2 + ( ρ M + 1 ) T M s + 1 T F 2 ρ F s 2 + ( ρ F + 1 ) T M s T s 2 T M 2 ρ M K s

5.3. Realizability of the Solution

Finally, let us look at the whole control scheme from the point of view of its realizability. The stabilizing feedback is represented by a first-order polynomial (12). For its realizability, it is necessary that it is complemented by at least a first-order filter. We used a second-order filter to improve filtering properties.
C 2 ( s ) = a 1 s + a 0 a f 2 s 2 + a f 1 s + 1 = a 1 s + a 0 ( T f 2 s + 1 ) 2
At the same time, the considered control scheme (Figure 12) is supplemented with a second-order filter Q ( s )
Q ( s ) = 1 ( T f s + 1 ) 2
This filter allows filtering the measured signal. The resulting control structure is shown in Figure 13.
The developed controller was implemented on a microcontroller. All derivatives were replaced by finite differences with the sampling period selected to be sufficiently small. This ensured that the combined transfer function of the hold circuit and sampler remained approximately constant and equal to one across the relevant frequency spectrum.

6. Experimental Results and Discussion

First, we compared the desired trajectory of the ball’s position y F ( t ) defined by (13) with the simulation of the identified device model y M ( t ) (1), which was performed in real time on a microcomputer. In this case, dry friction does not appear during the experiment. The parameters used in the implementation are listed in Table 1.
The system gain K s and the time constant of the system T s were already justified in Section 4. The time constants T M and the controller parameter ρ M were chosen so that the dominant time constant of systems (1) and (6) would be the same. The time constants T F and the controller parameter ρ F were selected to achieve a faster system response compared to the equivalent second-order system (13) while also keeping the regulator time constants equal for simplicity. The time constant of the filter was chosen to ensure that the transfer function (20) is realizable without making the system prone to instability.
From Figure 14, it can be seen that these trajectories are practically identical, although at higher zoom levels, it is apparent that the simulation output slightly precedes the desired trajectory. This is due to the negligible but nevertheless present delays.
Since dry friction ( ± 40 μ s) will also appear in the real device, it is necessary to excite the control input u P W M ( t ) with sufficiently large oscillations at a higher frequency (Figure 15). This can be achieved in several ways. We increased the time constant of the filter in the stabilizing feedback to T f 2 = 0.065 s. Then, the output variable stabilizes more or less at the desired set point value. The imperfection of the parameter settings is visible in u P W M . In steady state, the control signal is not at zero value. Additionally, the low frequency of the generated oscillations caused these oscillations to be transmitted to the system’s output.
However, we can use the proposed control structure in a real experiment, the results of which are shown in Figure 16. We used the parameters listed in Table 1 except for two parameters that had to be adjusted: K s = 2.4 mm/ μ s and T M = T s / 5 = 0.2 s. These parameters allowed us to overcome dry friction and at the same time achieve high frequencies of the control signal that appear as random noise in the control signal. These high frequencies are filtered out and therefore do not appear in the system’s output.

7. Conclusions

In this paper, after analyzing various design solutions, we proposed and implemented an Automatic Ball-Balancing Mechatronic System (ABMS) with a lever transmission, which provides higher positioning accuracy for the ball. The identification of the system was performed experimentally, and the results confirmed the suitability of the chosen mathematical model.
Then, we designed and tested a new compensator, which was successfully implemented in real time on a microprocessor platform. Both simulation and experimental results demonstrated that the proposed controller provides stable and accurate control of the system under various step changes in the input signal.
The goal of the paper was to achieve the same trajectory of the ball’s position change on the real device as we previously obtained in simulation. The main issue was that initially, we were unable to achieve zero steady-state control error on the real device. As the transient response approached the desired value, friction between the ball and the sensor became significant, causing the ball to stop due to insufficient control action. Although the controller attempted to eliminate the error, the process was too slow, which was not acceptable for our requirements. When we claimed to have achieved higher positioning accuracy, we took into account this unfavorable effect of dry friction. To address this, we first introduced high-frequency oscillations into the control action, which the system naturally filtered out.
In this paper, we have identified the system by a double integrator in which we neglected dead time. However, in the future, we plan to include it in the controller design to further improve the control quality.

Author Contributions

Writing—original draft preparation, J.Š., Š.C. and K.Ž. Equipment development, J.Š. Simulations, Š.C. Experiments, Š.C. and J.Š. Editing, J.Š., Š.C. and K.Ž. Project administration, K.Ž. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the following grants—KEGA 003STU-4/2025 Implementation of innovative technological tools in the mechatronics education and VEGA No. 1/0821/25 Enhancing the performance and robustness of advanced mechatronic systems by designing a generalized PID control with the use of higher-order derivatives.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Dataset available on request from the authors.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
ABMSAutomatic Ball-Balancing Mechatronic System
A/DAnalogue Digital Converter
PCPersonal Computer
PWMPulse Width Modulation
FFFFused Filament Fabrication

References

  1. Liu, X.; Shao, H.; Liu, C.; Li, N.; Guo, X.; Zheng, F.; Sun, L. An Adaptive Controller Based on Interconnection and Damping Assignment Passivity-Based Control for Underactuated Mechanical Systems: Application to the Ball and Beam System. Actuators 2023, 12, 408. [Google Scholar] [CrossRef]
  2. Mehedi, I.M.; Al-Saggaf, U.M.; Mansouri, R.; Bettayeb, M. Two Degrees of Freedom Fractional Controller Design: Application to the Ball and Beam system. Measurement 2019, 135, 13–22. [Google Scholar] [CrossRef]
  3. Jiang, J.; Astolfi, A. Stabilization of a Class of Underactuated Nonlinear Systems via Underactuated Back-Stepping. IEEE Trans. Autom. Control 2021, 66, 5429–5435. [Google Scholar] [CrossRef]
  4. Andreev, F.; Auckly, D.; Gosavi, S.; Kapitanski, L.; Kelkar, A.; White, W. Matching, Linear Systems, and the Ball and Beam. Automatica 2002, 38, 2147–2152. [Google Scholar] [CrossRef]
  5. Lee, C.R.; Park, J.K.; Kim, S.K.; Ahn, C.K. Velocity Observer-Based Nonlinear Self-Tuning Position Stabilizer for Ball-Beam System Applications. IEEE Trans. Circuits Syst. II Express Briefs 2020, 67, 1309–1313. [Google Scholar] [CrossRef]
  6. Hauser, J.; Sastry, S.; Kokotovic, P. Nonlinear Control via Approximate Input-Output Linearization: The Ball and Beam Example. IEEE Trans. Autom. Control 1992, 37, 392–398. [Google Scholar] [CrossRef]
  7. Hirschorn, R. Incremental Sliding Mode Control of the Ball and Beam. IEEE Trans. Autom. Control 2002, 47, 1696–1700. [Google Scholar] [CrossRef]
  8. Bao, X.; Zhai, Y.; Yu, B.; Wang, H.; Ren, P.; Li, M. Extended State Observer Based Sliding Mode Control for Ball-Beam System. In Proceedings of the China Automation Congress (CAC), Beijing, China, 22–24 October 2021; pp. 7007–7012. [Google Scholar] [CrossRef]
  9. Qi, X.; Li, J.; Xia, Y.; Wan, H. On Stability for Sampled-Data Nonlinear ADRC-Based Control System with Application to the Ball-Beam Broblem. J. Frankl. Inst. 2018, 355, 8537–8553. [Google Scholar] [CrossRef]
  10. Li, E.; Liang, Z.Z.; Hou, Z.G.; Tan, M. Energy-Based Balance Control Approach to the Ball and Beam System. Int. J. Control 2009, 82, 981–992. [Google Scholar] [CrossRef]
  11. Montoya, D.O.; Gil-González, W.; Ramírez-Vanegas, C. Discrete-Inverse Optimal Control Applied to the Ball and Beam Dynamical System: A Passivity-Based Control Approach. Symmetry 2020, 12, 1359. [Google Scholar] [CrossRef]
  12. Tajjudin, M.; Aziz, S.A.; Ishak, N.; Rahiman, M.H.F.; Adnan, R. Fuzzy PID Tracking Performance for Ball and Beam System. In Proceedings of the IEEE Conference on Systems, Process and Control (ICSPC), Melaka, Malaysia, 15–17 December 2017; pp. 100–104. [Google Scholar] [CrossRef]
  13. Amjad, M.; Kashif, M.; Abdullah, S.; Shareef, Z. A Simplified Intelligent Controller for Ball and Beam System. In Proceedings of the 2nd International Conference on Education Technology and Computer, Shanghai, China, 22–24 June 2010; Volume 3, pp. V3-494–V3-498. [Google Scholar] [CrossRef]
  14. Zaare, S.; Soltanpour, M.R. The Position Control of the Ball and Beam System using State-Disturbance Observe-Based Adaptive Fuzzy Sliding Mode Control in Presence of Matched and Mismatched Uncertainties. Mech. Syst. Signal Process. 2021, 150, 107243. [Google Scholar] [CrossRef]
  15. Muftah, M.N.; Faudzi, A.A.M.; Sahlan, S.; Mohamaddan, S. Fuzzy Fractional Order PID Tuned via PSO for a Pneumatic Actuator with Ball Beam (PABB) System. Fractal Fract. 2023, 7, 416. [Google Scholar] [CrossRef]
  16. Yao, S.; Liu, X.; Zhang, Y.; Cui, Z. Research on Solving Nonlinear Problem of Ball and Beam System by Introducing Detail-Reward Function. Symmetry 2022, 14, 1883. [Google Scholar] [CrossRef]
  17. Altinoz, O.T.; Yilmaz, A.E. Modelling and Controller Design for Ball and Beam System. In Proceedings of the SETSCI-Conference Proceedings, Ankara, Turkey, 19–21 April 2019; Volume 4, pp. 125–129. [Google Scholar]
  18. Wang, W. Control of a Ball and Beam System. Master’s Thesis, The University of Adelaide, Adelaide, Australia, 2007. [Google Scholar]
  19. Lieberman, J. A Robotic Ball Balancing Beam. 2004. Available online: https://api.semanticscholar.org/CorpusID:7793825 (accessed on 7 January 2025).
  20. Hirsch, R. EDUMECH Mechatronic Instructional Systems. Shandor Motion Systems. 1998. Available online: https://silo.tips/download/edumech-mechatronic-instructional-systems-ball-on-beam-system# (accessed on 2 April 2025).
  21. Rosales, E.; Ito, B.; Lilienkamp, K.; Lundberg, K. An Open-Ended Ball-Balancing Laboratory Project for Undergraduates. In Proceedings of the American Control Conference, Boston, MA, USA, 30 June–2 July 2004; Volume 2, pp. 1314–1318. [Google Scholar] [CrossRef]
  22. Ito, B.T. Stabilizing the Ball on Beam System with Analog Feedback; Department of Mechanical Engineering, Massachusetts Institute of Technology: Cambridge, MA, USA, 2004. [Google Scholar]
  23. Amira GmbH. BW500 Laboratory Setup Ball and Beam; Amira GmbH Duisburg: Duisburg, Germany, 1999. [Google Scholar]
  24. TecQuipment Ltd. Ball and Beam Apparatus—A Self-Contained, Benchtop Apparatus to Demonstrate Basic and Advanced Principles of Control in Naturally Unstable Systems; TecQuipment Ltd.: Nottingham, UK, 2024. [Google Scholar]
  25. Chien, T.L.; Chen, C.C.; Tsai, M.C.; Chen, Y.C. Control of AMIRA’s Ball and Beam System via Improved Fuzzy Feedback Linearization Approach. Appl. Math. Model. 2010, 34, 3791–3804. [Google Scholar] [CrossRef]
  26. Colón, D.; Andrade, Y.; Bueno, A.; Diniz, I.; Balthazar, J. Modeling, Control and Implementation of a Ball and Beam System. In Proceedings of the 22nd International Congress of Mechanical Engineering—COBEM 2013, Ribeirão Preto, Brazil, 3–7 November 2013; Volume 11. [Google Scholar]
  27. Kagami, R.M.; da Costa, G.K.; Uhlmann, T.S.; Mendes, L.A.; Freire, R.Z. A Generic WebLab Control Tuning Experience Using the Ball and Beam Process and Multiobjective Optimization Approach. Information 2020, 11, 132. [Google Scholar] [CrossRef]
  28. Quanser Inc. Quanser Ball and Beam; Quanser Inc.: Markham, ON, Canada, 2011. [Google Scholar]
  29. Edibon. RYC-BB Ball and Beam Module; Edibon: Madrid, Spain, 2021. [Google Scholar]
  30. Googol Technology Ltd. Ball and Beam Control System; Googol Technology Ltd.: Shenzen, China, 2023. [Google Scholar]
  31. Al-Dujaili, A.Q.; Humaidi, A.J.; Pereira, D.A.; Ibraheem, I.K. Adaptive Backstepping Control Design for Ball and Beam System. Int. Rev. Appl. Sci. Eng. 2021, 12, 211–221. [Google Scholar] [CrossRef]
  32. Kim, Y.; Kim, S.K.; Ahn, C.K. Variable Cut-Off Frequency Observer-Based Positioning for Ball-Beam Systems Without Velocity and Current Feedback Considering Actuator Dynamics. IEEE Trans. Circuits Syst. Regul. Pap. 2021, 68, 396–405. [Google Scholar] [CrossRef]
  33. Nowopolski, K. Implementation of Ball-and-Beam Control System as an Instance of Simulink to 32-bit Microcontroller Interface. Pozn. Univ. Technol. Acad. J. Electr. Eng. 2013, 76, 31–38. [Google Scholar]
  34. Ali, A.; Taha, O.; Naseraldeen, A.; Ali, T. Design and Implementation of Ball and Beam System Using PID Controller. Autom. Control Inf. Sci. 2017, 3, 1–4. [Google Scholar] [CrossRef]
  35. Hadipour, M.; Hosseinzadeh, A.; Sadidi, M. Investigation of the Stability of the Ball and Beam by the PID Controller. J. Manuf. Technol. Manag. 2021, 14, 51–58. [Google Scholar] [CrossRef]
  36. Versloot, J.; Parrott, E.; Dubay, R. Adaptive Control of a Ball and Beam System. In Proceedings of the IEEE International Systems Conference (SysCon), Montreal, QC, Canada, 24 August–20 September 2020. [Google Scholar] [CrossRef]
  37. Acrome Ltd. Acrome Ball and Beam; Acrome Ltd.: Maslak, İstanbul, 2015. [Google Scholar]
  38. Kajaman, A.; Aldeeb, E.; Aljayar, M. Design and Control of Ball-On-Plate Balancing Dynamic System using PID Controller. In Proceedings of the International Conference on Technical Sciences (ICST), Tripoli, Libya, 4–6 March 2019; Volume 3, pp. 182–187. [Google Scholar]
  39. Šefčík, J.; Žáková, K. The ABMS—Automatic Balancing Mechatronic System. IFAC-PapersOnLine 2024, 58, 253–256. [Google Scholar] [CrossRef]
  40. Keshmiri, M.; Jahromi, A.F.; Mohebbi, A.; Amoozgar, M.H.; Wen-Fang, X. Modeling and Control of Ball and Beam System using Model Based and Non-Model Based Control Approaches. Int. J. Smart Sens. Intell. Syst. 2012, 5, 14. [Google Scholar] [CrossRef]
  41. Bolívar-Vincenty, C.G.; Beauchamp-Báez, G. Modelling the Ball-and-Beam System from Newtonian Mechanics and from Lagrange Methods. In Proceedings of the Twelfth LACCEI Latin American and Caribbean Conference for Engineering and Technology, Guayaquil, Ecuador, 22–24 July 2014; Volume 22, p. 24. [Google Scholar]
  42. Maalini, P.V.M.; Prabhakar, G.; Selvaperumal, S. Modelling and Control of Ball and Beam System using PID Controller. In Proceedings of the International Conference on Advanced Communication Control and Computing Technologies (ICACCCT), Ramanathapuram, India, 25–27 August 2016; pp. 322–326. [Google Scholar] [CrossRef]
  43. Yu, W.; Ortiz, F. Stability Analysis of PD Regulation for Ball and Beam System. In Proceedings of the IEEE Conference on Control Applications, Toronto, ON, Canada, 28–31 August 2005; pp. 517–522. [Google Scholar] [CrossRef]
  44. Yu, W. Nonlinear PD Regulation for Ball and Beam System. Int. J. Electr. Eng. Educ. 2009, 46, 59–73. [Google Scholar] [CrossRef]
  45. Jadlovska, A.; Jajcisin, S.; Lonscak, R. Modelling and PID Control Design of Nonlinear Educational Model Ball & Plate. In Proceedings of the 17th International Conference on Process Control ’09, Štrbské Pleso, Slovakia, 9–12 June 2009; pp. 475–483. [Google Scholar]
  46. Choudhary, S.K. Robust PID Controller Design for Ball and Beam System using Classical Loop-Shaping Technique. Control Intell. Syst. 2016, 44, 10–17. [Google Scholar] [CrossRef]
  47. Shantou Jianxian Electronic Technology Co., Ltd. Robot Servo RD-5622MG-180. 2025. Available online: http://www.jx-servo.com/en/Product/ROBOT/423.html (accessed on 28 February 2025).
  48. O’Dwyer, A. Handbook of PI and PID Controller Tuning Rules; World Scientific: Singapore, 2009. [Google Scholar]
  49. Huba, M.; Vrancic, D.; Bistak, P. Reference Model Control of the Time Delayed Double Integrator. IEEE Access 2022, 10, 39282–39298. [Google Scholar] [CrossRef]
  50. Huba, M.; Bistak, P.; Vrancic, D.; Sun, M. PID vs. Model-Based Control for the Double Integrator Plus Dead-Time Model: Noise Attenuation and Robustness Aspects. Mathematics 2025, 13, 664. [Google Scholar] [CrossRef]
  51. Chamraz, S.; Balogh, R. Control of the IPDT Plants: Part I: Internal Feedback as a Difference. In Proceedings of the 28th International Conference Cybernetics and Informatics, Levoca, Slovakia, 2–5 February 2016. [Google Scholar] [CrossRef]
Figure 1. Configuration 1: actuator applied on the swing axis of the arm.
Figure 1. Configuration 1: actuator applied on the swing axis of the arm.
Electronics 14 01695 g001
Figure 2. Configuration 1a: actuator acting trough friction drive or spur gear transmission.
Figure 2. Configuration 1a: actuator acting trough friction drive or spur gear transmission.
Electronics 14 01695 g002
Figure 3. Configuration 1b: actuator acting trough belt/chain transmission.
Figure 3. Configuration 1b: actuator acting trough belt/chain transmission.
Electronics 14 01695 g003
Figure 4. Configuration 2a: actuator acting through a linkage on the arm with a pivot point at its end.
Figure 4. Configuration 2a: actuator acting through a linkage on the arm with a pivot point at its end.
Electronics 14 01695 g004
Figure 5. Configuration 2b: actuator acting via a linkage on an extended arm with a pivot point in its center.
Figure 5. Configuration 2b: actuator acting via a linkage on an extended arm with a pivot point in its center.
Electronics 14 01695 g005
Figure 6. Photograph of the developed Automatic Ball-Balancing Mechatronic System (a) with the detail in the cross-section of the beam (b).
Figure 6. Photograph of the developed Automatic Ball-Balancing Mechatronic System (a) with the detail in the cross-section of the beam (b).
Electronics 14 01695 g006
Figure 7. PWM signal for servosystem.
Figure 7. PWM signal for servosystem.
Electronics 14 01695 g007
Figure 8. Schematic sketch of the ABMS device.
Figure 8. Schematic sketch of the ABMS device.
Electronics 14 01695 g008
Figure 9. Experimental system identification.
Figure 9. Experimental system identification.
Electronics 14 01695 g009
Figure 10. Centralized real-time information processing.
Figure 10. Centralized real-time information processing.
Electronics 14 01695 g010
Figure 11. Initial control structure.
Figure 11. Initial control structure.
Electronics 14 01695 g011
Figure 12. Modified control structure.
Figure 12. Modified control structure.
Electronics 14 01695 g012
Figure 13. Modified control structure with filter.
Figure 13. Modified control structure with filter.
Electronics 14 01695 g013
Figure 14. Comparison of the desired output trajectory y F ( t ) with the simulation on the microcomputer y M ( t ) .
Figure 14. Comparison of the desired output trajectory y F ( t ) with the simulation on the microcomputer y M ( t ) .
Electronics 14 01695 g014
Figure 15. Comparison of the desired output trajectory y F ( t ) with the simulation on the microcomputer with assumed dry friction y M ( t ) .
Figure 15. Comparison of the desired output trajectory y F ( t ) with the simulation on the microcomputer with assumed dry friction y M ( t ) .
Electronics 14 01695 g015
Figure 16. Comparison of the desired output trajectory from simulation y F ( t ) with the measured output on the real device y M ( t ) .
Figure 16. Comparison of the desired output trajectory from simulation y F ( t ) with the measured output on the real device y M ( t ) .
Electronics 14 01695 g016
Table 1. Model and controller parameters.
Table 1. Model and controller parameters.
VariableValueUnit
System gain K s 1.25mm/ μ s
Time constant of the system T s 1s
Time constant of the controller T M T s / 2 = 0.5 s
Controller parameter ρ M 1-
Time constant of the controller T F 0.5s
Controller parameter ρ F 1-
Time constant of the filter T f 2 0.015s
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Šefčík, J.; Chamraz, Š.; Žáková, K. Compensator with Weighted Input Parameters for Automatic Ball-Balancing Mechatronic System. Electronics 2025, 14, 1695. https://doi.org/10.3390/electronics14091695

AMA Style

Šefčík J, Chamraz Š, Žáková K. Compensator with Weighted Input Parameters for Automatic Ball-Balancing Mechatronic System. Electronics. 2025; 14(9):1695. https://doi.org/10.3390/electronics14091695

Chicago/Turabian Style

Šefčík, Ján, Štefan Chamraz, and Katarína Žáková. 2025. "Compensator with Weighted Input Parameters for Automatic Ball-Balancing Mechatronic System" Electronics 14, no. 9: 1695. https://doi.org/10.3390/electronics14091695

APA Style

Šefčík, J., Chamraz, Š., & Žáková, K. (2025). Compensator with Weighted Input Parameters for Automatic Ball-Balancing Mechatronic System. Electronics, 14(9), 1695. https://doi.org/10.3390/electronics14091695

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop