Comparative Analysis of PID and Fuzzy Logic Controllers for Position Control in Double-Link Robotic Manipulators
Abstract:
This study presents a comprehensive evaluation of linear and non-linear control systems, specifically Proportion Integration Differentiation (PID) and fuzzy logic controllers, in the context of position control within double-link robotic manipulators. The effectiveness of these controllers was rigorously assessed in a simulated environment, utilizing MATLAB Simulink for the simulation and SOLIDWORKS for the model design. The PID controller, characterized by its Kp, Ki, and Kd components, was implemented both in the simulation and on the hardware. However, due to the constraints of the microcontroller's RAM and processor, which facilitate the hardware's connection with MATLAB, the application of the Fuzzy Logic concept to hardware was not feasible. In the simulated environment, the fuzzy logic controller demonstrated superior stability in comparison to the PID controller, evidenced by a lower settling time (1.0 seconds) and overshoot (2%). In contrast, the PID controller exhibited a settling time of 0.2 seconds and an overshoot of 32%. Additionally, the fuzzy logic controller showcased a 44% reduction in steady-state error relative to the PID controller. When applied to hardware, the PID controller maintained stable results, achieving a settling time of 0.6 seconds and an overshoot of 2%. The steady-state errors for Link 1 and Link 2 were recorded as 3.6° and 1.4°, respectively. The findings highlight the fuzzy logic controller's enhanced stability, rendering it more suitable for ensuring the accuracy and protection of the manipulator system. As a non-linear controller, the fuzzy logic controller efficiently addresses various potential errors through its intelligent control mechanism, which is embedded in its fuzzy rules. Conversely, the PID controller, a linear controller, responds rapidly but may lack flexibility in complex scenarios due to its inherent linearity. This study underscores the importance of selecting an appropriate controller based on the specific requirements of robotic manipulator systems, with a focus on achieving optimal performance and stability.
1. Introduction
Robotic manipulator systems, known for their structural flexibility and capacity for versatile movement, require precise control mechanisms to ensure accurate trajectory and velocity [1], [2]. In these systems, two predominant types of controllers are employed: linear and non-linear. PID controllers, proposed as linear controllers, are favored for their simplicity, stability, and adaptability in systems with linear dynamics [3]. In contrast, fuzzy logic controllers, representing non-linear control systems, excel in handling complex, unpredictable scenarios and integrate human expertise effectively, making them suitable for non-linear system environments [4].
Historically, the range of motion in most robotic manipulators was constrained by the capabilities of actuators and the control algorithms employed. Such limitations often prevented robots from reaching certain positions or executing specific tasks. Mechanical inaccuracies in the robot's design further compounded these challenges, impacting overall performance [5], [6]. Additionally, environmental disturbances such as vibrations or wind have been observed to induce unpredictable movements in robotic manipulators, potentially causing deviations from intended positions.
In response to these challenges, this study evaluates the adaptability and efficiency of both linear and non-linear controllers in maintaining the precision of robotic manipulators under various disturbances. The influence of both internal and external disturbances, including human interaction and inertial effects on the movement of links, has been a critical focus. The rate at which each controller type corrects disturbances-induced errors is a key metric for assessing their efficiency.
To mitigate disturbances in robotic manipulators, a simulated environment was developed, utilizing PID and fuzzy logic controllers within a Double Link Robotic Manipulator System (DLRMS). This simulation, conducted using Simscape in MATLAB Simulink, aimed to scrutinize the effectiveness of these control systems against diverse disturbances applied to DLRMS. Further, the optimal structure of the PID controller was corroborated through Hardware in Loop (HIL) testing.
This comprehensive examination of PID and fuzzy logic controllers seeks to elucidate their respective strengths and limitations in managing the complexities inherent in robotic manipulator systems. The study's findings are intended to contribute to the advancement of control system design, enhancing the precision and adaptability of robotic manipulators in dynamic environments.
2. Methodology
The methodology encompasses three distinct approaches: simulation studies of both PID and fuzzy logic controllers, and hardware implementation utilizing only the PID controller within a HIL system, as delineated in the flowchart Figure 1.

