top of page

Design of PID Controller for Speed Control of BLDC Motor

9 minutes ago
8 min read

Design of PID Controller for Speed Control of BLDC Motor


𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧

Brushless DC motors are widely used in electric drives because of their high efficiency, fast dynamic response, compact construction, and low maintenance requirements. However, maintaining a constant motor speed becomes challenging when the load torque or reference speed changes.


Design of PID Controller for Speed Control of BLDC Motor


Design of PID Controller for Speed Control of BLDC Motor


Design of PID Speed Controller for BLDC MOTOR in MATLAB
₹4,000.00₹2,000.00
Buy Now


This MATLAB/Simulink model demonstrates the design of a PID-based speed control system for a BLDC motor. The motor model is first analyzed by collecting input-output data, and a transfer function representation is obtained using the System Identification Toolbox. The identified model is then used to select controller parameters and implement closed-loop speed regulation.

The simulation demonstrates:

  • BLDC motor operation using a six-step voltage source inverter

  • Hall sensor-based rotor position detection

  • Hall signal decoding

  • Back-EMF-based inverter switching

  • BLDC motor input-output data collection

  • Transfer function estimation

  • PI/PID controller implementation

  • Reference-speed tracking

  • Load disturbance rejection

  • Dynamic speed-response analysis

𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰

The complete BLDC motor speed-control system consists of the following major sections:

Component

Function

DC/Controlled Voltage Source

Supplies the required motor input voltage

Voltage Source Inverter

Converts DC voltage into three-phase switching voltage

BLDC Motor

Converts electrical power into mechanical motion

Hall Sensors

Detect rotor position

Hall Decoder

Converts Hall sensor states into commutation information

Back-EMF Logic

Determines the correct inverter switching sequence

Gate Pulse Generator

Produces switching signals for six inverter switches

Speed Measurement

Measures actual rotor speed

PI/PID Controller

Regulates BLDC motor speed

Load Torque Input

Introduces mechanical loading conditions

Scope/Workspace

Records and analyzes simulation results

The model therefore combines the power circuit, BLDC motor, commutation logic, feedback measurement, and closed-loop speed controller in a single MATLAB/Simulink environment.

𝐁𝐋𝐃𝐂 𝐌𝐨𝐭𝐨𝐫 𝐃𝐫𝐢𝐯𝐞 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞

The basic power flow of the system is:

Controlled DC Voltage Source → Voltage Source Inverter → BLDC Motor → Mechanical Load

The feedback and control flow is:

Hall Sensors → Decoder → Back EMF/Commutation Logic → Gate Pulses → Inverter

For closed-loop speed control:

Reference Speed → Speed Error → PI/PID Controller → Controlled Voltage Source → BLDC Motor

This structure allows the motor speed to automatically adjust whenever the reference speed or load torque changes.

𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬

1. DC Input Supply

The BLDC motor drive is initially supplied from a controlled voltage source.

In the demonstrated operating condition:

Parameter

Value

Input Voltage

400 V

Initial Reference Speed

3000 rpm

Initial Load Torque

0 N·m

Changed Load Torque

3 N·m

Load Change Time

0.1 s

Simulation Sample Time

5 × 10⁻⁶ s

The controlled voltage source later receives its command from the speed controller.

2. Voltage Source Inverter

The BLDC motor is supplied through a three-phase voltage source inverter.

The inverter contains six semiconductor switches and operates using a six-step commutation sequence.

The inverter is responsible for:

  • Energizing the correct BLDC motor phases

  • Controlling the motor terminal voltage

  • Producing the required phase-current sequence

  • Maintaining proper electromagnetic torque production

Correct switching of the inverter is essential for smooth BLDC motor operation.

3. Hall Sensor Signal Measurement

The BLDC motor provides Hall sensor information corresponding to the rotor position.

The Hall sensors allow the controller to determine:

  • Rotor sector

  • Required conducting phases

  • Correct switching sequence

  • Appropriate inverter commutation instant

