# Stable Rules Definition for Fuzzy TS Speed Controller Implemented for BLDC Motor
## 4 Hardware Construction and Tests of the Stable Fuzzy Speed Controller
### The Design of the Control and Power System  
From the viewpoint of a microprocessor, controlling a BLDC motor is much more complicated and power-demanding than running a brushed direct-current machine. The lack of a mechanical commutator in a brushless DC motor requires the use of an electronic one. Its role is to read the current rotor position using the input signals from Hall sensors and switch on the proper transistors in a specific time window. The whole process requires the use of many external interrupts from the Hall sensors in the microcontroller unit. What is more, developing an advanced control system requires many operations to be conducted in a defined time period. Because of this, realizing a speed measuring loop in the same unit as the commutation process is uncertain. In order to obtain a correct value for the measured speed, it is strongly recommended to ensure a constant period of time in which the difference between the counted encoder pulses can be calculated correctly. To achieve this, the decision to use two independent Nucleo boards was made. The main control system was developed using one STM32 Nucleo 64 (F446 RE) board, one STM32 Nucleo 32 (L432 KC) board, and a Raspberry Pi 4B microcomputer. The chosen parameters of these microcontrollers are compared in Table 4. The integration of the whole control system was based on a Master-Slave data transfer. The concept of the control system is shown in Figure 12. The Raspberry Pi board handles the control application written in Python (v3.6.9). It gives the user the ability to set a reference speed and change it during the operation of the drive. It also captures information about the actual speed. It is a highly effective device for  
Figure 11: Transients of the drive with the BLDC motor and the fuzzy speed controller—modified mechanical time constants.  
the whole system. A Nucleo 64 deals with the main control algorithm. It works as a Slave device relative to the Raspberry Pi and as a Master device relative to the second Nucleo board. It is also responsible for ensuring a correct commutation process. It captures the input signals from the Hall sensors module, calculates the output signal from the control algorithm, and generates PWM signals for the power module board. These PWM signals are provided to a proper insulated-gate bipolar transistor (IGBT) switch (based on an implemented switching table). This receives information about the actual speed from the Nucleo 32. Communication between the boards is realized with the UART protocol.  
An essential part of a power electronic device is the power system. Its role is to ensure power delivery to all components used in a project. A Raspberry Pi computer requires a 230 V AC power supply, while the other devices work on a direct current. The whole power system was based on a 24 V DC main power supply, which distributed energy to three small-voltage controllers. Each of them was responsible for supplying a voltage to  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Device** & **Raspberry Pi 4B** & **STM32 Nucleo 64** & **STM32 Nucleo 32** \\ \hline Power consumption & 15 W & \textless{}1 W & \textless{}1 W \\ \multirow{2}{*}{Core} & Chipset Broadcom BCM2711 with 64-bit & \multirow{2}{*}{ARM Cortex M4} & \multirow{2}{*}{ARM Cortex M4} \\  & Quad-Core ARM-8 Cortex A-72 CPU & & \\ \multirow{2}{*}{Clock rate  User memory size  RAM} & 1.5 GHz & 180 MHz & 80 MHz \\ \hline \hline \end{tabular}
\end{table}
Table 4: Parameters of programable devices used in the project.  
Figure 12: The structure of the control system: (**a**) schematic diagram, (**b**) photos of the prototype.  
different on-board systems: a module of IGBT drivers, a fan cooling setup dedicated to the power module, and an IGBT board. The two Nucleo microcontrollers were powered by USB cables plugged into the Raspberry Pi microcomputer ports. The structure of the power system is shown in Figure 13.