Testing made possible by generous support from:

Brushless Drive and ESC Basics

Published: Sep 22, 2017

A brushless DC motor by itself is a relatively useless item. In reality it is only half of the equation to generate the mechanical energy that makes a mini-quad (or any brushless powered craft) move. For the purposes of this discussion I’m going to assume a certain base knowledge about how a 3 phase brushless motors achieves motion through the sequential magnetization of the phases in relation to the fixed magnets in the bell. We’re going to talk here in more detail about how that is achieved by the ESC, and how it impacts us as we combine motor and ESC.

Timing

While the motor bell is moving past the stators the non-active phase is being checked for the voltage level. As you know any magnetic field moving past a coil of wire creates a voltage in the wire that induces a current flow. As the non-active phases build up voltage from the motion of the motor, that voltage is measured by dedicated circuitry. The ESC can tell by how much voltage it is seeing on that line where the magnetic field of the bell is in relation to the phase being checked. In the ESC it is measured in degrees, though that is a virtual measurement, not a real angle. The assignment seems arbitrary, but it is related to the number of the phases in the motor. In the large majority of brushless motors there are three phases and two directions of current flow per phase, creating a total of 6 commutations. As a result, the ESC understands a measurement of 60 degrees (360 divided by 6) of magnetic field spanning from -30 to 30 degrees for each commutation. This voltage rise on the inactive phase is referred to as BEMF or Back Electro-Motive Force. Electro-motive force is simply another way of saying voltage, so really it just means back flowing voltage.

Image from https://softsolder.com/2011/07/10/stepper-motor-back-emf/As the voltage rises from its lowest point at -30 degrees it progresses to its highest point at 0 degrees and then back down to 30 degrees as it leaves the phase. In the simplest form, the ESC measures the magnetic field of the bell as it passes the 0 crossing and uses that information to energize the coils at exactly the right point to pull the field around the bell without missing. If ESC loses track of where in the rotation the bell is moving, the coils can energize in a way that exerts force on the bell in the opposite direction of rotation rather than the forward direction. When the motor loses track of the bell, this is called a “dsync”, a term which most of us know well and dread equally! Each calculation of the 0 crossing and energizing of the coils in the motor is called a commutation, and commutations happen 6 times for each fixed magnet pair in the motor for each rotation. So for a 12N14P motor with 7 opposing pairs of poles (fixed poles divide by 2) there will be 42 commutations per physical rotation.

The tunable setting in the ESC that impacts this prediction is called motor timing or timing advance. What this setting changes is the amount of time after the 0 crossing is detected that the ESC begins to energize the coil. 30 degree timing advance means the coils start energizing immediately after the 0 crossing on the inactive phase is detected, and 0 degrees means the ESC waits for the full waveform to decay before it fires the next phase. Based on our earlier discussion of kV, we know what factors impact how long the coil takes to energize. The timing setting in on the ESC allows us to compensate for those differences between motors that change the time it takes for the coils to energize as well as the differences in the size and shape of the BEMF waveform to which the ESC needs to react.

There are a couple of good news items here, one being that timing is quite forgiving for the most part on brushless motors given the way commutations are calculated in the ESC. Going to a higher timing means the ESC fires earlier in the BEMF decay which means you will waste some current in the coils before it is doing mechanically much good but it also typically means that the field strength the coil is generating will be stronger by the time the bell magnetic field is approaching. This gives you a bit more torque and thrust at the expense of a bit of efficiency.

Going too low can mean that the ESC may actually miss the next phase, which can cause desync, but it can also gain some efficiency and cool the coils down a bit as less energy is lost as heat. Fortunately you have to go quite low before that is a problem.

Most of the recent strong magnet motors will do fine on medium timing but you'll get some small gains by going to medium high and you'll gain some resistance to desync. Generally speaking for most people medium high is probably the safest option across the board. That equates to 23 degrees advance in BLHeli_32. It is probably safe to run up to 25 degrees, but going above that will see minimal gains and larger increases in current. If you stick between 16 and 25 (medium to medium high) you should never have an issue with timing. If there is an issue, it is pretty much guaranteed it's not related to timing and is usually a flaw somewhere else in the system.

Some ESCs, namely the KISS ESCs and the new BLHeli_32 ESCs, support auto timing, which calculates the timing on-the-fly based on the BEMF waveform. While this is a good feature, it is often optimized for efficiency rather than power, so it can cost some performance on the top end in exchange for a bit of smoothness and some small efficiency gains.