Hall sensor feedback eliminates the need for complicated rotor-position estimation in this control structure.

4. Hall Signal Decoding

The measured Hall signals are passed through a decoder block.

The decoder converts the Hall sensor combinations into information representing the motor's commutation state.

This decoded information is then used to determine the corresponding back-EMF pattern.

The process can be summarized as:

Rotor Position → Hall Signals → Decoder → Back-EMF Pattern

5. Generation of Inverter Gate Pulses

The back-EMF information is used to generate the inverter switching pulses.

The control logic determines whether each back-EMF signal is:

  • Greater than zero

  • Less than zero

  • At the commutation transition

Based on these conditions, the required switching pulses are generated for the six inverter switches.

This produces the standard six-step BLDC commutation sequence.

𝐖𝐡𝐲 𝐒𝐩𝐞𝐞𝐝 𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐈𝐬 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐝

Without closed-loop control, BLDC motor speed can vary due to:

  • Changes in mechanical load

  • Changes in supply voltage

  • Motor parameter variations

  • Speed-command variations

  • Starting conditions

  • External disturbances

A PI/PID controller continuously compares the reference speed with the actual motor speed and adjusts the motor input accordingly.

This improves:

  • Speed accuracy

  • Settling time

  • Load disturbance rejection

  • Reference tracking

  • Overall drive stability

𝐁𝐋𝐃𝐂 𝐌𝐨𝐭𝐨𝐫 𝐓𝐫𝐚𝐧𝐬𝐟𝐞𝐫 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝐈𝐝𝐞𝐧𝐭𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧

Before tuning the controller, the dynamic behavior of the BLDC motor needs to be identified.

Instead of manually deriving the mathematical motor model, the simulation uses MATLAB's System Identification Toolbox.

Input and Output Selection

For system identification:

Signal

Selected Variable

System Input

BLDC motor input voltage

System Output

BLDC motor rotor speed

The motor is operated with a known voltage input, while the corresponding speed response is recorded.

𝐃𝐚𝐭𝐚 𝐂𝐨𝐥𝐥𝐞𝐜𝐭𝐢𝐨𝐧 𝐏𝐫𝐨𝐜𝐞𝐬𝐬

The following procedure is used:

  1. Apply 400 V to the BLDC motor drive.

  2. Run the motor at the required operating condition.

  3. Change the mechanical load during simulation.

  4. Measure the motor input voltage.

  5. Measure the motor output speed.

  6. Export both signals to the MATLAB Workspace.

  7. Use these signals for system identification.

For disturbance analysis, the load torque is changed from 0 N·m to 3 N·m at 0.1 s.

This provides useful transient information for identifying the motor dynamics.

𝐒𝐲𝐬𝐭𝐞𝐦 𝐈𝐝𝐞𝐧𝐭𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐔𝐬𝐢𝐧𝐠 𝐌𝐀𝐓𝐋𝐀𝐁

The collected input-output data is imported into the System Identification Toolbox.

Basic Procedure

  • Open System Identification.

  • Select Import Data.

  • Choose Time Domain Data.

  • Enter the input variable.

  • Enter the output variable.

  • Set starting time to 0 s.

  • Enter the simulation sampling time.

  • Import the data.

  • Select Estimate.

  • Choose Transfer Function Model.

  • Specify the required transfer-function structure.

  • Estimate the model.

For the demonstrated system:

Identification Setting

Value

Start Time

0 s

Sampling Time

5 × 10⁻⁶ s

Number of Poles

1

Number of Zeros

1

MATLAB then estimates the dynamic relationship between the motor input voltage and rotor speed.

𝐏𝐈/𝐏𝐈𝐃 𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫 𝐃𝐞𝐬𝐢𝐠𝐧

After identifying the motor model, the control system is converted into a closed-loop speed-control system.

The controller receives the difference between:

  • Reference motor speed

  • Actual motor speed

The controller output is connected to the controlled voltage source.

