How I Learned to Stop Worrying and Love ESC Development

Explanatory Note: The text below contains some recommendations on how to develop a modern motor controller. It contains some recommendations to help the designer to get the job done relatively quickly without an infinite struggle with doubts and discussions at every possible aspect of the project. The text does not pretend to be academically rigorous, rather it is more about practical ways of solving particular problems. Quoting Captain Barbossa: “This is more a set of guidelines than actual rules.”

Many of us come to this idea at one moment of our lives – to the idea of developing a custom brushless motor controller. It may arise for different reasons: you’re building a high-end vehicle with very specific requirements or you just need a decent controller. There is a certain set of steps that are to be taken to achieve this goal, all of which involve knowledge from different fields. It may be difficult for a single person to be competent in all these fields so this text describes an easier way of completing this challenge successfully. It reduces the skills and competencies needed and also drastically reduces the development time.

Let’s list all the stages of custom ESC development (supposing that high-level requirements like power level, input voltage range etc. have already been put in place):

  1. Pick up the main components: power MOSFETs, MOSFET driver, MCU, DC-DC converters, communication interface drivers and connectors etc.
  2. Carefully read all the datasheets to look for possible conflicts. (Just for reference, the datasheet for a modern MOSFET driver IC like DRV8350 from TI is a 100 pages long complex technical document).
  3. Create a schematic of the whole controller.
  4. Carefully think over the component arrangements taking into account things like possible electromagnetic issues, cooling and housing means, the ease of reach of the connectors, etc.
  5. Route the PCB; possibly, several times due to the errors made in the previous stages.
  6. Design a housing that is possible to manufacture using a selected technology (be it 3D printing or milling or whatever else).

All these steps, although they may not be that simple, take a finite amount of time. The last ones, however, may take forever and never be completed:

  1. Software development and debugging.
  2. A GUI will be most probably needed to configure the controller.

The problem with programming and debugging motor controllers (and power electronics in general) is that they require the developer to be familiar with motor control theory, linear algebra, common electrodynamics and, of course, embedded real-time programming. The means of debugging such systems is very limited too, as the process under control is very fast and involves high-energy transitions. It is impossible to just halt the MCU and inspect its internal state or to use other conventional debugging methods like printing out the variables to the serial output. Besides, if something goes wrong it often causes hardware damage so perfect repair and soldering skills would be helpful.

A few of words about reliability should be made. In many cases, a controller is intended to control a motor mounted on some kind of aerial vehicle. This imposes special reliability requirements because a controller failure may lead to catastrophic consequences, not least the aircraft will be most probably critically damaged. This means that the software must be very reliable which can only be achieved by following standards like MISRA and doing lots of testing.

Conspicuously, the development of a motor controller from scratch is a major effort and one in which results are not guaranteed. But there is a way to avoid most of the challenges involved: use an integrated module for PMSM/BLDC motor control to do all the heavy lifting. This is what Zubax Mitochondrik LV does. Of course, even with this help, the whole development process will be hardly a piece of cake but it does simplify it a lot. The main advantages are:

  • The only components that have to be selected are the power stage components, interface ICs and connectors. Generally, the hardest part is selecting the power MOSFETs, proper capacitors and shunt resistors for the current measurements.
  • The schematic and PCB design are greatly simplified as all the complex circuitry is embedded into the module.
  • There is no need to mess with the DC-DC converter design as it is embedded into the module.
  • And most importantly; no programming needed. Mitochondrik LV runs Télega software which uses advanced and sophisticated algorithms to control the motor. Also, there is a standard GUI tool for Télega-based controllers already so no additional PC-software development is needed either.

Therefore, the application of Mitochondrik LV in motor controller development leaves the designer with many fewer problems to solve.

Below is an example of controller development using Mitochondrik LV using a Zubax Komar controller.

The initial requirements of the controller are:

  • Input voltage range: 20 – 50.4 V.
  • Continuous power output: 2 – 2.8 kW with a 12S battery where the range of possible battery voltages is 40 – 50.2 V.
  • Dimensional requirements: Circular and comparable in size to a compact 2 kW-rated motor like the T-motor MN5212.

Component selection

As this is a Mitochondrik-based device, the critical components to select are the power MOSFETs, the current shunts, and the buffer capacitors.