In robotic systems, PID controllers play a crucial role in regulating arm position and mitigating disturbances. These controllers adjust the output by quantifying the discrepancy between the desired and actual positions of the robotic arm, employing proportional control (P) [7]. Integral control (I) is utilized to counteract steady-state errors, while derivative control (D) aims to curtail overshoot and oscillation [8]. The efficiency of the PID controller in double-link robotic manipulator systems is evaluated through two methodologies: simulation using 3D animation from Simscape (Figure 2) and hardware implementation via a HIL concept. Both approaches focus on reducing steady-state errors and enhancing the flexibility of the manipulator link system [8], [9].

The PID values for each link are distinct, reflecting the unique roles of the links. Consequently, different Kp, Ki, and Kd values are assigned to each link, as outlined in Table 1. The Kp value for Link 2 is higher to accommodate the additional inertia encountered during the movement of Link 1, necessitating a more robust evaluation of the angle discrepancy. These values were derived from system identification references, using motor specifications akin to those employed in this study. A minor modification in the Kd value was implemented to optimize error reduction.
Parameter | Simulation | Hardware | ||
Link 1 | Link 2 | Link 1 | Link 2 | |
Kp | 70 | 90 | 70 | 90 |
Ki | 0.005 | 0.005 | 0.005 | 0.005 |
Kd | 2.5 | 2.5 | 0.5 | 0.5 |
The Kp and Ki values remained constant across both methodologies, while a slight variation in Kd was deemed necessary. This adjustment was intended to enhance the reduction of overshoot and settling time in hardware applications.
The fuzzy logic controller, a non-linear control system, demonstrates versatility and efficacy in managing complex systems. Inputs for this controller are typically derived from sensor readings or other system variables, and the outputs manifest as control signals or actions within the system [10], [11]. Each rule and variable within the fuzzy logic system is designed to counter disturbances affecting the performance of the robotic manipulator's links. The fuzzy logic block diagram and its implementation in MATLAB Simulink using the Simscape plugin are illustrated in Figure 3, respectively.
Prior to the implementation of the fuzzy logic controller, the linguistic variables and terms relevant to the system are defined. This step is critical for the construction of an appropriate membership function. The knowledge base, comprising these defined rules, undergoes a process of defuzzification to maintain the position of the links and to mitigate any disturbances, thereby ensuring the attainment of the desired angle [12].

$\boldsymbol{e} / \boldsymbol{\Delta} \boldsymbol{e}$ | $\boldsymbol{N B}$ | $\boldsymbol{N} \boldsymbol{S}$ | $\boldsymbol{Z}$ | $\boldsymbol{P S}$ | $\boldsymbol{P B}$ |
$N B$ | $P B$ | $P B$ | $P B$ | $P S$ | $Z$ |
$N S$ | $P B$ | $P B$ | $P S$ | $Z$ | $N S$ |
$Z$ | $P B$ | $P S$ | $Z$ | $N S$ | $N B$ |
$P S$ | $P S$ | $Z$ | $N S$ | $N B$ | $N B$ |
$P B$ | $Z$ | $N S$ | $N B$ | $N B$ | $N B$ |
Table 2 outlines the fuzzy rules for the Mamdani fuzzy inference system. These rules are categorized based on the input error (e) and the change in error ($\Delta \mathrm{e}$), each varying from negative big (NB), negative small (NS), zero (Z), positive small (PS), to positive big (PB). The output of the fuzzy logic controller is then formulated to counterbalance these errors, aiming for a zero error rate [13]. The implementation of Gaussian membership functions within the controller enhances its flexibility, while the Mamdani system in the fuzzy inference system is designed to handle errors ranging from small to large without inconsistencies. Figure 4 displays the fuzzy surface utilized in this research, representing the 5×5 Mamdani membership rules.

The simulation was structured to evaluate the controllers' response under four distinct conditions, with the input angles set at 45°, 90°, 180° and 270° for both Link 1 and Link 2. These conditions are visualized in Figure 5 and Figure 6. Additionally, a movement sequence akin to a "pick & place robot" application was also simulated to further test the controllers' efficacy in a dynamic environment. The associated figures (Figure 5 and Figure 6) illustrate the signal builders for the input signals of Links 1 and 2, respectively.
Internal disturbances were applied to each link, utilizing different step function signals as depicted in Figure 7. This approach enabled an analysis of the controllers' ability to handle internal system disruptions. Moreover, Figure 8 displays the initial position of both Link 1 and Link 2, set at a 0-degree angle.




