Optimal Tuning of Digital PID Controllers for Commercial BLDC Motors Using the Nelder–Mead Method
Article Category: Research Paper
Published Online: Jul 29, 2025
Page range: 210 - 226
Received: Apr 15, 2025
Accepted: Jun 27, 2025
DOI: https://doi.org/10.2478/pead-2025-0015
Keywords
© 2025 Son T. Nguyen et al., published by Sciendo
This work is licensed under the Creative Commons Attribution 4.0 International License.
The adoption of brushless DC (BLDC) motors has grown rapidly across a wide range of industries, including electric vehicles (EVs), industrial automation and home appliances. This growth can be attributed to their enhanced efficiency, durability and minimal maintenance requirements compared with traditional brushed DC motors. BLDC motors are particularly notable for their impressive energy efficiency, which optimises power usage, cuts down on energy consumption and helps reduce operating expenses. These advantages make them a top choice for applications that emphasise sustainability and long-term energy savings (Lee et al., 2016; Mohanraj et al., 2022).
In household appliances, BLDC motors offer quieter operation and improved efficiency in devices such as water pumps (Khan and Miah, 2020) and washing machines (Ho et al., 2012). Within the automotive sector, they enhance the performance, power density and torque of EVs, contributing to both higher performance and greater sustainability (Shao, 2006). Their lightweight design and reduced heat generation make them ideal for modern EV propulsion systems (Chau et al., 2007). Beyond consumer products, BLDC motors are extensively used in robotics (De et al., 2019) due to their precise motion control and high-speed capabilities. As technological advancements continue, developments in motor control, power electronics and battery technology are boosting both the efficiency and cost-effectiveness of BLDC motors, reinforcing their crucial role in the future of electrical and mechanical systems.
Since PID controller tuning methods based on the Ziegler–Nichols approach may not provide optimal performance for complex, non-linear systems like BLDC motors, several advanced techniques for optimal PID tuning have been proposed to address these limitations. The Ziegler–Nichols method, while effective for many linear control systems, often struggles with highly dynamic and non-linear characteristics, such as those exhibited by BLDC motors (Bazanella et al., 2017). These limitations can lead to suboptimal transient response, overshoot and steady-state error, which negatively impact the overall performance and stability of the motor drive system. To overcome these challenges, more sophisticated and adaptive tuning approaches are required to ensure optimal performance across a wide range of operating conditions (Basilio and Matos, 2002; Huba et al., 2024).
Advanced PID controller tuning methods such as genetic algorithms (GA) (Chen and Perng, 2017), particle swarm optimisation (PSO) (Alberto et al., 2009), fuzzy logic (FL) (Gopan and Shree, 2022; Raja and Rathinakumar, 2023), Tabu search algorithm (Pakdeeto et al., 2023), artificial neural networks (ANN) (Owusu et al., 2023; Rubaai and Young, 2015) and model predictive control (MPC) (Ubare and Sonawane, 2022) have been proposed to enhance the performance of PID controllers in BLDC motor applications. These intelligent tuning techniques provide adaptive and self-optimising capabilities that allow the controller to dynamically adjust PID parameters in real time. As a result, they offer improved resilience and performance under varying operating conditions, such as fluctuating motor loads, changes in supply voltage, nonlinearities and system disturbances. By leveraging these methods, control systems can achieve faster response times, reduced steady-state error and better overall stability, which are critical for high-performance motor drive applications. Especially, swarm optimisation algorithms such as PSO have been proved to be powerful and versatile techniques for solving complex, high-dimensional and non-linear problems. They are also good at global search with local optima evasion at the conference of larger search space by their stochasticity, population-based and parallel nature.
One of the main challenges in BLDC motor drives is the presence of cogging torque causing undesirable vibrations, noise and fluctuations in speed, affecting the precision and smoothness of motor operation. Various strategies have been employed to mitigate cogging torque, one of which is DC-link voltage pulse amplitude modulation (PAM) (Huang et al., 2022). This technique effectively smooths the motor’s torque output by modulating the voltage amplitude supplied to the motor drive, thereby reducing torque ripple and enhancing overall performance.
The development of sensorless control schemes for BLDC motors involves detecting an open-loop rotor position without physical position sensors such as Hall-effect sensors or encoders. Such a method allows cost reduction and system reliability enhancement and is also useful when sensors cannot be used. Sensorless control does away with physical sensors and estimates rotor position using methods like back-electromagnetic force (back-EMF) sensing, which works well at medium to high speeds but poorly at low speeds (Damodharan and Vasudevan, 2010); sliding mode observer (SMO) (Chen et al., 2000), which is robust but complex; extended Kalman filter (EKF) (Aishwarya and Jayanand, 2016), which is very accurate but computationally intensive; and flux linkage-based methods, which work well at low speeds (Gabriel and Nesimi, 2016). Furthermore, pulse-width modulation (PWM) strategies, including sine PWM (SPWM) with lower harmonics and space vector PWM (SVPWM) with higher efficiency, are also applied to control voltage and current (Gujjar and Kumar, 2017). The control method selection is application dependent; for basic applications, six-step commutation can be employed; for high-performance applications, field-oriented control (FOC)/direct torque control (DTC) could be chosen; and for cost-oriented solutions, sensorless control would be preferred (Bosso et al., 2021; Ozturk and Toliyat, 2011).
The Nelder–Mead optimisation method (Nelder and Mead, 1965) is one of the more effective alternatives to GAs and PSO for low-dimensional, smooth optimisation problems. One of its main advantages is the fast convergence without the use of gradients, therefore applicable to gradient-free optimisation problems. In addition, the Nelder–Mead use does not involve complicated stochastic processes like GA and PSO, as it uses a single simplex and fewer tuning parameters. This simplicity leads to less computational cost and more uniform and reproducible results. Therefore, it is common to use the Nelder–Mead method if the problem is unimodal and of low dimension and if fast and good local optimisation is required. The Nelder–Mead method, therefore, can be easily applied to tune the gains of a PID controller by minimising a chosen performance index. The method evolves a simplex of parameter sets by testing the control performance at every loop and adjusting PID parameters to be optimal expected behaviour without gradient information (Sinlapakun and Assawinchaichote, 2015).
Due to the substantial superiority of the Nelder–Mead method in comparison with other optimisation methods, this study proposes a systematic and precise algorithm for designing a digital PID controller for commercial sensorless BLDC motor drives. A PID parameter tuning using the Nelder–Mead optimisation algorithm is performed to minimise the weighted sum of a chosen performance index for obtaining better transient and steady-state responses of the BLDC motor drive. To verify and enhance the robustness of the Nelder–Mead optimisation algorithm for tuning PID controllers of BLDC motors, this study establishes a comprehensive and well-instrumented experimental platform. The hardware system is centred around a commercially available outer-rotor brushless DC (BLDC) motor, chosen for its widespread use in industrial and consumer applications due to its high efficiency and compact design. Motor control is achieved using a commercial sensorless BLDC motor converter, which eliminates the need for physical position sensors by estimating rotor position through back-EMF, thereby reducing hardware complexity and cost.
The remaining parts of this paper are organised as follows: Section 2 explains the digital PID controller. The key steps of using the Nelder–Mead optimisation method for tuning PID controllers are presented in Section 3. Simulink-based simulation of two common control methods for BLDC motor drives, the trapezoidal control and FOC methods, is described in Section 4. The experimental setting and results are carefully mentioned in Section 5. Finally, Section 6 summarises the paper and future work is discussed.
The PID controller belongs to fundamental feedback control systems extensively utilised in automation, robotics and industrial process control. It dynamically determines the error by measuring the deviation between the target setpoint and the actual process variable. To minimise this error, the controller applies a calculated corrective response based on three key components as follows:
The output of a PID controller is calculated as follows:
Taking the Laplace transform of Eq. (1) gives:
Eq. (6) can be rewritten as follows:
The Nelder–Mead method is a gradient-free optimisation method used to find the minimum of an objective function in a multi-dimensional space. It is particularly useful when derivatives of the objective function are unavailable or difficult to compute. This method is also known as the downhill simplex method. The deployment of the Nelder–Mead method includes the following steps:
Choose Compute the function value at each simplex vertex. Rank the points from best Update the worst point using one of the following transformations:
Continue iterating until a termination condition is met, such as:
Function values have small differences. The simplex size becomes small. A maximum number of iterations is reached.
The details of mathematical operations in the Nelder–Mead method can be described as follows:
If none of the above works, shrink all the points towards the best.
Typical values of
The Nelder–Mead optimisation method can be used to optimally tune the PID controller’s parameters, including The goal is to minimise an integral of time-weighted absolute error (ITAE) as follows:
Choose initial guesses for Create a simplex with 3 + 1 (i.e., 4) sets of parameters. Apply the PID gains to the system using a step response. Compute the objective function. Adjust Stop when a specified number of iterations is reached.
A BLDC motor has three individual phase windings and a permanent magnet rotor. The three-phase voltage equations for windings are as follows:

