BLDC motor and controller theory

A project log for Gator Quad

Personal project to develop a quad copter using as much self designed circuitry and software as possible.

ridonkulusridonkulus 11/13/2014 at 21:341 Comment

What is a motor controller? Why do we need it? What circuit topologies are commonly used? These are all good questions and I will try to provide a little bit of background from my limited knowledge on the subject.

DC Motors:

Let us start with the Motor. DC motors rely on the fact that current running through loops of wires produce magnetic field. That generated magnetic field in turn then produces a torque on a magnet (permanent or electromagnetic) causing it to turn. The wires are wound in such a way, and current supplied in the right order that the motor continues to spin round and round. This process is called commutation.

Brushed DC Motor:

A brushed DC motor is called as such because the commutation process (the correct order of applying DC current to cause rotation) is typically done through carbon brushes pressed up against the commutator pads on the rotor of the motor. The current is supplied by a constant DC source. This process is also called internal commutation. While this process is initially inexpensive, reliable, and relatively simple, the brushes wear out over time and cause maintenance and repair down the road. Controlling speed is as simple as varying the voltage of the constant supply connected to the brushes and in turn increasing current. Below is an example of a basic brushed DC motor.

Brushless DC Motor:I am using a brushless DC motor. The motor I selected has a 12 pole permanent neodymium magnet rotor, and a 9 winding stator that is split up into three main phases. Brushless DC motors are also called electrically commutated motors. This is because the commutation process is done entirely by electronic control and not mechanically. Typical brushless DC motors use a rotating permanent magnet in the rotor, and a stationary electrical current / coil magnets on the motor housing for the stator. However sometimes the motor housing can be the permanent magnet rotor and surround the electrical winding's in the stator. This type of motor configuration is called an outrunner motor, as opposed to the former configuration which is an inrunner. The outrunner configuration allows for higher torque while the inrunner counterpart has higher rpm capabilities. The turnigy 28-30s motor is an outrunner motor. Since the windings carrying current from the power source are not rotating the same method of commutation as a brushed motor will not work. Instead now controller circuitry is needed to know when to apply the correct voltages to the windings. In our case we will be using a microprocessor to determine when to correctly change the supplies connected to the motor windings. Below are some pictures of my BLDC motor.
Stator with windings
Permanent magnet rotor
Put together motor

Brushless motors offer several advantages over brushed DC motors, including more torque per weight, higher efficiency, increased reliability, reduced noise, less lifetime maintenance, as well as the elimination of ionizing sparks from the commutator. For these reasons BLDC motor's are a great inexpensive choice for model aircraft and is why I am using one. From here on out the rest of this post will be on the discussion of controlling a BLDC motor.

Control Methodologies:

The controller is in charge of directing the rotor rotation, but the controller requires some means of determining the rotor's orientation/position (relative to the stator coils.) Some designs use Hall effect sensors or a rotary encoder to directly measure the rotor's position. Others measure the back EMF in the undriven coils to infer the rotor position, eliminating the need for separate Hall effect sensors, and therefore are often called sensor-less controllers. My design is using Hall effect sensors to correctly sense and advance the position of the rotor. This will be discussed more further down.

Controllers that sense rotor position based on back-EMF have extra challenges in initiating motion because no back-EMF is produced when the rotor is stationary. This is usually accomplished by beginning rotation from an arbitrary phase, and then skipping to the correct phase if it is found to be wrong. This can cause the motor to run briefly backwards, adding even more complexity to the startup sequence. Other sensor-less controllers are capable of measuring winding saturation caused by the position of the magnets to infer the rotor position.

3 Phase H-Bridge and Power Electronics:A typical controller contains 3 bi-directional outputs (i.e. frequency controlled three phase output), which are controlled by a logic circuit (in our case a microcontroller.) These three bi-directional outputs are controlled by switches. In order to spin the motor at appreciable speeds these switches need to be able to turn on and off very fast. Mechanical relays and switches do not have the switching speed necessary to accomplish this. Additionally mechanical devices will wear out really fast considering the high number of times that the switch will be turning on and off to complete rotation after rotation.

Enter the MOSFET. A MOSFET is an electronic switch and is turned on and off by applying a voltage differential across a certain portion of its structure causing an electrical change in the silicon and causes electricity to conduct. A MOSFET is a three terminal device and typically voltage bias is applied to the gate with respect to ground, while current flows from drain to source or source to drain.

Schematic symbol and MOSFET packaging

MOSFET's have several distinct advantages over mechanical switches. MOSFET's are smaller in physical size, have high switching speeds, require lower driving voltages (a.k.a. lower driving power) is needed, and there is no mechanical wear out. Below is a typical 3 phase bi-directional MOSFET switch setup for a 3 phase load or in this case a BLDC motor. This configuration is often called a 3 phase H-Bridge.
3 phase transistor based H-Bridge
A wide range of voltages, currents, and subsequently power throughput can be applied to MOSFET's, a designer just has to know what the application / load characteristics are and the design of the chosen MOSFET can handle. The motor that I have chosen can handle a max of 20A of current. I decided to pick a MOSFET (60A Max) that can handle way over that in case I want to bump up the motor size or have current spikes while driving the motor. There are also two types of MOSFET's N-Channel and P-Channel. In my H-Bridge design all 6 transistors will be N-Type due to the fact that N-Type MOSFETS have lower "ON State Resistance" and will consume less power when sourcing current to the motor.Gate Drivers:

A neat characteristic of MOSFET's is that they do not require much current or power to stay in the conducting or non conducting state. The only power being consumed by the transistor is the load current running through the small amount of resistance between the drain and source Rds(on). They do however consume current and power when in the "In between" stage while switching on or off. This is due to the fact that there is a small amount of capacitance at the gate that needs to be charged or discharged to change from the non conducting (cutoff) region to the conducting (saturation) region and vice-versa. This current is fed through the gate by whatever device or circuit is applying the bias to turn the transistor on and off. Depending on the design of the MOSFET, and the speed at which the MOSFET is being switched, the current can vary from a few micro amps to hundreds of miliamps and even amps of current. Often times it is desirable to switch a MOSFET from the GPIO of a microcontroller, but these devices cannot source the required current to charge the gate capacitor. This can result in slow switching speeds, damaging of devices, and unwanted switch on and switch off. Therefore often times a special circuit called a "Gate Driver" is used. A "Gate Driver" aptly named because the gate pin is the driven / biased pin on a MOSFET. A gate driver circuit is able to source much more current to the gate capacitor, can itself be turned on and off by a microcontroller, and is a great buffer between control logic and the power transistor.

Additionally in the event of having two N-channel MOSFETs in series with eachother as in the case of the three phase H-Bridge, if the lower transistor is switched off the source of the higher transistor becomes floating. In this case in order to get the gate properly biased in order to turn on the transistor the voltage needs to be biased positively with respect to the DC rail. In order to accomplish this a charge pump circuit is often used to provide higher DC voltages with respect to the supply rail. Another method that can be used is a Gate Driver Transformer (GDT) that Isolates the supplies from each other through a ferrite core. The GDT cannot be used at low frequencies though. I will be using a charge pump method due to simplicity.

The Gate Driver that I selected has the ability to seperatly switch two N-Type transistors through a "Charge Pump" method called bootstraping. When the center of the bridge goes low (lower FET is on) the capacitor is charged via a bootstrap diode, and this charge is used to later drive the gate of the high side FET a few volts above the source pin's voltage so as to switch it on.

Sensors:Now that we have a Motor, Power Switches, and a method to drive those switches via a microcontroller we will tie it all together with the timing and sensing logic.Back EMF:
Back EMF control schema
The Back-EMF sensing technique is based on the fact that only two phases of a DC Brushless motor are connected at a time, so the third phase can be used to sense the Back-EMF voltage. The un-driven phase can be sampled through an ADC and when the Back-EMF crosses through 0 volts this represents the natural commutation point and the next commutation phase can begin. This is overly simplified and my motor controller will used a sensored approach first. A lot of documentation exists online about Back-EMF motor drivers so I plan on reading more documents like this and designs like this. A shout out to Benjamin Vedder on the previous link, his work is fantastic. A disadvantage of a Back-EMF system is that when the motor is at a standstill there is no way to detect what the next commutation should be because there is no Back-EMF yet. There are some methods to overcome this and are documented in online resources.Hall Effect Sensors:
Hall Effect Sensor control schema

The most common type of sensor used in BLDC motors is the Hall effect sensor. The Hall effect sensor is a sensing switch that outputs a logic level based on the detection of a magnetic field. Hall effect sensors are economical and because of the permanent magnets inside a BLDC motor are easy to install inside the motor. Some motors come with hall effect sensors pre-installed but the one I purchased did not. That is why I needed to figure out how and where to mount my hall effect sensors. This can vary from motor to motor based on the physical construction of the motor. The important thing to remember is that there are 6 commutation steps for one ELECTRICAL rotation, not mechanical rotation. Sometimes those can be the same thing but in the case of my motor there are 6 electrical rotations for every 1 Mechanical roation for a total of 36 commutation steps. Because of the six-step control scheme, there is no need for a high resolution output from the sensor. The thing you need to know is if the rotor advanced 60°. This can be known with three Hall effect sensors (one for each phase) and the output combinations they generate. The below figures show for every 60° there is a specific combination output from the three Hall effect sensors.

Hall sensor positions and commutation values
Voltage values per phase based on progress through 1 electrical rotation.

Regulation Methods:

The supply voltage is chopped at a fixed frequency with a duty cycle depending on the current error.

Therefore, both the current and the rate of change of current can be controlled. The two phase supply

duration is limited by the two phase commutation angles. The main advantage of the PWM strategy is

that the chopping frequency is a fixed parameter; hence, acoustic and electromagnetic noises are

relatively easy to filter. The PWM frequency is held constant while speed is controlled vial the duty cycle of the "ON" portion of the transistors. I will be using a PWM technique in my controller as it is better suited for a variable speed load.

PWM current regulation method

In the hysteresis-type current regulator, the power transistors are switched off and on according to

whether the current is greater or less than a reference current. The error is used directly to control the

states of the power transistors. The hysteresis controller is used to limit the phase current within a

preset hysteresis band. As the supply voltage is fixed, the result is that the switching frequency varies

as the current error varies. Therefore, the current chopping operation is not a fixed chopping frequency PWM technique. This method is more commonly implemented in drives where motor speed and load do not vary too much, so that the variation in switching frequency is small.

Hysteresis current control method


Thank you if you took the time to read this blog post. I hope it was helpful for some and that anyone took away a little somthing. At the very least this post was a good place for me to dump a lot of the knowledge that I had been gathering from reading across the internet and other resources. I promise more of my posts in the future will be on actual progress of building a motor controller and quad copter. I have attempted to gather all of the resources that I used to make this blog post below. Please use them to go more in depth on the subjects that I covered.


Wikipedia ArticlesWeb Articles / Published papersOther designers open source projects


vctrvlad wrote 06/08/2017 at 06:22 point

This is fantastic work, thank you, I will probably take some inspiration for my website.

With your approval, ofcourse!

  Are you sure? yes | no