Output PWM and Deadtime

Another piece of information we need to understand is how the ESC energizes the coils on the stator and achieves the drive mechanics. The ESC has series of FETs which are basically high current digital switches. The MCU on the ESC uses pulse width modulation (PWM) to control the switching of the FETs to allow current to flow to the phases of the motor in the correct order and correct polarity. PWM has two properties that we care about, frequency and duty cycle. Frequency denotes how often the MCU begins a pulse, and duty cycle refers to what percentage of the period (or maximum expected width) is “on” and what percentage is “off.” In BLHeli and BLHeli_S the PWM frequency is fixed based on the hardware for each ESC, but in BLHeli 32 the PWM frequency can be adjusted up to 48khz. Keep in mind this is output only between the MCU and the FETs (or in most cases the dedicated gate driver chip) and is completely different from and completely independent of input update frequency.

Image from: https://acroname.com/articles/description-pulse-width-modulationOne of the interesting characteristics of PWM is that it actually acts as an analog simulation, essentially the same way a switching voltage regulator works to reduce the input voltage to a specified output voltage by chopping it up into smaller shorter pieces that average out to the lower voltage. Due to the properties of an inductor this also means that at low RPMs the BEMF waveform has very low amplitude, which can make it very hard to read.

At low throttle the PWM duty cycle between the ESC MCU and the FETs is very low, which simulates a low voltage. What we know from learning about the velocity constant (kV) we understand that as a result RPMs are low. As the throttle asks the ESC for more the MCU starts switching the FETS at a higher duty cycle which creates a simulated higher voltage, and resulting higher RPMs. Obviously based on our previous discussion of BEMF waves and timing, it's a lot more complex than that in actuality, but the functional outcome is a simulated analog voltage that is a certain percentage of the total battery voltage.

As we discussed earlier about the stator coils, the FETs in the ESC also have a rise time but in this case it has a larger impact on the ESC than it does on the motor. The rise time on a FET is the time between when MCU sends the signal and when current actually starts flowing through the closed switch. When the ESC is driving the motor it has to know how long to wait between switching phases. If the switch for the next phase closes before the switch for the current phase fully opens you get something called shoot-through, which is essentially a dead short between phases. As you can imagine this will fry an ESC extremely quickly.

The delay between switching phases is called deadtime. The deadtime selection is constrained by the rise time on the FETs, and circuit resistance between the gate driver and the FETs and is usually assigned by detailed testing at the time the ESC is designed. A poorly designed drive circuit can impact dead-time as equally as a poor choice of FETs. The drive circuit must be precisely matched to the FETs used in the ESC. In BLHeli the deadtime was invisible to the end user but was hard coded into each firmware file for each ESC. In BLHeli_S it is the source of the last two digits in the firmware name (A_H_XX). In both cases the deadtime numbers are a multiplier to a base time period that defines how long the ESC should wait between switching phases.

You typically don't want to change the deadtime multiplier as it is a fixed value for a specific ESC, but if you are getting very hot ESCs it is generally ok to go higher, but never ok to go lower on the deadtime multiplier. Some ESCs pass handling of the deadtime off to the dedicated gate driver chip (defined by the 00 deadtime multiplier.) Some of the drivers support true auto deadtime based on internal calculations (KISS and the TBS Bulletproof ESCs to name a few), but often the "auto" deadtime just means that the deadtime value has just been hard-coded in the gate driver.

As of yet I have not seen a significant performance difference between ESCs with low deadtime, and those with higher deadtime. The primary outcome is likely to be a slight increase in smoothness on ESCs with lower deadtime and a possible increase in braking force, though theoretically there could be some efficiency and power gains on ESCs with a well designed drive circuit, high quality FETs and a resulting fast switching frequency and very low deadtime. As we go up in PWM rate, lower deadtime also becomes more important and will show larger gains, particularly in braking.

Since they are somewhat similar in function it can be confusing to differentiate between motor advance timing and deadtime in the ESC. The core of what you need to remember is that deadtime handles the ESC side and timing handles the motor side.

Demag Compensation and Startup Power

The Demag and Startup Power parameters that I want to look at next are unique to BLHeli-based ESCs, but are the cause of some confusion and a good number of questions.

The demagnetization prevention in BLHeli is really two components. Back in the original BLHeli days both functions were operated from just one variable, Demag Compensation. In BLHeli_S it was split in half. Half of the functionality went into a new variable that gave more fine tuned control and half stayed in the same old demag variable. The part that split out moved to the Startup Power variable.

