armhub.dev
Systems · 16 pages
Systems

Drone Electronic Speed Controller

Drone ESC firmware — BLDC commutation (back-EMF zero-cross vs sensored), six-step trapezoidal vs FOC sinusoidal, PWM 16–32 kHz, DShot300/600/1200 digital throttle protocol, bidirectional DShot for RPM telemetry, BLHeli_32 / AM32 / BetaFlight ESC.

7 min read · 1,546 wordsupdated · May 13, 2026

An ESC — Electronic Speed Controller — is the small board between a drone's flight controller and one of its motors. The flight controller sends a throttle command; the ESC translates that into the high-frequency switching pattern that drives the brushless DC motor. On a typical quadcopter there are four ESCs (one per motor); on a hexacopter or octocopter there are six or eight. Each is a Cortex-M0+ or M4 microcontroller plus three half-bridge MOSFET gate drivers, running firmware that solves a surprisingly hard real-time problem: drive a three-phase motor without a rotor position sensor at up to 50,000 RPM, respond to throttle changes within microseconds, and report telemetry back to the flight controller within the same communication frame.

This page covers the BLDC commutation algorithms, the trapezoidal vs FOC tradeoff, the DShot family of digital throttle protocols that replaced analog PWM, and the dominant open-source ESC firmware projects.

Drone ESC at a glance
MCU
STM32F051 / STM32F031 (BLHeli_S legacy), STM32G071 / STM32F411 (BLHeli_32, AM32), AT32F421 (clones)
Gate drivers
EG2104S / FD6288Q / 2-in-1 driver-MOSFET ICs; ~25-50 A continuous, ~120 A burst per phase
PWM switching frequency
16-48 kHz; 24 or 32 kHz typical to minimise audible noise
Throttle protocol
DShot150 / DShot300 / DShot600 / DShot1200 / DShot2400; older PWM and Multishot mostly retired
Throttle latency
DShot600 frame ~26 µs; commit-to-PWM ~5 µs; total response ~50 µs
Telemetry
Bidirectional DShot (BBDShot) — ESC replies with RPM, voltage, current, temperature within the throttle frame slot
Open-source firmware
BLHeli_32 (proprietary closed since 2023), AM32 (open replacement), BlueJay, Bluebird (BetaFlight ESC)
Commutation
Six-step trapezoidal sensorless (cheap, simple), increasingly FOC sinusoidal (efficient, quiet)
Rotor position
Back-EMF zero-crossing detection on idle phase (sensorless), or Hall / encoder (sensored, rare on drones)

Six-step trapezoidal commutation

The classic and still-dominant BLDC commutation scheme. The motor has three phases; the controller energises two at a time, leaving the third idle. By cycling through the six possible energisation patterns in order, the controller produces a rotating magnetic field that the rotor's permanent magnets follow.

Step  Phase A  Phase B  Phase C
1     +V       -V       (idle)
2     +V       (idle)   -V
3     (idle)   +V       -V
4     -V       +V       (idle)
5     -V       (idle)   +V
6     (idle)   -V       +V

The trick is knowing when to step from one pattern to the next — too early and the rotor lags, too late and you lose torque or stall. With Hall sensors mounted in the motor, this is direct: read the Hall, look up the next pattern. Drone motors usually don't have Hall sensors (cost, weight, reliability), so the ESC infers rotor position from the back-EMF voltage on the idle phase.

Back-EMF zero-crossing. When the rotor moves, the magnetic field induces a voltage in the idle phase winding — a sinusoid offset by the motor's electrical angle. The zero-crossing of that sinusoid is a precisely-timed indicator of rotor position. The ESC reads the idle-phase voltage on its ADC (or via a comparator), detects the zero-crossing, waits 30° of electrical phase, then commutates.

Limitations:

  • No back-EMF at zero speed. Spinning a stopped motor requires either an external prime (impractical) or a "blind" open-loop start-up sequence where the ESC commutates at a guessed rate, hoping the rotor catches the field. Some sub-percent of starts fail and have to be retried. This is the cause of "ESC arming failure" on a cold drone.
  • Limited efficiency. The 30° electrical step is not aligned with the back-EMF sinusoid peak, so torque ripple is high (~15% peak-to-peak), efficiency 5–10% below FOC.
  • Audible noise. The step-wise commutation generates harmonics, producing the characteristic high-pitched motor whine of trapezoidal ESCs.

