3D render of the FOC motor driver PCB with bulk capacitors and a five-way screw terminal
Projects / Power

FOC Motor Driver

As we start to build more dynamic robots, we will need actuators that can provide a good amount of torque at high speeds. This is the Field-Oriented Control driver I am designing for our upcoming actuator.

RoleHardware Design
Timeline2026 · in progress
Key parts6EDL7151 · STM32C5 · A1333
Read— min

Overview

The 6DOF robot arm I built with my twin has one main limitation: it uses stepper motors. The coolest part about stepper motors is that they run open loop, which makes them very easy to control: all you need are step and direction pins. However, they have a major flaw. Their torque drops drastically as speed increases. As we start to build more dynamic robots, we will need actuators that can provide a good amount of torque at high speeds. For this, we are moving over to BLDC motors controlled using Field-Oriented Control (FOC). My role is to design the FOC driver for our upcoming actuator.

3D render of the FOC driver board seen from above at an angle
Render of the board.

Design goals

MOSFET

The MOSFET is arguably the most important part of the driver. It is used in the inverter and it is responsible for converting the DC input into the AC voltage used to power the motor. When selecting a MOSFET, there were a lot of things I considered. The first was the voltage and current ratings, which should exceed my design ratings so the MOSFETs don’t get destroyed. Another factor that greatly affects MOSFET performance is thermal behavior. Even though most of the MOSFETs I considered had very high current ratings, thermal performance determines how much current we can actually run through them. So to choose a MOSFET, I calculated the power dissipated in each one (conduction, switching, and gate drive losses). Then I ranked them by junction temperature and chose the best one. Due to the space constraints of this board, I chose MOSFETs with a 5 × 6 mm footprint. The table below shows the results and the methodology.

Methodology

Every MOSFET is evaluated at the same operating point:

Conduction loss uses the datasheet’s maximum \(R_{DS(\mathrm{on})}\) at 10 V, scaled up for temperature:

$$P_{\mathrm{cond}} = I^2\, R_{DS(\mathrm{on})}\, k_{\mathrm{hot}}\, D$$

Switching loss. The drain voltage swings during the Miller plateau, so to switch at the dv/dt limit the driver has to deliver the plateau charge \(Q_{gd}\) within \(t_v\). If that needs more than the driver can source, the gate current is capped at \(I_{g,\max}\) and the edge is slower. The same current charges \(Q_{gs2}\) and \(Q_{gd}\); delay times are left out.

$$t_v = \frac{V_{\mathrm{bus}}}{(dv/dt)_{\max}}, \qquad I_g = \min\!\left(\frac{Q_{gd}}{t_v},\; I_{g,\max}\right)$$
$$t_{\mathrm{on}} = t_{\mathrm{off}} = \frac{Q_{gs2} + Q_{gd}}{I_g}, \qquad P_{\mathrm{sw}} = \tfrac{1}{2}\, V_{\mathrm{bus}}\, I\, (t_{\mathrm{on}} + t_{\mathrm{off}})\, f_{\mathrm{sw}}$$

\(Q_{gs2}\) comes from the datasheet: the printed value if there is one, otherwise \(Q_{gs} - Q_{g(\mathrm{th})}\), otherwise \(Q_{sw} - Q_{gd}\), otherwise \(Q_{gs}\) as an upper bound.

Gate drive loss is the gate charge energy per cycle. It does not depend on the gate current, and with a current-source driver most of it is dissipated in the driver, so charging it to the MOSFET is conservative. It is small (under 0.1 W).

$$P_{\mathrm{gate}} = Q_g\, V_{GS}\, f_{\mathrm{sw}}$$

Junction temperature, with no heat sink, uses each datasheet’s steady-state \(R_{th(j\text{-}a)}\) on the manufacturer’s own test board (typically 1 in² / 6 cm² of copper, so boards differ). The parts are ranked from lowest to highest \(T_j\).

$$T_j = T_{\mathrm{amb}} + \left(P_{\mathrm{cond}} + P_{\mathrm{sw}} + P_{\mathrm{gate}}\right) R_{th(j\text{-}a)}$$

Not included: body-diode / dead-time loss, reverse recovery and \(C_{oss}\) loss.

Results