The search criteria for the MOSFETs are:

  • Vds – not less than 80 V as there needs to be a safety margin above the maximum supply voltage of 50.4 V.
  • RDS(on) – the less the better as this directly impacts power loss and heat dissipation of the power stage.
  • Qgate – the less the better since the lower the Qgate, the faster it is possible to switch the transistor, resulting in less power loss and heat dissipation.
  • SMD package to keep things compact.

When speaking about the required current conducting capabilities of the power MOSFETs, some clarifications need to be made. The current drawn from the battery (Idc) is not equal to the current that the transistors need to handle, known as the phase current (Iphase). In general, the phase current is higher than the battery current.

For simplicity, we will disregard all power losses at this stage. This allows us to write down the energy conservation rule as:

P_m = P_\text{dc}


  • P_m is actual power delivered to the motor; and
  • P_\text{dc} is the power from the supply.

Furthermore, we can state:

\begin{aligned} P_\text{dc} &= I_\text{dc} \cdot U_\text{dc}\\ P_m &= \frac{3}{2} \cdot U_m \cdot I_\text{phase} \end{aligned}


  • U_m is the maximum motor voltage.

It is important to understand that U_m is the result of modulation that takes place in the controller and thus it is not equal to the power supply voltage. The maximum motor voltage can be calculated from the supply voltage as follows:

V_\text{max} = F_\text{util} \cdot U_\text{dc}


  • F_\text{util} is the Télega-specific voltage utilization factor, \frac{0.91}{\sqrt{3}}.

Combining the above equations:

\frac{3}{2} \cdot F_\text{util} \cdot U_\text{dc} \cdot I_\text{phase} = I_\text{dc} \cdot U_\text{dc}

This gives a formula for I_\text{phase} of:

I_\text{phase} = \frac{2}{3} \cdot \frac{I_{dc}}{F_{util}}

To obtain the value of I_\text{phase_max} we need to define additional criteria. If we assume 2 kW of power is drawn from the power supply source for the entire range of voltages of a 12S LiCoO2 battery (39.6 – 50.4 V), this gives us a maximum DC current of:

I_\text{dc_max} = \frac{2000}{39.6} \approx 50 A

which in turn provides the maximum phase current:

I_\text{phase_max} = \frac{2}{3} \cdot \frac{50}{ \frac{0.91}{\sqrt{3}}}\approx 65 A

Important: Iphase_max is not the absolute maximum phase current that the device can handle. Rather, it is the maximum continuous phase current and is limited by the thermal budget of the device. The absolute maximum phase current (Iphase_peak) is determined by the overcurrent protection trigger level (more on that below).

Now it is possible to select a power MOSFET. After some research BSC040N08 from Infineon Technologies was selected:

Knowing that the maximum switching frequency for Mitochondrik is 47 kHz, it is possible to calculate the average “on-time” for the transistor:

\begin{aligned} T_\text{on} &= \frac{1}{2 \cdot F_\text{sw}}\\ T_\text{on} &= \frac{1}{2 \cdot 47000}\approx 10 \mu s \end{aligned}

The image above shows that the selected MOSFET fits the application at the end of its tether. But one should keep in mind that this is valid at 25℃ MOSFET case temperature. As the temperature rises, things get considerably worse. And the temperature will definitely rise noticeably (more on that later).

The solution is to use two transistors in parallel per half-bridge side. Of course, it is also possible to find some bigger MOSFET, but due to the geometric limitations, 12 smaller MOSFETs are preferable to 6 bigger ones.

Another important thing to check is whether the Mitochondrik can switch the selected MOSFETs fast enough. From the Mitochondrik datasheet, the average gate drive current (Idrive_avg) is 25 mA. The gate charge of a single MOSFET is Q_g = 54\ nC. The transistors can be used if the following holds:

\text{Gate Drive RMS Current} < I_\text{drive_avg}


\text{Gate Drive RMS Current} = Q_g \cdot n \cdot F_{switching}


  • n is the number of switching MOSFETs.

In Télega, two thirds of all MOSFETs are switched concurrently. In a typical vector control drive all transistors are switching continuously but Télega leverages sophisticated modulation strategies to reduce the switching losses. For Komar, this means 8 MOSFETs.

\text{Gate Drive RMS Current} = 54 \cdot 10^{-9} \cdot 8 \cdot 47000 \approx \text{20.3 mA}

