Driving a Motor with STM32 | Quick Tutorial (Drone Example Using GaN Controller)

Robert Feranec
Robert FeranecApr 23, 2026

Why It Matters

This streamlined, open‑source workflow lets engineers bring motor‑driven products to market faster while minimizing custom firmware effort and ensuring safety features are configurable.

Key Takeaways

  • STM32 Motor Control Workbench auto‑generates firmware for GaN inverter.
  • Users can configure PWM, dead time, and sensor settings via GUI.
  • Project files, including JSON motor/board descriptors, are downloadable from GitHub.
  • The tool supports modular, inverter, and pack hardware configurations.
  • Generated code compiles in STM32CubeIDE and flashes to the controller.

Summary

The video walks viewers through a step‑by‑step tutorial on driving a high‑power agricultural‑drone motor using an STM32 microcontroller paired with an EPC GaN inverter. It demonstrates the complete workflow from hardware setup inside a safety cage to software configuration with ST’s Motor Pilot web app.

Key points include configuring the inverter’s PWM frequency to 80 kHz and a dead‑time of 75 ns, selecting the G431 “Nuclear” control board, and defining motor parameters (pole pairs, back‑EMF constant, resistance, inductance) via JSON files. The Motor Control Workbench lets users choose modular, inverter, or pack hardware modes and automatically generates the necessary CubeMX project files.

The presenter highlights that the Motor Pilot tool reports both reference and measured RPM, and that over‑current and temperature protections can be tuned or disabled through the JSON descriptors. All project files, including Altium board layouts and motor JSONs, are hosted on a public GitHub repository for easy replication.

By automating code generation and providing a graphical interface for hardware parameters, the workflow dramatically reduces development time for embedded motor‑control applications, enabling rapid prototyping of drone propulsion systems and other high‑current drives.

Original Description

Easy way to generate STM32 code to drive a motor. Thank you very much Federico Unnia
Links:
- EPC website: https://epc-co.com
- FEDEVEL courses: https://fedevel.com/courses
Chapters:
00:00 What is this video about
00:47 Demo
05:34 Motor Control Workbench
10:14 Starting a new Motor Control Project
12:47 Adding a new motor
20:08 Generating the code to control a motor
22:47 STM32CubeIDE - opening project and flashing the code
26:26 Using Motor Pilot to test the code
29:30 About GaN
31:32 GaN - PWM Frequency increase advantages
34:30 GaN - Dead time reduction advantages
40:17 Power boards and GaN Transistors
44:39 Schematic of Power board
48:56 About EPC Company
------------------------------------------------------
(C) FEDEVEL by Robert Feranec

Comments

Want to join the conversation?

Loading comments...