Experimental Evaluation of a Fuzzy Logic-Based Controller for a Two-Wheeled Balancing Robot

Authors:

Abstract
This work presents the design, implementation, and experimental validation of a fuzzy logic controller (FLC) for a two-wheeled balancing robot (TWBR). The controller is structured as a PD scheme, where the proportional action is determined through fuzzy inference using seven linguistic input values, while the derivative action is computed conventionally. The output of the fuzzy system is obtained through a weighted average defuzzification method and converted into PWM signals to drive the DC motors via an H-bridge circuit. The proposed methodology was implemented on an ESP32-WROOM-32 embedded platform, integrating real-time data acquisition from an IMU (accelerometer and gyroscope) to estimate the tilt angle of the robot. Experimental tests were conducted under two scenarios: one without external disturbances and another with manually applied perturbations. Results demonstrate that the fuzzy controller maintains stability within $\pm 2^{\circ}$ of the setpoint in disturbance-free conditions and successfully recovers equilibrium within a range of 75° to 105° under perturbations. These findings validate the robustness, adaptability, and efficiency of the proposed fuzzy control approach, making it a suitable alternative for embedded robotic applications where stability and real-time response are critical.