Block diagram of a BLDC motor drive. BLDC, brushless DC.
BLDC motor control methods can be broadly categorised into sensor-based and sensorless techniques, each offering distinct advantages based on application requirements. Sensor-based control utilises Hall sensors or rotary encoders to accurately detect the rotor position, ensuring precise commutation and smooth motor operation. Among the most common sensor-based methods, trapezoidal control (six-step control) is widely used due to its simplicity and cost-effectiveness. FOC, on the other hand, employs mathematical transformations to regulate torque and flux independently, delivering smooth operation and high efficiency but requiring complex computations. The sensorless control of BLDC motors eliminates the need for physical sensors by leveraging back-EMF detection or advanced estimation algorithms, reducing cost and increasing reliability, though it may be less effective at low speeds. The selection of a suitable control method depends on factors such as cost, precision, efficiency and the operational conditions of the motor. This section presents simulations for controlling the speed of a BLDC motor using two common methods: the trapezoidal control method and the FOC method. The parameters of the BLDC motor are as follows:
Stator phase resistance: Stator phase inductance: Flux leakage of the motor: Moment of inertia of the rotor: Damping constant: Pole pairs:
Figure 2 shows the Simulink diagram of trapezoidal control for BLDC motors. Based on Hall-effect sensors locating a fixed point within the motor housing to monitor the rotor position, this control method has been extensively applied in practical cases. The sensor signals give feedback and allow the motor phases to be energised at angles that are synchronised and accurate. This timed switching, or commutation, is an essential element to achieving the desired direction of rotation and for effective torque production.

