Three-phase BLDC gate driver firmware for the ESP32, using the hardware MCPWM unit and IR2110 half-bridge drivers.
Firmware for driving a three-phase brushless motor from an ESP32, written against the ESP-IDF MCPWM peripheral rather than software PWM. Each phase is switched through an IR2110 high and low side gate driver.
Built with PlatformIO.
Taken from src/main.cpp. Check this against your board before you power a
bridge, because a mismatch here shorts a half bridge through both FETs.
| Phase | High side | Low side | Gate driver |
|---|---|---|---|
| 1 | GPIO 23 | GPIO 22 | IR2110 #1 |
| 2 | GPIO 21 | GPIO 19 | IR2110 #2 |
| 3 | GPIO 18 | GPIO 5 | IR2110 #3 |
Current sense inputs are defined in the same file alongside the gate pins.
The ESP32 MCPWM unit generates complementary pairs with a hardware dead time. Dead time in hardware is not a convenience here: if both FETs of a half bridge conduct at once, even briefly, the bridge shoots through. Doing it in software means a scheduling hiccup can destroy hardware.
pio run # build
pio run --target upload # flash
pio device monitor # serial outputBoard and framework settings are in platformio.ini.
Bring the bus up on a current-limited supply the first time, and keep the motor uncoupled. A wrong phase order is recoverable; a shoot-through is not.
The Voltaris electric vehicle project, alongside
AKS for vehicle control and
dashboard for telemetry.
motor_driver/
├── .vscode/
├── src/
├── platformio.ini
4 tracked files · 0.0 MB · 1 languages · last pushed 2025-07-06