This is less than the Mitochondrik’s capabilities, so the configuration is admissible.

Current shunts

There are numerous ways to measure the current flowing in the conductor: current shunts, hall effect sensors, even digital compasses as TI suggests. Mitochondrik uses the simplest and the most cost-effective approach – it measures the phase current using low-side resistive current shunts. Selecting the current shunt is always a trade-off between the heat dissipated in the shunt (i.e. power loss) and the dynamic range of the measurement. For a Mitochondrik-based controller there are two criteria for selecting shunts: 1) resistance; and 2) power rating.

The optimal resistance of the shunt is 80-90% of the voltage measurement dynamic range when the current reaches its maximum value. For Mitochondrik-based controllers this is 0.165 V. The maximum phase current (Iphase_max) was determined beforehand to be 65 A. This enables us to derive the optimal resistance:

R = 0.8 \times \frac{0.165}{65} = 2.03\ \text{m}\Omega

The closest standard value is 2\ \text{m}\Omega.

Mitochondrik-based controllers use current shunts on two of the three phases (A and B only). According to this, the maximum power dissipation in one current shunt can be determined as:

\begin{aligned} P_\text{max} &= \frac{R\ I_\text{rms_max}^2}{2}\\ I_\text{rms_max} &= \frac{I_\text{phase_max}}{\sqrt{2}}\\ P_\text{max} &= \frac{0.002\ (\frac{65}{\sqrt{2}})^2}{2} = 2.1125\text{ W} \end{aligned}

For the described controller, the shunt CRE2512-FZ-R002E-3 from Bourns Inc. is selected:


A few words about the bulk capacitance: why is it needed, in general?

The main purpose of a motor controller is to convert the electric energy stored in the battery into the mechanical energy of the spinning motor. In an ideal world, there are no parasitic effects in the electrical circuits. The motor controller would be able to draw the electrical energy without obstruction and could drive the motor at any frequency using PWM with zero rise time; all without causing any issues. The overall schematic would look like the picture below:

In real life however, parasitic properties are all over the place. With some simplification, a more realistic version of the system might look like:

While the parasitic resistance only causes the wires to heat up (and sink energy into the environment), the parasitic inductance is a different story. It limits the rate of temporal change of the supply current (\frac{dI}{dt}). The system responds to current variation with a change in voltage. The voltage ripple on the motor controller side of the system leads to several undesirable effects: heat loss, noise, distortion of measurements, and electromagnetic interference.

There is second potential pitfall that should not be forgotten. The energy conversion that takes place in the motor controller is in fact bidirectional. The spinning rotor (especially with some kind of mechanical load attached) has some kinetic energy. In the case of braking, this energy has to be removed from the rotor and redirected elsewhere. In most systems, it would go back to the battery and recharge it a bit but due to the parasitic inductance and resistance between the motor controller and the battery, this energy may induce a voltage spike on the motor controller side with the potential of causing severe adverse effects on the stability of the motor control loops or the hardware itself. This is the second reason to have local energy storage in the form of bulk capacitance within the motor controller itself.

The size of this local energy storage depends on many factors (battery wires’ length, their thickness, the way the wires are routed, etc.), so adequate design and system-level testing is always required. But there is a practical rule of thumb: use at least 20 uF of DC bulk capacitance per 1 A of DC bus current.

The capacitor bank usually consists of capacitors of two types: electrolytic capacitors with high capacitance and high ESR along with ceramic capacitors with much lower capacitance but very low ESR. Electrolytic capacitors help reduce the low-frequency ripple while ceramic ones are effective against high-frequency noise. In the absence of adequate system models, the required amount of ceramic capacitors may be determined empirically, in which case extra PCB footprints may be helpful.

One additional recommendation about the capacitor selection is that it may be beneficial to use several smaller capacitors and connect them in parallel rather than one massive capacitor. It may not only reduce the overall size of the motor controller but also reduce the effective ESR of the capacitor bank making it more effective.

These are the parameters that should be taken into consideration when selecting the capacitors:

  • Voltage rating – shall be no less than Vin_max.
  • Capacitance – may only be limited by the cost, size, and weight constraints.
  • ESR – in general, the less the better.
  • Lifetime expectancy – electrolytic capacitors tend to degrade considerably over time and this process is accelerated with the high temperatures (which is usually an issue in any motor controller).