Simulink diagram of the trapezoidal control of BLDC motors. BLDC, brushless DC; EMF, electromotive force; PWM, pulse-width modulation.
To adjust the motor speed, a PWM on the DC input voltage is utilised. A change in the duty ratio of the PWM will change the effective voltage applied to the motor, and the motor speed can be dynamically controlled in this way. Such a power modulation technique gives more freedom and energy efficiency to the controller in case of load variations and reference input variations. To show the control performance, the actual motor speed is compared with its commanded reference speed in Figure 3. The response indicates that the proposed controller effectively attenuates the tracking error, and the motor speed accurately tracks the reference value. The figure also plots the stator current waveform with a faster switching trapezoidal waveform.

Motor speed and stator current of the BLDC motor with the trapezoidal control method. BLDC, Brushless DC.
Trapezoidal control of BLDC motors, while simple and cost-effective, has several disadvantages that limit their suitability for high-performance applications. One of the main issues is torque ripple, which leads to vibrations and audible noise due to the abrupt switching of motor phases. This results in reduced smoothness and precision, making it less ideal for applications requiring fine motion control. Additionally, efficiency drops at low speeds, especially in sensorless configurations where back-EMF detection becomes unreliable. The control method also makes suboptimal use of the motor’s magnetic field, leading to lower overall energy efficiency compared to more advanced techniques like FOC. These drawbacks make trapezoidal control less suitable for applications that demand quiet operation, high efficiency, or precise control.
The Simulink model of the FOC applied to BLDC motors is illustrated in Figure 4. Unlike trapezoidal control, which requires Hall sensors for rotor position sensing, this is no longer necessary with the use of advanced mathematical transforms like Clarke and Park introduced by FOC. These transformations then decouple torque and flux components and allow for their independent and accurate control. FOC control can be seen as the most efficient current vector control and directs the current stator vector into the direction of the rotor magnetic field as a current vector, whereby a maximum torque is produced. This feature not only results in quieter, more efficient motor operation but also provides much more responsive system performance. The control system dynamically regulates the current of the motor in a real-time manner, which can adjust to the load demand requirement, together with the torque ripple, with better transient performance.

Simulink diagram of the FOC method of BLDC motors. BLDC, Brushless DC; FOC, field-oriented control; SVPWM, space vector PWM.
The superior dynamic response of FOC makes it especially well-suited for high-performance, high-precision applications. These applications include areas such as robotics, which depend on precise positioning and smooth motion; industrial automation systems, whose success is tied to reliability and precision of control; and, in the world of electric and hybrid vehicles, where high efficiency and responsive torque control result in improved mileage as well as improved performance. The speed response of the FOC-based system is evident in Figure 5, where it closely follows the reference speed command. As can be seen in the graph, the real speed of the motor approximates the desired speed. This highly precise tracking result ensures the robustness and accuracy of the FOC algorithm for achieving the desired operating conditions when the load or speed commands change. The small error between these reference speed and actual speed profile graphs shows the high fidelity of the system in real time as well.