For racing drones, none of these matter; trapezoidal still dominates because it's simple, robust, and the noise is acceptable. For long-flight-time photography drones, the inefficiency matters and FOC is increasingly common.

FOC — sinusoidal field-oriented control

Same hardware, very different firmware. Instead of stepping through six discrete energisation patterns, FOC continuously modulates all three phases with sinusoidal voltages, computed to produce a rotating magnetic field exactly aligned with the rotor at all times.

The algorithm:

  1. Sample phase currents (two of three, the third is implicit).
  2. Clarke transform: (a, b, c) → (α, β) — convert three-phase to two-phase orthogonal frame.
  3. Park transform: (α, β) → (d, q) using the estimated rotor angle. d-axis is aligned with the rotor flux; q-axis is perpendicular (torque-producing).
  4. PI control: Id_setpoint = 0 (no field-weakening), Iq_setpoint = torque_command. PI controllers in d and q frame produce Vd, Vq.
  5. Inverse Park: (Vd, Vq) → (Vα, Vβ).
  6. SVPWM (Space Vector PWM): generate the three-phase PWM duty cycles that produce the desired (Vα, Vβ).
  7. Update timer PWM registers; DMA pushes them at the next cycle.

This runs at 10–20 kHz. The rotor angle estimator is either a back-EMF observer (most common on drones — a Luenberger or sliding-mode observer that estimates the rotor angle from the measured phase currents and voltages) or, on high-end ESCs, an encoder.

AspectTrapezoidalFOC
Compute per cycle~50 cycles~1500 cycles
MCU classM0+ at 48 MHz sufficesM4F at 100+ MHz
Efficiency82-88% typical88-94% typical
Audible noiseHigh (whine)Very low (smooth)
Throttle response~50 µs~30 µs
Cold start reliability99%99.5% (better initial-angle estimator)
Low-speed controlPoorExcellent
Cost (firmware complexity)LowHigh

Modern AM32 and BlueJay support FOC; older BLHeli_S is trapezoidal-only. The trend is clearly toward FOC as Cortex-M4 ESCs become standard.

DShot — digital throttle

For two decades the throttle command from FC to ESC was an analog PWM pulse — 1.0 ms = idle, 2.0 ms = full throttle. The resolution depended on the FC timer (typically 1 µs = 1000-step resolution) and the latency was up to one PWM frame (10–20 ms at 50–125 Hz refresh).

DShot is a digital protocol — a 16-bit throttle word with checksum, sent over the same single signal wire at a defined bit rate.

VariantBit rateFrame timeThrottle resolution
DShot150150 kbit/s107 µs11-bit
DShot300300 kbit/s53 µs11-bit
DShot600600 kbit/s27 µs11-bit
DShot12001200 kbit/s13 µs11-bit
DShot24002400 kbit/s7 µs11-bit

The frame layout:

| 11 bits throttle value | 1 bit telemetry request | 4 bits CRC |

Bit encoding: each bit is a pulse, where the duty cycle determines 0 or 1 (different from UART). A "0" bit is 37.5% high; a "1" bit is 75% high; both take 1.67 µs at DShot600. The ESC samples the duty cycle, reconstructs the bit pattern, validates the CRC, and accepts the throttle command.

DShot bit-cell — three sub-windows per bit at the PWM rate
DShot lineSub-windowDecodedbit "0" (37.5%)bit "1" (75%)
Each DShot bit-cell spans three PWM sub-windows. A short high-pulse covers one window and decodes as 0; a wider high-pulse covers two windows and decodes as 1. Sixteen bit-cells (11 throttle + 1 telemetry-request + 4 CRC) make one frame.

DShot600 is the most common variant on modern flight controllers. DShot1200 and DShot2400 are used on extreme-end racing setups; the limiting factor is signal integrity on long ESC wires.

