# Motor Control, Part 2: BLDC Motor Control

From the series: Motor Control

In this video, we’ll discuss what kind of control algorithm you need to control a BLDC motor. We’ll explore the behavior of different signals of this control algorithm and also discuss the concept of inductive flyback.

In the previous video, we introduced a BLDC motor that has three coil windings in the stator and a single pole pair in the rotor. We also talked about how motion is generated in the BLDC motor through the six-step commutation or trapezoidal control, where the correct phases are commutated every 60 degrees for continuous rotation of the motor.

Here, we have a DC voltage source that provides a constant voltage to the three-phase inverter, which converts the DC power to three-phase currents to energize different coil pairs. When the applied voltage is constant, the motor turns at a constant speed due to the proportional relationship between voltage and speed. But if we want to control the motor at different speeds, then we need to build a controller that will adjust the magnitude of the applied voltage. Let’s first build a diagram of this controller.

Here’s our motor. To control it, we first need to measure its angular position and speed by using sensors such as the hall effect sensor. Note that the hall sensor doesn’t provide information on precisely where the rotor is within a sector. But instead it allows to detect when the rotor transitions from one sector to another. And actually, sector information is all we need to know to determine when to commutate the motor. But we still don’t know which two out of three phases to commutate. The correct phases are specified by a commutation logic circuit that computes the switching pattern for the three-phase inverter. Let’s also see visually how these blocks interact with each other. In the commutation logic table, the letters A, B, and C stand for the three phases of the motor; the high side of the three-phase inverter is labeled with H and low side with L. To see how the switches of the inverter and the BLDC commutation work based on the commutation logic, let’s replace this part with our previous animation. If the rotor is within the first sector, the commutation logic selects this switching pattern, which dictates an on state for the high side switch of phase A and the low side switch of phase C. As the rotor transitions to other sectors, a switching pattern is selected accordingly and sent to the three-phase inverter.

We got the motor spinning because now we know when to commutate the rotor and which phases to energize during each commutation. Our next goal is to make the motor spin at different speeds.

Currently, we input a constant DC voltage to the inverter, which leads to constant speed, as we discussed before. We can adjust this voltage by closing the loop with a suitable controller. Based on the difference between the desired and measured speed, the controller will adjust the voltage to bring the motor speed close to the desired value. Here note that the commutation logic also belongs to the control algorithm which is shown with light blue on the diagram. And all the components of the physical system are shown with light gray. Such a motor control algorithm can be implemented in a simulation environment as seen here. Note that here we assume we’re changing the voltage in an ideal manner to demonstrate the operation, but in reality we need to use PWM, which we’ll discuss in the next video. If you want to learn how to build this model, don’t forget to check out the links below this video. Colored boxes show how different parts of the control algorithm map to subsystems in the Simulink model. This model logs signals such as speed, voltage, current, and torque. To explore these, let’s run the model and first look at the desired speed. As you see here, it ramps up from 100 to 500 rpm in 100-rpm increments. If we now look at the voltage, we see how it’s adjusted by the controller to make the motor rotate at the desired speed as seen on the measured speed.

One thing we immediately notice is the ripples in this speed signal. Here we have another plot showing when the rotor transitions between sectors. Looking at the sector and the speed plots together shows us that speed ripples have something to do with commutation because the rippled pattern aligns with the beginning of each commutation cycle. Remember what happens during commutation. One of the phases is pulled high while the other one is pulled low, and the third phase is open. If the three-phase currents changed as seen in this plot during commutation, then we wouldn’t observe any rippled pattern in the speed. But in reality, when we drive a phase, the current doesn’t change instantaneously. Looking at the three-phase currents, we see how they rise over time, which in turn leads to ripples in the speed. And speed is not the only affected signal, but we observe ripples in the torque response as well, as current and torque are proportionally related. The ripples in the torque response are considered one of the drawbacks with trapezoidal control of BLDC motors.

Did something catch your eye when we looked at the three-phase currents? When a phase is pulled high from an open-phase state, a sudden jump occurs in the phase current before it starts to rise again. At the same time, another jump occurs in the phase that’s been kept low during commutation. To better understand the reason behind these instantaneous changes in the energized phases, let’s look at this animation. During commutation, the magnetic fields get established on the energized phases as the phase currents grow. At commutation, one of these phases, in this case phase A, becomes an open circuit and therefore the established field on this opened phase collapses. So the phase current drops to zero.

Let’s rewind this to see what happens to phase B and C right at the commutation. When phase C, that has a fully established field, connects to phase B, nearly instantaneously the established field on C collapses while at the same time phase B establishes a field in response to the collapse. Due to this suddenly established field at phase B, we observe a jump in the phase B current. And due to the collapse at phase C, we observe a sudden decrease in the current, which drops to half of its magnitude since the fields at B and C find an equilibrium at 50% field strength. As a result of these instantaneous changes in the phase currents, we observe spikes in the three-phase voltages. This phenomenon we just described is called inductive flyback.

Let’s wrap up what we’ve seen in this video. We first discussed the different elements of the control algorithm that decides when to commutate the motor and which phases to energize during commutation. We then showed how the speed of the motor can be controlled by adjusting the voltage by a controller. Here, we assumed an ideally controllable voltage source, but in reality we need a method such as PWM to convert the constant DC voltage to AC voltage. In the next video, we’ll update our control algorithm to control the motor speed using PWM. For more information on motor control, don’t forget to check out the links below this video.