According to the parameters above, two B41888C8227M capacitors (220µF 63V Aluminum Electrolytic Capacitor, 7000 Hrs @ 105°C) from TDK are selected.

The capacitor bank was complemented with 9 (3 per phase) 4.7 uF ceramic caps. This setup yields a total of ~460 uF, a value lower than the recommended capacity from the rule of thumb above (but then again there is a reason why it is called a “rule of thumb” and not a “rule of law”).

Schematic development

The schematic development is hardly interesting at all as it is basically a copy-paste straight from the datasheet. It is shown below:

Overcurrent protection

One matter that probably does need an explanation is overcurrent protection. Mitochondrik constantly monitors the voltage drop across the power MOSFETs. It compares the voltage drop against the voltage on its oc_adj pin, which is set by an external resistor using the following formula:

I_\text{trip} = \frac{3.3\ R_\text{oc_adj}\ 10^{-3}}{ (10 + R_\text{oc_adj}10^{-3})\ R_\text{side}}


  • R_\text{oc_adj} is the value of the protection trip level setting resistor [Ohm].
  • R_\text{side} is the half-bridge side resistance [Ohm]. For example, in Komar, each half-bridge side is composed of two parallel MOSFETs, each has R_\text{DS(on)} = 4.3\ \text{m}\Omega, which yields:
R_\text{side} = \frac{4.3}{2} = 2.15\ \text{m}\Omega

In the case of Komar, I_\text{trip} is set to 130 A, a level which is 2 times higher than the maximum continuous phase current but is within the safe operating range of the selected MOSFETs.

From the equation above we obtain:

R_\text{oc_adj} = 1K

Last, but not least the RDS(on) of individual MOSFETs changes with temperature considerably, and does the Itrip. At 85℃, Itrip will be approximately 1.5 times lower than it would be at normal operating temperature of 25℃; i.e. at around 90 A.

Gate resistors

Another sore subject is gate resistors; particularly their value and number. It is recommended having series resistors for power MOSFET gates. In the case of parallel MOSFETs, a separate gate resistor for each transistor should be used.

The main and only purpose of having the gate resistors is to eliminate ringing in the gate circuits. The ringing appears because PCB traces have stray inductance and MOSFET gates have stray capacitance and all this acts as an oscillating circuit. The lower the signal rise time is, the worse the oscillation gets. A gate resistor increases the rise time, thus reducing the oscillation. Steeper fronts, on the other hand, generally reduce the switching losses. The required gate resistance should be obtained by modeling the PCB parameters. Alternatively, trivial empirical methods could also be employed.

PCB and construction

At this point, it is crucial to have some physical representation of the final result: at least the overall shape, dimensions and connector placement should be known by this time.

Two main questions to address when designing power electronics and supercomputers are:

  1. How does one deliver all the necessary power to the device without substantive power losses?; and
  2. How does one cool everything that heats up?

Both of these questions have a direct relationship to the power stage PCB design. Routing high currents through the PCB is generally not the best idea as the copper foil thickness is typically in the range of 0.035 – 0.105 mm (n.b. thicker foil imposes more restrictions on the PCB design due to the limitations of the PCB manufacturing process). There is an upper limit to the amount of current that can be routed conventionally through a regular FR4 PCB; as an oversimplified rule of thumb, this limit is between 50 – 100 A. Anything above this limit would require special measures (e.g. busbars, PCB trace reinforcement, etc.).

Fortunately, Komar’s maximum phase current enables it to be routed on a regular PCB, although it still requires the power stage to be properly routed. The key element here is the component arrangement. The designer should minimize the path of high current through the PCB (if high current barely touches the PCB copper, it can’t influence the PCB too much). All the connections that carry high currents should be made with polygons to ensure that the electrical resistance is minimized. Polygons also serve as a heat distributor, removing heat from MOSFETs (and other heating components) and spreading across the PCB. This in turn increases the effective contact area between the PCB and the heatsink. It should be noted that the MOSFET’s R_\text{DS(on)} is a temperature-dependent parameter, which is why it is important to ensure that the thermal load is distributed equally across the transistors. This is the second role of big polygons: they should couple all the MOSFETs thermally together.