For the demonstrated PI implementation, the controller parameters include:

Controller Parameter

Demonstrated Value

Proportional Gain

1

Integral Gain

318.4

The exact controller gains can be further tuned depending on:

  • Motor rating

  • Desired rise time

  • Allowed overshoot

  • Required settling time

  • Load variation

  • Simulation model parameters

𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲

The controller works continuously through feedback.

Step 1 — Reference Speed

A desired speed command is given to the motor controller.

Example:

3000 rpm

Step 2 — Actual Speed Measurement

The actual rotor speed is measured from the BLDC motor.

Step 3 — Speed Comparison

The actual motor speed is compared with the reference speed.

Step 4 — Controller Action

The PI/PID controller processes the speed difference and generates the required control command.

Step 5 — Voltage Adjustment

The controller output changes the controlled DC-link/input voltage.

Step 6 — Motor Response

The inverter supplies the corresponding three-phase voltage to the BLDC motor.

Step 7 — Continuous Feedback

The process repeats continuously until the motor speed reaches the required reference.

𝐋𝐨𝐚𝐝 𝐃𝐢𝐬𝐭𝐮𝐫𝐛𝐚𝐧𝐜𝐞 𝐓𝐞𝐬𝐭

An important test of a motor controller is its ability to maintain speed when the mechanical load changes.

The simulation introduces the following load condition:

Time

Load Torque

Before 0.1 s

0 N·m

After 0.1 s

3 N·m

When the load increases:

  • Motor speed temporarily decreases.

  • The speed controller detects the error.

  • Controller output increases.

  • Motor electromagnetic torque increases.

  • Rotor speed gradually returns toward the reference.

This demonstrates the disturbance-rejection capability of the closed-loop controller.

𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐒𝐩𝐞𝐞𝐝 𝐂𝐡𝐚𝐧𝐠𝐞 𝐓𝐞𝐬𝐭

The controller is also tested by changing the reference-speed command.

The simulation demonstrates a step change from a higher operating speed to a lower speed command.

Condition

Value

Initial Speed Reference

3000 rpm

Speed-Command Change Time

Approximately 0.1 s

Approximate Settling Duration After Change

0.03 s

After the reference changes:

  • The controller immediately detects the new command.

  • Motor input voltage is adjusted.

  • Rotor speed decreases.

  • A short transient occurs.

  • Motor speed settles close to the new reference.

This verifies the controller's reference-tracking performance.

𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬

The speed response shows two important operating characteristics.

Starting Response

During motor starting:

  • A transient speed overshoot may occur.

  • The controller quickly reduces the speed error.

  • Speed reaches approximately 3000 rpm.

  • The motor then operates close to the reference value.

Load Change Response

When the load changes at approximately 0.1 s:

  • Motor speed experiences an undershoot.

  • The controller increases its corrective action.

  • Rotor speed recovers toward the reference.

  • Steady-state speed error is significantly reduced.

Reference-Speed Tracking

When the speed reference changes:

  • The motor responds immediately.

  • A transient variation is observed.

  • The controller drives the motor toward the new command.

  • The response settles within a short duration.

𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞 𝐒𝐮𝐦𝐦𝐚𝐫𝐲

Test

Observed Response

Motor Starting

Initial transient followed by stable operation

3000 rpm Tracking

Motor reaches the commanded speed

Load Torque Increase

Temporary speed reduction

Controller Recovery

Speed returns toward its reference

Reference-Speed Change

Motor follows the new speed command

Approximate Dynamic Settling

Around 0.03 s for the demonstrated reference change

Closed-Loop Stability

Stable response after transient conditions

𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬

  • MATLAB/Simulink-based BLDC motor simulation

  • Six-step voltage source inverter

  • Hall sensor-based electronic commutation

  • Hall signal decoding

  • Back-EMF-based switching logic

  • Automatic gate-pulse generation

  • Motor input-output data acquisition

  • MATLAB System Identification Toolbox integration

  • Transfer-function estimation

  • PI/PID-based closed-loop speed control

  • Load torque disturbance analysis

  • Variable speed-command testing

  • Rotor-speed monitoring

  • Electromagnetic torque measurement

  • Suitable for controller-design studies