In the original BLHeli, the Startup Power variable only impacted the 0 rpm start, or the transition from not-spinning to spinning. A few things we have discussed previously give us some clues as to the importance of this setting. The first thing we learned is that the BEMF waveform used to synchronize the motor drive comes from the magnetic field moving past the coil. When the motor is not spinning there is no waveform to be read, which means during startup the ESC has to essentially guess to get the motor moving enough to read the BEMF waveform. We also mentioned that at low RPMs the amplitude of the waveform is very low, which further complicates the startup. As a result, being able to tune how much power is given to the motor during that initial phase is quite critical. In our application, since the motor bells and props are so light, it is not as significant an issue, but you can see that as the rotational mass increases it becomes more and more challenging, which is where tweaking this value would really be necessary.

In BLHeli_S this setting was changed so that it impacts any rapid acceleration of the motor, not just during that initial start phase. Previously this part of the functionality was lumped in with demag, but only had two settings, low and high. In its current iterations in BLHeli_S, Startup Power limits the acceleration of the motor by limiting the maximum PWM duty cycle allowed based on the current running RPMs. The lower the RPMs, the less maximum power the motor is allowed to give. The Startup Power option changes the degree of power reduction applied. Generally speaking this happens so fast that it is not extremely noticeable to the pilot, but it may impact the tune some and could feel a bit sluggish on the very low settings. This setting can be left at default in the majority of cases, and should only be reduced if there is an issue. Most of the time reducing Startup Power is a bandaid for a large issue however, so relying on it as a permanent solution could be problematic.

In BLHeli_32 the Startup Power setting has been renamed to Rampup Power in an attempt to clarify the fact that it impacts all changes in speed from low RPMs and not just when the motor initially starts, but it keeps identical functionality. A new setting, Maximum Acceleration has also been introduced. Maximum Acceleration is a new function designed to compensate for the different ways kV can impact the relationship between RPMs and power. Rather than use a direct relationship between RPMs and power like the Rampup Power setting, Maximum Acceleration uses the rate of change of power to limit the acceleration. This is particularly necessary for large stator, low kV motors out of the range of our mini-quad applications, so this setting is not something we will need to adjust.

In all versions of BLHeli, Demag Compensation makes some small changes to the commutation methodology that helps recover from potential desync situations. The demag setting checks for the BEMF signal more rigorously for bad reading and will suspend energizing the coil of a commutation to make the next 0 crossing easier to detect. Demag Compensation will also attempt to drive the motor without readings similar to the method used when the motor is first starting up, using the last known RPMs to predict the phase positions. The high and low settings change the threshold that BLHeli uses or the number of bad BEMF reads that it is willing to accept before compensating, and turning it off means BLHeli will not attempt correct for bad readings at all. This functionality is the same in all revisions of BLHeli.

When setting demag to high you may loose some small power and acceleration due to the increased error checking and compensation, so generally speaking low is a good balance between desync resistance and responsiveness.

These settings came to focus in the early days of BLHeli_S when there were some hardware and software issues that made them necessary, but fortunately those issues are mostly long gone.

Braking

The advent of active braking on ESCs was probably one of the most significant developments in ESCs in mini-quad history. If you’re newer to the hobby and haven’t previously attempted to tune or fly a quad without active braking, you’re probably not aware of what a significant difference it made. Back in the Atmel days SimonK and BLHeli added the features within a few months of each other, and it revolutionized our flight experience.

When braking first came out there was a lot of questions about what exactly it was doing to brake the ESC. Before we can really start a discussion about the methodology it is important to understand that there are actually two types of braking that are common in ESCs. One is the brake to 0 RPMs or to a full stop, and the other when the motor is changing speeds from higher RPMs to lower RPMs. The two different types use two different methods to accomplish their goals.

Brake on Stop

First let’s look at the brake to full stop. This type of braking doesn’t really impact us in multirotors as there is really never any instance in flight where we would want to completely stop the propeller spinning. This method is more critical for gliders or hotliners that use a folding prop and want to be able to stop it spinning very quickly to allow it to fold up and reduce drag. The mechanism used by the ESC to accomplish this is very simple. If you’ve ever taken a brushless motor and held the wires of two phases together and tried to spin it, you’ve noticed a significantly increased drag. If you connect the wires from all three phases it gets even stronger. The current caused by the magnetic field moving past one phase feeds into the other phases which creates an opposing magnetic field of equal magnitude. This essentially means that the harder you attempt to spin the motor the more resistance it will have. This creates an extremely effective method of stopping the motor from spinning very quickly.