The second important design challenge, after providing a good path for the power input, is cooling. There is more than one way to cool electronic components but the simplest and most cost-effective one is air-cooling. Usually, some kind of heatsink that dissipates heat into the environment is suggested. First, though, the heat needs to be transferred to the heatsink. The designer should minimize the thermal resistance between the MOSFETs’ crystals and the heatsink. Here is a good application note on the topic of thermal resistance:

As an example, Komar uses power transistors in the PowerTDFN-8 package. Its thermal resistance is described in the following table:

It should be obvious that the heat from the MOSFETs is transferred much more efficiently to the PCB through the bottom of the transistor housing than through the top. When heat is transferred to the top side of the PCB it should be transferred onward to the bottom side and then to the heatsink. Multiple via holes help the heat to get to the bottom side of the PCB. The exact thermal impedance of a via depends on the PCB manufacturing process, the via’s diameter, and the PCB’s thickness. Here is a good article on the topic:

Long story short, many smaller vias perform considerably better than fewer bigger ones because it is the total surface area of metal connecting the two sides of the PCB that matters. Consequently, it is highly recommended to fit as many vias as possible on the MOSFETs footprints and position them for best thermal performance. The only practical way of transferring the heat onward to the heatsink is just to press the heatsink to the PCB mechanically. Of course, this requires that there are no components on the bottom side of the PCB (or at least, there are no components directly under the MOSFETs).

Important note: In most cases, the heatsink is not directly attached to the PCB (or other objects that needs cooling) but through some kind of thermal pad. In the case of Komar, a thermal pad is needed because there are many different signals and polygons on the bottom side of the PCB and as the soldering mask is not a proper insulation something may short. The designer should keep in mind that thermal pads may have drastically different thermal resistance so care is needed in selecting one. The second important consideration is that thermal pads are specified under pretty strict conditions, the most important of which is pressure. You may pick the best thermal pad available to a mortal man but if you don’t provide it with the specified pressure, it won’t perform any good. Of course, this matter does not relate to the PCB routing directly but it still has to be mentioned.

The worst case power losses in the power stage are calculated below. First, the maximum power losses for one individual MOSFET are calculated:

\begin{aligned} P_\text{loss} &= \frac{1}{2} P_\text{loss_ohmic} + \frac{2}{3} P_\text{loss_switching}\\ P_\text{loss_ohmic} &= I^2 R_\text{DS(on)}\\ P_\text{loss_switching} &= \frac{V_\text{dc} \cdot I_\text{phase} (T_\text{rise}+T_\text{fall}) \cdot F_\text{switch}}{2} \end{aligned}


  • F_\text{switch} = 47 000\text{ }Hz
  • V_\text{dc} = 50.2\text{ } V
  • I_\text{phase} = 32.5\text{ }A – max. phase current flowing through one transistor is 65 A / 2
  • T_\text{rise} = 50 \times 10^{-9}\text{ }S
  • T_\text{fall} = 50 \times 10^{-9}\text{ }S

Now the total power stage losses can be calculated using the power loss in a single transistor along with the losses in the current shunts that were found earlier:

P_\text{loss_total}= P_\text{loss} \cdot N_\text{transistors} + 2P_\text{shunt_loss}

The resulting Ploss_total is 53.8 W. This is an approximation because many system parameters are temperature-dependent and are therefore constantly changing.

The last thing needed for the thermal simulation is the convection rate. This is a tricky one and usually has to be picked from existing convection tables. For a forced-air convection, the rate may be 300\ \frac{W}{m^2 K} depending on the intensity of the air flow around the heat sink.

For the sake of simplicity, the simulation does not involve the actual PCB with transistors. It is just about the ability of the heatsink to dissipate the rejected energy under the specified convection rate. It is seen that the temperature gradient is moderate (especially considering the shape of the object) and the maximum temperature is below 80°C. One should keep in mind that the actual temperature of the semiconductor crystals will be higher than the temperature of the heatsink due to the non-zero thermal impedance between the crystals and the heatsink (n.b. this difference may exceed 50°C).

All the reasoning above indicates that with a device like Komar, it is possible to sustain continuous operation at the power levels above 2 kW. Further confirmation would require prototype manufacturing and testing on actual hardware. These tests have been conducted and the results were found to be sufficiently similar to the model predictions.

All the hardware source files can be found in the GitHub repository.