𝐀𝐝𝐯𝐚𝐧𝐭𝐚𝐠𝐞𝐬 𝐨𝐟 𝐂𝐥𝐨𝐬𝐞𝐝-𝐋𝐨𝐨𝐩 𝐁𝐋𝐃𝐂 𝐒𝐩𝐞𝐞𝐝 𝐂𝐨𝐧𝐭𝐫𝐨𝐥

The proposed control structure provides several practical advantages:

  • Maintains the desired BLDC motor speed

  • Compensates for load variations

  • Reduces steady-state speed error

  • Improves dynamic performance

  • Provides fast reference tracking

  • Offers straightforward controller implementation

  • Allows easy controller tuning in MATLAB

  • Supports detailed transient-performance analysis

  • Can be extended to advanced intelligent controllers

𝐖𝐡𝐲 𝐔𝐬𝐞 𝐒𝐲𝐬𝐭𝐞𝐦 𝐈𝐝𝐞𝐧𝐭𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧?

Developing an analytical BLDC motor model can become complicated because motor dynamics involve:

  • Electrical parameters

  • Mechanical parameters

  • Back EMF

  • Electromagnetic torque

  • Switching operation

  • Load disturbances

System identification provides a practical alternative.

Using measured simulation data, MATLAB can estimate an approximate dynamic model that can then be used for controller tuning.

This approach is particularly useful when the complete mathematical parameters of the motor are unavailable.

𝐖𝐡𝐲 𝐔𝐬𝐞 𝐚 𝐏𝐈/𝐏𝐈𝐃 𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫?

PI and PID controllers remain widely used in motor-drive applications because they are:

  • Simple to understand

  • Easy to implement

  • Computationally efficient

  • Suitable for real-time applications

  • Effective for constant-speed regulation

  • Easy to tune using MATLAB tools

For BLDC speed regulation, the integral action is particularly useful for minimizing steady-state speed error.

A full PID structure can additionally provide derivative action when faster transient shaping is required.

𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬

BLDC motors with closed-loop speed control can be used in:

  • Electric vehicles

  • Electric bicycles and scooters

  • Robotics

  • Industrial automation

  • CNC machines

  • Pumps

  • Fans and blowers

  • Compressors

  • Aerospace actuators

  • Automated manufacturing systems

  • Battery-powered equipment

  • Servo-drive systems

  • Renewable-energy-based motor drives

  • Precision motion-control systems

𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐎𝐮𝐭𝐜𝐨𝐦𝐞𝐬

By studying this MATLAB/Simulink model, learners can understand:

  • How a BLDC motor operates with a six-step inverter

  • How Hall sensors are used for rotor-position detection

  • How Hall signals are decoded

  • How inverter switching pulses are generated

  • How motor voltage and speed data are collected

  • How system identification is performed in MATLAB

  • How a transfer-function model is estimated

  • How a closed-loop speed controller is implemented

  • How controller gains affect speed response

  • How the system reacts to load changes

  • How reference-speed tracking is evaluated

𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧

The Design of PID Controller for Speed Control of BLDC Motor demonstrates a complete MATLAB/Simulink workflow for developing a closed-loop BLDC motor drive.

The simulation combines Hall sensor-based commutation, a six-step voltage source inverter, motor data acquisition, transfer-function identification, and PI/PID speed control. The motor response can be tested under both reference-speed changes and mechanical load disturbances.

The simulation results show that the controller can regulate the BLDC motor near the desired speed, recover from load disturbances, and follow changing speed commands with a relatively fast dynamic response.

This model provides a clear and practical platform for students, researchers, and engineers interested in BLDC motor control, PID controller design, system identification, power electronics, and MATLAB/Simulink-based motor-drive analysis.


Comments


bottom of page