Model- and Data-Based Control of Self-Balancing Robots: Practical Educational Approach with LabVIEW and Arduino
Abdelrahman Abdelgawad, Tarek Shohdy, Ayman Nada
TL;DR
The paper investigates both model-based and data-based control for a two-wheeled self-balancing robot, highlighting nonlinearity and instability as core challenges. It employs Lagrangian dynamics to derive a nonlinear model and linearizes it to a state-space form, then implements and compares PID, lead-lag, and PID-like fuzzy logic controllers on a low-cost OSOYOO platform via LabVIEW-LINX for real-time HIL validation. Results show that model-based controllers achieve superior settling time, steady-state accuracy, and robustness, while the fuzzy logic approach provides a model-free design path with slower convergence and larger overshoot, suggesting tunable trade-offs. The educational framework demonstrates practical steps for teaching mechatronics control, from dynamic modeling and controller design to hardware integration and real-time testing on accessible hardware.
Abstract
A two-wheeled self-balancing robot (TWSBR) is non-linear and unstable system. This study compares the performance of model-based and data-based control strategies for TWSBRs, with an explicit practical educational approach. Model-based control (MBC) algorithms such as Lead-Lag and PID control require a proficient dynamic modeling and mathematical manipulation to drive the linearized equations of motions and develop the appropriate controller. On the other side, data-based control (DBC) methods, like fuzzy control, provide a simpler and quicker approach to designing effective controllers without needing in-depth understanding of the system model. In this paper, the advantages and disadvantages of both MBC and DBC using a TWSBR are illustrated. All controllers were implemented and tested on the OSOYOO self-balancing kit, including an Arduino microcontroller, MPU-6050 sensor, and DC motors. The control law and the user interface are constructed using the LabVIEW-LINX toolkit. A real-time hardware-in-loop experiment validates the results, highlighting controllers that can be implemented on a cost-effective platform.