Motor speed and stator current of the BLDC motor with the FOC method. BLDC, brushless DC; FOC, field-oriented control.
In conclusion, the choice between trapezoidal control and FOC for BLDC motors depends on the specific application requirements. Trapezoidal control offers a simpler and more cost-effective solution suitable for low-performance or budget-conscious systems, despite its limitations in torque smoothness and efficiency. On the other hand, FOC provides superior performance, efficiency and smooth operation across a wide speed range, making it the preferred option for demanding and high-performance applications, albeit at the cost of increased complexity and hardware demands.
This section provides a detailed procedure for deploying a digital PID controller for a commercial sensorless BLDC motor drive. The gains of the PID controller,
Figure 6 presents the detailed hardware setup designed for precise motor control applications. At the core of the system is a 12V brushless BLDC motor from Nidec (Japan), which functions as the main actuator, delivering accurate rotational motion. The motor is powered by a reliable 12 V power supply that ensures consistent performance. To facilitate real-time speed measurement and enable feedback-based control, a rotary encoder is coupled with the motor shaft. Instead of using Hall effect sensors, the system employs a commercial sensorless BLDC motor driver that relies on a three-phase inverter configuration to estimate the rotor’s position electronically. This reduces hardware complexity and enhances durability. The overall control and coordination of the system are handled by an Arduino Nano, a compact microcontroller built around the ATmega328P. The Arduino Nano offers a balanced of processing power, memory and input/output interfaces, making it ideal for embedded applications where space is limited but precise control is essential.

The hardware. BLDC, brushless DC.
To identify the transfer function of a system comprising both the motor and its driver, a procedure based on the step response of the motor speed is employed. First, a 5 V step voltage is applied to the driver, which powers the motor and acts as an excitation signal to reveal the system’s dynamic behaviour. Next, the motor’s speed response is measured over time using an encoder, with data sampled and stored at a sufficient rate to capture the dynamics accurately. Finally, the recorded speed data is imported into MATLAB (Mathworks), where the System Identification Toolbox is used to estimate the system’s transfer function. Various model structures, such as first-order or second-order transfer functions, are explored to determine the best fit for representing the combined motor and driver dynamics. By following this approach, an accurate mathematical model of the motor-driver system is obtained, which can be used for further analysis, control system design and performance optimisation. Figure 7 shows the response of the motor speed to a step voltage of 5 V applied to the control input of the BLDC motor driver.

