simplefoc/Arduino-FOC

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library

What it solves

Field Oriented Control (FOC) is one of the most efficient ways to drive brushless DC (BLDC) and stepper motors, but it is traditionally complex to implement. This library simplifies the process by providing a robust, cross-platform implementation that removes the need to write complex driving algorithms from scratch for every different hardware configuration.

How it works

The library treats each hardware component—motors, sensors, and drivers—as C++ objects. This modular approach allows users to link different combinations of hardware (e.g., a specific encoder and a BLDC motor) and switch between them seamlessly. It supports various control modes, including voltage and current torque control, as well as closed and open-loop motion control (velocity and position).

Who it’s for

It is designed for the hobbyist community, researchers, and developers using the Arduino IDE or PlatformIO who need precise motor control across a wide range of microcontroller architectures (including STM32, ESP32, RP2040, and Teensy).

Highlights

  • Cross-Platform Support: Works across numerous MCU architectures including Arduino, STM32, ESP32, RP2040, and SAMD.
  • Modular Hardware: Supports a vast array of sensor, motor, driver, and current sense combinations.
  • Advanced Control: Includes velocity and current feed-forward, improved velocity calculation, and model-based current estimation.
  • Tuning Tools: Offers a configuration GUI tool called SimpleFOCStudio for real-time monitoring and and tuning.

Related

  • Project
  • Project
  • Project
  • Project
  • Project