The step function signal generated by the signal builder, with a maximum value reaching 250°, was injected into the system at predetermined intervals. The primary objective of introducing this disturbance signal was to assess the controllers' proficiency in minimizing the steady-state error induced by such disturbances.
The HIL system integration is depicted in Figure 9, showcasing the connection diagram between MATLAB Simulink and the hardware system. The hardware utilized in this study is powered by two 12V DC motors equipped with encoders, entirely controlled via MATLAB Simulink. An Arduino Mega functions as an intermediary between MATLAB Simulink and the DC motor encoders. This choice was informed by the compatibility of the Arduino Mega with Simulink's external plugins, offering seamless integration with the 12V Brushless DC motors and their encoders. Specifically, interrupt pins 2, 3, 18, and 19 on the Arduino Mega facilitate this connection, aligning with the requirements of the hardware setup. Figure 10 and Figure 11 illustrate the double link robotic manipulator hardware and its integration with MATLAB Simulink, respectively.



The PID values for the hardware implementation of the double-link robotic manipulator slightly diverge from those in the simulation. To mitigate overshoot within the system, the Ki value in the hardware setting was reduced compared to that in the simulation [14]. The objective was to replicate the control behavior observed in the simulation, maintaining consistency between the PID controller's simulated and actual performance. However, it was observed that a minor adjustment in the Kd value was necessary to enhance the system's response, ensuring optimal control efficacy [9], [15].
This part of the methodology emphasizes the critical importance of adapting control parameters when transitioning from simulation to hardware implementation. The hardware setup, especially the integration of the Arduino Mega, exemplifies the need for flexibility and compatibility in hardware choices to ensure the effective application of control strategies developed in simulated environments.
3. Results and Discussion
In the conducted simulation, a set point of 180° was established for both links, which encountered signal disturbances at specific intervals. It was observed that the PID controller effectively managed to maintain the position of the links while concurrently reducing internal disturbances and minimizing steady-state errors.
As illustrated in Figure 12, a notable overshoot was initially observed at the commencement of the step function (angle of 180°) for both links. A noteworthy phenomenon was the slight negative movement of Link 1, induced by the inertia effect on Link 2. However, the PID controller promptly rectified this disturbance, restoring Link 1 to its original position expeditiously. Both links exhibited rapid settling times and negligible steady-state errors, demonstrating the PID controller’s efficiency in position control and disturbance reduction.

In this simulation scenario, similar to the PID setup, both links were subjected to signal disturbances at a predetermined time and operated with a set point of 180°. The fuzzy logic controller was then evaluated for its capability to sustain link positions while minimizing steady-state errors and internal disturbances.
Referencing Figure 13, it was discerned that the settling time for the system to attain the desired angle was elongated compared to the PID controller's instantaneous response. Notably, the settling time with the fuzzy logic controller varied proportionally with the set point angle; higher angles resulted in extended settling times. Minimal overshoot was observed in the movements of both links, attributed to the extended settling period. Furthermore, when internal disturbances were introduced, the steady-state error remained minimal.
Due to limitations in applying the fuzzy logic controller to actual hardware, the study focused on the PID controller for the hardware implementation. The interaction between the PID controller and the DLRMS was meticulously analyzed. Similar to the simulation, a set point angle of 180° was employed, along with the highest input disturbance value.
The results, as demonstrated in Figure 14, revealed that the PID controller facilitated a highly responsive settling time on both links, accompanied by minimal overshoot. The steady-state error, when disturbances were introduced, was found to be significantly low. The reduced overshoot was influenced by the PID controller's prompt response to the set point angle. Additionally, the utilization of geared DC motors and efficient encoders synergistically contributed to the enhanced control of the link positions [16], [17].


DLRMS, analogous to robotic arms used in industrial applications such as robotic welding and medical scanning, was employed to demonstrate a pick & place routine. This routine, simulating the movement of a ball from Box A to Box B and back to a resting position, was executed using both PID and fuzzy logic controllers. The performance of these controllers during this routine is depicted in Figure 15, Figure 16 and Figure 17.



