The algorithm chosen in this work is based on a Mamdani system , in which the membership functions are trapezoidal. The reason for using this fuzzy system is that the library , which allows one to develop applications with fuzzy logic in microcontrollers based on the ATmega328p chipset, is the only one that possesses the Mamdani fuzzy system. In addition, the Takagi-Sugeno method is less intuitive and more computationally complex. While the defuzzification process can be done using different methods, the centroid technique method  was selected in this case. The fuzzy logic system was designed with MATLAB software. Figure 12 shows the general scheme.