RankPartVDS (V)RDS(on) (mΩ)Igate (mA)dv/dt (kV/µs)Pcond (W)Psw (W)Pgate (W)Ptotal (W)Rth(j-a) (°C/W)Tj (°C)
1NTMFSC1D9N08X801.93332.000.611.530.0162.1539109.0
2TPH4R008QM804.04102.001.281.320.0142.6150155.6
3FDMS86300DC803.14672.000.992.570.0183.5838161.1
4BSC040N10NS51004.04002.001.281.500.0152.7950164.7
5TPH3R10AQM1003.15001.360.991.920.0212.9350171.6
6H100N10FB1004.04332.001.281.800.0163.1048173.6
7TPH6R008QM806.02532.001.921.420.0093.3550192.5
8CSD19531Q5A1006.42202.002.051.340.0093.3950194.7
9DI100N10PQ1004.54002.001.441.950.0193.4150195.4
10AONS669171003.53672.001.122.370.0203.5150200.6
11XPH4R10ANB1004.15001.881.312.280.0193.6150205.5
12BSC072N08NS5807.21672.002.301.440.0063.7550212.5
13RS6P060BH10010.62102.003.391.690.0065.0841.7237.0
14H80N10FB1003.63832.001.152.700.0173.8755237.8
15TPH8R808QM808.81802.002.821.430.0064.2650237.8
16AMR448N-CT1004.45001.621.412.550.0173.9856247.6
17NVMFWS004N10MCT1G1004.45001.621.412.550.0173.9856247.6
18RH6N040BH808.31402.002.662.160.0064.8362.5326.6
19CSD19534Q5A10015.11072.004.831.410.0046.2450337.1
20RH6P040BH10015.61472.004.991.680.0046.6762.5442.1

Losses per MOSFET at the operating point above. The NTMFSC1D9N08X (highlighted) is the part I used. One more candidate, the AMR448N, is not ranked because its datasheet does not give Qg at 10 V.

Gate driver

Most gate drivers I see in FOC projects use TI gate drivers. However, the TI part with the voltage rating I need, the DRV8353S, costs $4.27 per unit, so I looked for alternatives. I found the 6EDL7151XUMA1 by Infineon. One of the main reasons I chose it is that it allows finer control over the MOSFETs’ switching profile: the gate current can be configured separately for 4 stages of each switching transition, compared to a single setting on the TI. It also has a programmable gate voltage, better current shunt amplifier specs, and, most importantly, it is cheaper than the TI. It comes in at $2.55, about 40% cheaper than the TI.

Timing diagram of the 6EDL7151 gate current and gate-source voltage for the high-side and low-side MOSFETs, showing pre-charge, TDRIVE1, TDRIVE2 and hold current stages
Gate current profile of one switching transition, set in stages (pre-charge, TDRIVE1, TDRIVE2, hold). From the Infineon 6EDL7151 datasheet.

Current sense topology

The current control loop needs current feedback to work. For sensing the current, I went with low-side sensing instead of inline sensing. The main reason I went this route was cost. Inline sensing needs an external current sense amplifier (CSA). CSAs that can match the specs I need are over $2 each, and since I need 3, that would increase the BOM cost significantly. Low-side sensing, on the other hand, is supported by the internal CSAs in the gate driver, so there is no additional BOM cost.

Two three-phase inverter schematics. (a) Low-side shunts: a shunt resistor between each low-side MOSFET and ground, sensed by the gate driver's CSAs. (b) Inline shunts: a shunt resistor in each phase output, sensed by external CSAs.
(a) Low-side shunts sit between each low-side MOSFET and ground, so the sensed voltage is ground-referenced and the gate driver’s internal CSAs can read it. (b) Inline shunts sit in the phase outputs, which swing between 0 V and VBUS, so they need external high common-mode CSAs.

Magnetic encoder

The FOC algorithm needs position feedback to work. The cheapest way I could find was using a magnetic encoder paired with diametrically magnetized magnets placed on the rotor. The magnetic encoder uses the orientation of the magnet to determine the angular position of the rotor. I needed a magnetic encoder that has both a serial interface and incremental encoder signals. I chose the Allegro A1333. Its serial angle output is 12-bit, just like other encoders in this price range, but its incremental interface has 13-bit resolution. Other magnetic encoders in this price range don’t have incremental interfaces with such high resolution.

A diametrically magnetized magnet turning over the sensor. The field at the chip rotates with the magnet, and the A1333 reads its direction as an angle (12-bit serial output shown).

MCU & other circuitry

I chose the STM32C5 series because it is very cheap, starting at around $2. I specifically went with the STM32C5A3RGT6 because it has 3 ADCs, so I can measure all 3 phases at the same time. It also has four 32-bit timers. I only need one, for the incremental encoder, but I haven’t seen another ST chip this cheap with four, so that really surprised me. I also added a CAN transceiver and an RS-485 driver for communicating with external encoder PCBs.

PCB designField-oriented controlBLDCPower electronicsSTM32