Observations from Figure 16 and Figure 17 reveal that the PID controller exhibits rapid settling time and minimal steady-state error, yet it is prone to significant overshoot due to its quick response. Conversely, the fuzzy logic controller, while demonstrating slower settling times for each set point, ensures minimal overshoot and a steady-state error approaching zero. These findings suggest that both controllers possess distinct advantages and are capable of performing effectively within the given parameters.
A notable limitation of the PID controller is its susceptibility to unexpected overshoots when faced with out-of-range signals, potentially leading to system failure. The fuzzy logic controller, in contrast, smoothly manages various inputs and deliberately extends settling time to reduce abrupt movements, thereby minimizing overshoot during the rise time. This extended settling time demonstrates a commitment to maintaining position accuracy, even in the face of external disturbances.
It was further observed that the fuzzy logic controller more effectively repels external disturbances compared to the PID controller, exhibiting a higher error reduction rate. This controller's ability to minimize inertia effects on link positions contributes to its robustness, particularly in scenarios involving free-form movements of manipulator links. Such attributes render the fuzzy logic controller more adaptable and resilient to unexpected system failures, highlighting its suitability for dynamic and complex tasks.
The comprehensive results encompassing the simulation method and hardware implementation are consolidated in a unified table. This table presents a comparative analysis of overshoot, steady-state error, and settling time for the PID and fuzzy logic controllers in simulation, as well as the PID controller in hardware.
Figure 18 and Table 3 reveal a pronounced disparity in overshoot values among the different control methods. The Simulink PID exhibited overshoot values ranging from 11% to 32%. In stark contrast, both the Fuzzy Logic Simulink and Hardware PID controllers demonstrated significantly lower overshoot values, ranging from 0.3% to 7.5%. These results indicate the superior performance of the fuzzy logic controller in Simulink and the PID controller in hardware environments in terms of minimizing overshoot.
Overshoot, % | ||||||
Set Point Angle | PID Controller | Fuzzy Logic | Hardware PID | |||
Link 1 | Link 2 | Link 1 | Link 2 | Link 1 | Link 2 | |
$45^{\circ}$ | 27.47 | 11.33 | 5.91 | 1.24 | 3.65 | 7.41 |
$90^{\circ}$ | 27.56 | 23.91 | 3.65 | 1.36 | 3.65 | 4.74 |
$180^{\circ}$ | 26.62 | 31.54 | 1.53 | 0.36 | 1.53 | 1.53 |
$270^{\circ}$ | 26.28 | 25.74 | 1.53 | 0.51 | 0.51 | 0.51 |

As depicted in Figure 19 and summarized in Table 4, all three methods achieved remarkably minimal steady-state errors, confined within the range of 0° to 5°. This outcome underscores the efficiency of both the PID and fuzzy logic controllers in mitigating internal disturbances within the system. Despite disturbances, these controllers were adept at maintaining the set point angle with negligible steady-state errors.
The fuzzy logic controller demonstrated the lowest steady-state error, showcasing its flexibility in handling disturbances related to angle and inertia. The PID controller, both in simulation and hardware settings, exhibited a slightly higher steady-state error compared to the fuzzy logic controller.
Steady State Error, ◦ | ||||||
Set Point Angle | PID Controller | Fuzzy Logic | Hardware PID | |||
Link 1 | Link 2 | Link 1 | Link 2 | Link 1 | Link 2 | |
$45^{\circ}$ | 4.7 | 2.6 | 1.6 | 1.4 | 0.6 | 3.6 |
$90^{\circ}$ | 3.2 | 2.6 | 1.0 | 1.5 | 1.6 | 2.9 |
$180^{\circ}$ | 3.0 | 2.0 | 0.7 | 1.5 | 1.4 | 3.6 |
$270^{\circ}$ | 3.2 | 2.5 | 1.2 | 1.5 | 0.8 | 3.0 |