Bidirectional DShot (BBDShot)

The original DShot is one-way: FC tells ESC the throttle. BBDShot adds a reply slot — immediately after the FC's throttle frame, the ESC inverts the signal direction and sends back a 21-bit telemetry word containing the motor's electrical RPM. The FC samples the reply, decodes, and feeds RPM into the harmonic notch filter for vibration suppression.

The timing is tight. At DShot600, the FC's throttle frame is 27 µs; the ESC has ~30 µs of dead time then sends a 21-bit reply at the same rate (~35 µs). The whole exchange completes in under 90 µs — easily within the 125 µs of an 8 kHz attitude loop slot.

Telemetry payload:

  • Electrical RPM (eRPM) — divide by motor pole-pair count for mechanical RPM.
  • Voltage and current (some variants).
  • Temperature (some variants).
  • Cumulative energy consumed.

The harmonic notch in the FC is the primary reason BBDShot exists. Without it, the FC has to guess motor RPM from throttle command (inaccurate) or skip the harmonic notch altogether (less effective vibration rejection).

ESC firmware — BLHeli_32, AM32, and the open-source story

For a decade BLHeli_S (8051 microcontroller, six-step trapezoidal) was the dominant open-source ESC firmware. In 2018 BLHeli_32 launched as a paid commercial product on Cortex-M ESCs, adding higher PWM rates, BBDShot, and various tuning features. Initially distributed as a free-as-in-beer binary; in 2023 BLHeli_32 was acquired and the source closed entirely — no new development on the open side.

This drove the rise of open-source replacements:

AM32 — full-stack open source. Cortex-M0+/M4 firmware, trapezoidal and FOC variants, BBDShot, runs on all the popular ESC silicon (STM32F051, STM32G071, AT32F421). Configurator app for Windows/Mac/Linux. Most new ESC hardware ships with AM32 from the factory or includes AM32-flashed variant.

BlueJay — fork of BLHeli_S source, kept on the older 8051 hardware. Active development for legacy ESCs.

Bluebird (BetaFlight ESC) — newer effort to embed ESC firmware directly into the FC, with the ESC reduced to a "smart MOSFET bank". Reduces parts count; raises FC complexity. Limited adoption so far.

FirmwareHardwareAlgorithmStatus
BLHeli_S8051 (Silicon Labs EFM8)TrapezoidalOpen, frozen
BlueJay8051Trapezoidal, refinedOpen, active
BLHeli_32Cortex-M0+ (STM32F051 etc.)Trapezoidal + tuningClosed since 2023
AM32Cortex-M (multiple)Trapezoidal or FOCOpen, active, leading
Bluebird (BetaFlight ESC)Cortex-M on FCTrapezoidalExperimental

Hardware safety considerations

A drone ESC is a power-electronic device. Failure modes include:

  • Shoot-through — both high-side and low-side MOSFETs in a half-bridge briefly conducting simultaneously, shorting the battery through the MOSFET pair. Causes immediate MOSFET destruction, often a fire. Dead-time (a few hundred nanoseconds gap between high turning off and low turning on) prevents it; the firmware must always inject dead-time even at 100% duty cycle.
  • Over-current. Stalled motor under high throttle pulls 100+ A through one phase. Current-sensing shunt + comparator triggers an emergency-shutoff interrupt; firmware should respond within microseconds.
  • Battery polarity reversal. Capacitors explode dramatically. Most drone ESCs lack reverse-polarity protection (cost); the rule is "check before plugging in".
  • Wire-break / loss of signal. ESC must default to motor-stop on DShot signal loss. Firmware monitors DShot frame timing; >100 ms with no valid frame triggers shutoff.

Cross-references

  • Drone flight controller — sender of DShot.
  • Drone IMU — consumer of BBDShot RPM for harmonic notch.
  • Motor FOC — the algorithm AM32 FOC mode runs.
  • STM32 mainstream — the F051 and G071 chips that host ESC firmware.
  • AM32 GitHub repository; BlueJay project documentation.
  • "BLHeli_S manual" — for the legacy parameter set.