Response of the real motor speed to a step voltage of 5 V.
The step input voltage and the motor speed response were used to identify the transfer function of the system, which includes both the motor and the driver, using the MATLAB System Identification Toolbox. The motor speed response was recorded with a sampling interval of 0.1 s. The transfer function of the entire system is modelled as a second-order system, as follows:
The design of an optimal PID controller for the system was conducted in a two-step process to ensure precise control, stability and optimal performance. The steps are detailed as follows:
num = 810.8; den = [1 2.366 2.76]; Gm = tf(num,den); C1 = pidtune(Gm,‘pid’); Kp1 = C1.Kp; Ki1 = C1.Ki; Kd1 = C1.Kd; Running the MATLAB script results in the following PID controller gains:
function S = objectiveFcn(x) s = tf(‘s’); Gm = 810.8/(s^2 + 2.366*s + 2.76); Kp = x(1); Ki = x(2); Kd = x(3); Gc = pid(Kp,Ki,Kd); T = 0.01; t = 0:T:10; e = 1 − step(feedback(Gc*Gm,1),t); S = sum(t’.*abs(e));
num = 810.8; den = [1 2.366 2.76]; Gm = tf(num,den); C1 = pidtune(Gm,‘pid’); Kp1 = C1.Kp; Ki1 = C1.Ki; Kd1 = C1.Kd; optimInput = [Kp1 Ki1 Kd1]; options = optimset(‘Display’,‘iter’,‘PlotFcns’,@optimplotfval,‘MaxIter’,30); [a, fval] = fminsearch(@objectiveFcn,optimInput,options); Kp2 = a(1); Ki2 = a(2); Kd2 = a(3); The optimal values of the PID controller gains are given by:
As the sampling period,
The digital PID controller can be conveniently deployed on the Arduino Nano board by using a C script as follows:
volatile long temp, counter; int Ts = 100; volatile long encoderValue = 0; long previousMillis = 0; long currentMillis = 0; void setup(){ Serial.begin (9600); pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); attachInterrupt(0, ai0, RISING); attachInterrupt(1, ai1, RISING); } void ai0(){ if (digitalRead(3) == LOW) counter++; else counter--; } void ai1(){ if (digitalRead(2) == LOW) counter--; else counter++; } float a = 0.0165; float b = 0.0019; float c = 0.073; float rk = 800; float yk = 0; float uk = 0; float ek = 0; float ek_1 = 0; float pk = 0; float pk_1 = 0; float qk = 0; void loop() { currentMillis = millis(); if (currentMillis − previousMillis >= Ts){ previousMillis = currentMillis; yk = (float)counter*3/4; Serial.println(yk); ek = rk − yk; pk = pk_1 + b * ek; qk = c * (ek − ek_1); uk = a * ek + pk + qk; if (uk >= 255){ uk = 255; } if (uk <= 0){ uk = 0; } ek_1 = ek; pk_1 = pk; analogWrite(5, uk); counter = 0; } }
Figure 8a–c illustrate the motor speeds corresponding to reference speeds of 500 rpm, 700 rpm and 900 rpm, respectively. These graphs highlight the system’s dynamic behaviour and provide a comparative analysis of two PID control strategies. The first strategy utilises the initial PID controller gains, while the second applies the Nelder–Mead optimised PID controller gains. Based on the comparisons between the initial and optimised PID controllers, as shown in Tables 1–3, it is evident that the Nelder–Mead optimised PID controller achieves a shorter settling time, which refers to the time required for the motor speed to stabilise and reach the reference speeds. This marks a significant improvement over the initial PID controller, which takes longer to reach the desired speeds. The reduced settling time demonstrates the optimised controller’s superior performance, allowing the system to respond more quickly and efficiently to changes in input or reference speed. This enhancement in response time is critical for applications requiring rapid and precise motor control, further validating the effectiveness of the Nelder–Mead optimisation method in tuning PID controller gains for improved system performance.

Motor speed responses for reference speeds of 500 rpm (a), 700 rpm (b) and 900 rpm (c).
Performance comparison between the initial and optimised PID controllers at a speed of 500 rpm.
Controller | Rise time (s) | Settling time (s) | Overshoot (%) |
---|---|---|---|
Initial PID controller | 3.5867 | 6.8628 | 0.0899 |
Optimised PID controller | 1.6477 | 2.8985 | 0.6736 |
Performance comparison between the initial and optimised PID controllers at a speed of 700 rpm.
Controller | Rise time (s) | Settling time (s) | Overshoot (%) |
---|---|---|---|
Initial PID controller | 3.7983 | 6.5593 | 0.4619 |
Optimised PID controller | 1.6200 | 3.8898 | 0.2130 |
Performance comparison between the initial and optimised PID controllers at a speed of 900 rpm.
Controller | Rise time (s) | Settling time (s) | Overshoot (%) |
---|---|---|---|
Initial PID controller | 3.5867 | 6.3841 | 0.1332 |
Optimised PID controller | 1.3312 | 2.4900 | 0.2745 |
This study presents a comprehensive and methodical framework for the design of an optimised digital PID controller specifically tailored for commercial sensorless BLDC motor drives. The proposed optimisation approach leverages the Nelder–Mead simplex algorithm, a derivative-free technique well-suited for non-linear, multidimensional optimisation problems where the objective function may be discontinuous, noisy or lacking an easily computable gradient. Unlike traditional gradient-based methods, which rely on explicit derivative calculations and may struggle with non-convex or irregular search spaces, the Nelder–Mead algorithm uses a simplex of points that iteratively adapts through operations such as reflection, expansion, contraction and shrinkage. This enables efficient exploration of the parameter space, resulting in fine-tuned PID gains that enhance dynamic response characteristics such as reduced overshoot and faster settling time. One of the core strengths of the Nelder–Mead method lies in its ease of implementation and adaptability to a wide range of real-world engineering problems, making it particularly attractive for embedded systems and digital control applications where computational resources may be limited. While this study validates the effectiveness of Nelder–Mead optimisation in tuning PID controllers for BLDC motor drives, it also lays the groundwork for future investigations aimed at comparative performance analysis. Subsequent research will focus on evaluating the relative strengths and limitations of the Nelder–Mead algorithm against other popular direct search-based optimisation techniques, such as GA and PSO. These algorithms are well-established in control system optimisation and have demonstrated significant potential in various motor control applications due to their global search capabilities and adaptability to complex optimisation landscapes.