Essentially the ESC simply connects the phases together by closing the appropriate FETs between phases, and allows current to flow from one phase into the others while shutting off the power side of the ESC. This is very effective for this purpose but has very little control. It just stops the motor from spinning as quickly as possible. In early BLHeli this feature was combined with Damped Light mode, but in BLHeli_S and BLHeli 32 since Damped Light is no longer a configurable option this setting is called Brake on Stop. For multirotor pilots it only impacts how quickly the props stop spinning when you disarm. KISS ESCs do not have this feature at all and simply spin down with momentum on stop.

Complementary PWM and Damped Light

The second type of braking that happens when RPMs are simply changing from higher to lower functions on a completely different mechanism. To understand what’s happening we need to look a bit at some of the terminology that is used to describe the braking. This method of braking is called Complementary PWM. In the old SimonK days the setting you needed was Comp_PWM, though BLHeli referred to it as Damped Light. This is also referred to as active or regenerative braking. All of these terms tell us something about how this functions.

To understand the mechanics of complementary PWM we first have to go back to our discussion of how the BEMF waveform is used to calculated the 0 crossing. The same technique that is used to detect the 0 crossing to drive the motor forward is used here, but in reverse. Instead of firing the phases in the order needed to drive the motor, the FETs for the phases are opened in reverse, so that the magnetic field pulls on the bell instead of pushing. The strength and degree of the force exerted on the bell can be controlled in the same way the acceleration is controlled.

A byproduct of this method is that the bell moving against the pull of the magnetic field actually turns the coil into a generator which accounts for a good deal of the drag on the system. So instead of drawing current to drive the motor, current begins flowing backward through the system. On the bench I have measured over 10A of reverse flowing current from only one motor, which means you can see over 40A in reverse if all 4 motors are strongly braking at the same time. This is why the term regenerative braking is used.

Conclusions

Fortunately most of the improvements in ESC technology have been largely transparent to the end user. On the majority of setups, stock ESC settings should not give you any trouble. The only change I would recommend is possibly moving timing from medium to medium high to gain a small performance boost and slight resistance to desync. If changes are made, be aware that anything that shifts the acceleration or power output of the motor is likely to cause a need to adjust the tuning of your quad.



