  In this project, we designed a DC motor whose speed can be controlled by a
PID controller. The proportional, integral and derivative gains (KP, KI, KD) of
the PID controller are adjusted according to Fuzzy logic. First of all, the
fuzzy logic controller is designed according to rules so that the systems is
basically robust. There are 25 rules for the auto-tuning of each parameter of
the PID controller. The FLC (fuzzy logic controller) has two inputs. The first
is the motor speed error between the reference (setpoint) and the actual speed.
The second is the variation of the speed error (derivative of the speed error).
Secondly the output of the FLC is the parameters of the PID controller which
are used to control the speed of the DC motor. The study shows that both the
precise characters of PID controllers and the flexible characters of fuzzy
controllers are present in the fuzzy self-tuning PID controller. The fuzzy
auto-tuning approach implemented on a conventional PID structure was able to
control the speed of the DC motor. It also improved the dynamic and static
response of the system. The comparison between the conventional response and
the fuzzy self-tuning response was performed based on the simulation result
obtained by MATLAB/SIMULINK.
  The simulation results show that the designed self-adaptive PID controller
achieves good dynamic behavior of the DC motor, perfect speed tracking with
short rise and settling times, zero overshoot and steady state error and thus
gives better performance compared to the conventional PID controller. We then
model the fuzzy PID using simple code on Arduino IDE and perform a practical
experiment, to confirm our theorical results.