Figure 20 and Table 5 present the settling time comparisons among the three controller methods. A significant difference was noted, particularly between the fuzzy logic controller and the hardware PID, in comparison to the simulation PID. The maximum settling time recorded was 1.5 seconds, a value considered exemplary for controller efficiency. The simulation PID exhibited the shortest settling time, attributed to its rapid response in controlling the 3D Simscape model, which is highly sensitive to movements. The fuzzy logic controller, characterized by its extensive membership range, adeptly manages both standard and atypical disturbances through its specified rules, showcasing responsiveness across various disturbance scenarios.
Settling Time, s | ||||||
Set Point Angle | PID Controller | Fuzzy Logic | Hardware PID | |||
Link 1 | Link 2 | Link 1 | Link 2 | Link 1 | Link 2 | |
$45^{\circ}$ | 0.3 | 0.1 | 0.4 | 0.2 | 0.4 | 0.2 |
$90^{\circ}$ | 0.3 | 0.1 | 0.6 | 0.3 | 0.6 | 0.3 |
$180^{\circ}$ | 0.4 | 0.2 | 1.0 | 0.4 | 0.6 | 0.4 |
$270^{\circ}$ | 0.4 | 0.2 | 1.5 | 0.6 | 1.11 | 0.5 |

The results elucidate the distinct advantages and limitations of both the PID and fuzzy logic controllers in robotic system control. The PID controller, with its simplicity, stability, and adaptability, is particularly effective in linear systems. In contrast, the fuzzy logic controller, known for its versatility and robustness in managing unpredictable scenarios, excels in complex and nonlinear systems. The choice of controller is contingent upon factors such as system complexity, nonlinearity, and availability of specialized expertise. An optimal approach may involve leveraging the strengths of both controllers in tandem, depending on the specific requirements of the task at hand.
4. Conclusions
In summary, the study demonstrated that both PID and fuzzy logic controllers are compatible with the DLRMS, effectively maintaining manipulator link positions and mitigating disturbances. The PID controller, a linear controller, exhibits high reactivity but faces limitations in handling unforeseen situations and is prone to overshooting [18], [19]. Its lack of adaptability in responding to sudden adjustments potentially results in system failures.
Conversely, the fuzzy logic controller excels in precision maintenance of manipulator link positions and disturbance reduction. Its ability to adapt system parameters based on a relevant knowledge base enables it to effectively respond to unexpected routines or actions [20]. This flexibility is instrumental in minimizing errors and maintaining system consistency, thus averting potential failures.
Moreover, the PID and fuzzy logic controllers complement each other within the DLRMS, enhancing responsiveness and efficiency in achieving specific objectives swiftly [21]. While the PID controller is suited for simpler systems, the fuzzy logic controller is more appropriate for complex environments.
The application of these systems in the industrial sector, particularly in heavy industries like automotive manufacturing and sorting centers, is notable. Tasks such as "pick & place robot" operations and spot-welding are common applications. The integration of a non-linear controller and intelligent control within these systems can lead to more efficient operations, benefiting the industry significantly.
The current simulation serves as an analog for the hardware, yet it does not reflect specific aspects like DC motor encoder or actuator specifications. Presently, the 3D model settings are limited to the total weight of each link. It is recommended to incorporate the transfer function of each DC motor encoder or actuator using system identification. This would optimize the simulation, aligning it more closely with the hardware application. Post-implementation of hardware parameters into the 3D model, simulation results are expected to align more accurately with hardware outcomes. Additionally, further analysis on link vibrations could provide insights into their impact on the controllers' ability to maintain positions.
To enhance the implementation of the fuzzy logic controller with the Arduino Mega interface, it is advised to upload the fuzzy inference system file onto the Arduino Mega board. This will facilitate smoother processing of fuzzy rules. The current limitation is that the MATLAB Simulink-managed fuzzy logic system is not fully processed by the Arduino Mega's memory system, due to the large size of fuzzy set data. Uploading the 'fis' file to the Arduino Mega would potentially enable more effective processing of the fuzzy set, improving signal transmission to the encoder.
The data used to support the research findings are available from the corresponding author upon request.
The authors declare no conflict of interest.
$\theta$ | Angle |
° | Degree of Angle |
$\Delta e$ | Change of Error |
$E$ | Error |
$Kp$ | Proportional gain |
$Ki$ | Integral gain |
$Kd$ | Derivative gain |
$L1$ | Link 1 |
$L2$ | Link 2 |
$q_1$ | Angle of Link 1 |
$q_2$ | Angle of Link 2 |