Comments (13)

  1. Hamza M:
    Sep 22, 2017 at 10:56 AM

    Awesome write up as usual. Really enjoying these 'blog posts' if you will.
    I too believe that ESCs can be further improved upon. With regards to flight controllers I guess better hardware won't do much but on the ESC side of things hopefully we get to see more awesome stuff soon :D

    Reply

    1. quadmcfly:
      Sep 22, 2017 at 03:26 PM

      Great! Glad you're enjoying the articles, and thanks! Yep it's exciting to see stuff progressing, and there's some more exciting stuff on the horizon!

      Reply

  2. mnementh:
    Sep 22, 2017 at 02:42 PM

    Ryan -

    A VERY well though-out dissertation on the nuts & bolts of how a modern ESC works.I'd say you were channeling me, but it's entirely too concise. ;) Well done!

    Reply

    1. quadmcfly:
      Sep 22, 2017 at 03:26 PM

      Ha ha thanks man! Glad to see you poking your head in :D Miss seeing you around!

      Reply

  3. Eric:
    Sep 23, 2017 at 02:16 AM

    Nice article! I just have a couple comments: First, these aren't induction motors ... induction motors don't have magnets on the rotor. Induction motors are used in more industrial applications. These motors go by a lot of different names - sometimes just "brushless," or BLDC or BL - but probably the most accurate/descriptive name would be PMSM - permanent magnet synchronous motor.

    Second, in the section on timing you mention magnets moving past coils creates a current in the coils and that current creates a voltage. This is actually backwards - a moving magnet in a coil creates an emf (voltage) which can cause current to flow (but doesn't always). You can prove this by taking a motor that isn't connected to an ESC and hooking up a multimeter or o-scope across 2 of the leads of a motor and spinning the rotor. You will measure a voltage but there will be no current flowing because the leads aren't connected to anything. The physical law behind this is Faraday's law of Induction. Faraday's law, when applied to brushless motors, basically says that the back-emf is proportional to the rate of change of he flux. The rate of change of flux has to do with the speed of the motor - the faster the motor spins, the higher the rate of change. You can see this on an o-scope as well ... turn the shaft of the motor at 500 RPM and at 1000 RPM and the back-emf will be greater at 1000 RPM.

    Third, the angle that the ESC measures is not really virtual. It's a real angle. Motor engineers make a distinction between mechanical angle and electrical angle. Electrical angle = (Mechanical angle) x (pole pairs). 1 mechanical revolution = 360 mechanical degrees. 1 electrical revolution = 360 electrical degrees. 1 mechanical revolution is how far the rotor has to turn in order for it to come back to its mechanical starting position. 1 electrical revolution is how far the rotor has to turn in order for it to come back to its electrical starting position. What this means is that if the starting position is the center of one of the north pole magnets, then 1 electrical revolution is when the shaft rotates far enough so that the next north pole is centered on that starting position.

    Reply

    1. quadmcfly:
      Sep 25, 2017 at 04:38 PM

      I would make the argument that these are indeed a type of induction motor, though they are not AC induction motors. They still use the principles of induction to function, though the mechanism is slightly different from the AC induction motors used in industrial applications. The loaded start ability of the AC induction motor being the biggest difference.

      On the second point, you're absolutely correct, I inverted my terminology. That's what you get when you're writing too late at night. :D Fixed it. The external drive method that you are describing is actually the most reliable way of measuring the kV of a motor. The byproduct of the BEMF signal being lower at lower revolutions means it is very difficult to start a brushless DC motor spinning due to the difficulty in getting an accurate read on the BEMF signal. Kind of a chicken before the egg issue.

      On the third point, the electrical degrees are still not literal degrees of rotation, it depends on the number of poles as to the actual degrees of rotation that is produced by 360 degrees of electrical rotation. In our case with a typical 14 pole brushless motor for instance, as you mentioned 1 electrical revolution is 360 electrical degrees, but that is not literal degrees it is only the pole to pole, so it works out to about 51.43 literal degrees of rotation per 360 electrical degrees. On a 12 pole motor such as an 11XX class, that would would work out to 60 degrees of physical rotation. In that way it is a virtual number, more referring to the way it would be plotted on a graph as a sine wave than actual rotational degrees. On a related note if we switch from a 3 phase to a different number of phases, the degrees per phase of the BEMF signal would change accordingly, it may be less than 60 degrees per phase. That means in some motors the timing advance may be measured differently. You don't typically see that arrangement in brushless motors, unless you're looking at steppers, and they don't use the BEMF wave in their typical application.

      Reply

  4. Tod Rust:
    Sep 26, 2017 at 02:26 PM

    Hey Ryan :) Thanks for the great enlightenment!

    Reply

  5. Paul Krajewski:
    Sep 28, 2017 at 09:39 AM

    Induction in this context refers to the act of creating EMF by moving a magnetic field across a conductor, either by physically moving it or by expanding and collapsing the magnetic field with alternating current. The rotational force in these motors is created by magnetic repulsion.

    An industrial AC motor is correctly termed an induction-repulsion motor; as they operate by using a high-voltage AC current in the stator to induce a very high current to flow through the aluminum substrate of the laminated motor core. This high current then responds with a high-magnetic flux repulsive force, which causes motion. The nature of the way the poles are wound on the stator defines the rpm this motor will operate at with any given frequency of AC voltage applied.

    The only induction with a PM BL motor is the BEMF used for timing, so strictly speaking, I think these would be a 3-phase AC repulsion motor.

    Cheers,


    mnem
    *Slightly repulsive*

    Reply

    1. quadmcfly:
      Oct 30, 2017 at 09:45 AM

      Yes, you're right I was probably oversimplifying induction as the use of the charged coil at all, not just the induced voltage flow. As you say the BEMF reading still uses induction, but it's limited to sensing only, not drive.

      Reply

    2. Chris Barth:
      Nov 15, 2017 at 11:49 PM

      "The only induction with a PM BL motor is the BEMF used for timing, so strictly speaking, I think these would be a 3-phase AC repulsion motor."

      Besides timing, the BEMF is also used for braking and or regeneration. Strictly speaking, all (practical) electric motors use magnetic repulsion, these motors are called DC brushless motors. Obviously, no field coil is needed due to Perm Magnets.

      Reply

  1. 1
  2. 2





Allowed tags: <b><i><br>Add a new comment: