On this page
Arduino SimpleFOClibrary
This Arduino library implements Field Oriented Control (FOC) algorithm for BLDC, Stepper, and Hybrid Stepper motors. FOC algorithm produces incomparably smooth operation and high degree of torque, velocity and position control. The library is intended both for:
- Beginners searching for a simple and user-friendly way to learn how to control BLDC and Stepper motors
- Advanced users ready to dig deeper into the FOC algorithm and optimize the code for their particular application/hardware
Features
- Easy install:
- Arduino IDE: Arduino Library Manager integration
- PlatformIO
- Open-Source: Full code and documentation available on GitHub
- Goal:
- Support as many sensor + motor + driver + current sense combinations as possible
- Support for BLDC motors, Stepper motors, and Hybrid Stepper motors
- Inline current sensing with low-side and high-side configurations
- Provide up-to-date and in-depth documentation with API references and examples
- Easy to setup and configure:
- Easy hardware configuration
- Each hardware component is a C++ object (easy to understand)
- Easy tuning the control loops
- Advanced control features: velocity and current feed-forward, improved velocity calculation
- SimpleFOCStudio configuration GUI tool for real-time tuning and monitoring
- Built-in communication and monitoring via Serial, I2C, or custom protocols
- Cross-platform:
- Seamless code transfer from one microcontroller family to another
- Supports multiple MCU architectures:
- Arduino: UNO R4, UNO, MEGA, DUE, Leonardo, Nano, Nano33 ….
- STM32 (Nucleo, Bluepill, B-G431B-ESC1, etc.)
- ESP32
- Teensy
- RP2040 (Raspberry Pi Pico)
- SAMD (Arduino Zero, MKR boards)
- MBED (Portenta, Nano 33 BLE)
- Silabs
- many more …
YouTube demonstration videos
This video demonstrates SimpleFOClibrary basic usage, electronic connections and shows its basic capabilities.
The video hardware setup consists of:
- HMBGC V2.2 board Ebay link
- AMT 103 CUI Encoder 2048ppr Mouser link
- BLDC Gimbal Motor Aliexpress link
This video demonstrates SimpleFOClibrary support for high-performance BLDC drivers such as DRV8302 and the support for Arudino and STM32 MCU architectures.
The video hardware setup consists of:
- DRV8302 driver board Aliexpress link
- Arduino UNO Ebay link
- Nucleo-64 F401REMouser link
- USA-DIGITAL E3-8192 Encoder 8192ppr USA Digital link
- BLDC Gimbal Motor GBM5108-120T iPower store
This video demonstrates SimpleFOClibrary support for Arduino SimpleFOCShield and using multiple motors with Arduino UNO. The project examples are based on bidirectional haptic control.
The video hardware setup consists of:
- Arduino SimpleFOCShield More info
- Arduino UNO Ebay link
- Nucleo-64 F401REMouser link
- AS5600 Ebay link
- AMT 103 CUI Mouser link
- USA-DIGITAL E3-8192 USA Digital link
- GBM5108-120T iPower store
- GBM4108-120T Robotshop
Installation
There are multiple ways of installing this Arduino library, depending on your plans with the code and your particular application. Check our installation guide for more information.

Supported hardware
Arduino SimpleFOClibrary is made modular and will support most of the motor + sensor combinations out there, as well as many low-cost bldc driver boards.

Writing the Code
This library code is written in a way to be as simple sa possible to use and to leave a lot of space for configuration and fine tuning for specific applications.
Project Examples
We are very happy to provide you with several projects multiple hardware configurations and fully documented and explained code! Go see the examples!


