# Arduino-FOC
**Repository Path**: enjoymoments/Arduino-FOC
## Basic Information
- **Project Name**: Arduino-FOC
- **Description**: https://github.com/simplefoc/Arduino-FOC
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2026-03-01
- **Last Updated**: 2026-05-20
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# SimpleFOClibrary - **Simple** Field Oriented Control (FOC) **library**
### A Cross-Platform FOC implementation for BLDC and Stepper motors
based on the Arduino IDE and PlatformIO
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/arduino.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/stm32.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/esp32.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/rpi.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/samd.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/teensy.yml)
[](https://github.com/simplefoc/Arduino-FOC/actions/workflows/arduino_mbed.yml)




[](https://www.ardu-badge.com/badge/Simple%20FOC.svg)
[](https://registry.platformio.org/libraries/askuric/Simple%20FOC)
[](https://opensource.org/licenses/MIT)
[](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d)
We live in very exciting times 😃! BLDC motors are entering the hobby community more and more and many great projects have already emerged leveraging their far superior dynamics and power capabilities. These motors have numerous advantages over regular DC motors but they have one big disadvantage, the complexity of control. Even though it has become relatively easy to design and manufacture PCBs and create our own hardware solutions for driving BLDC motors, the proper low-cost solutions have been challenging to develop. One of the reasons for this is the apparent complexity of writing the driving algorithms, Field Oriented Control (FOC) being one of the most efficient ones.
The solutions that can be found online are almost exclusively very specific for certain hardware configurations and microcontroller architectures. Similar to BLDCs, Stepper motors can hugely benefit from FOC control, but the solutions for FOC controlled stepper motors are even more scarce.
Therefore this is an attempt to:
- 🎯 Demystify FOC algorithm and make a robust but simple Arduino library: [Arduino SimpleFOClibrary](https://docs.simplefoc.com/arduino_simplefoc_library_showcase)
- Support as many motor + sensor + driver + mcu combinations out there
- Make transitioning from one hardware combination to another as seamless as possible
- 🎯 Develop modular and easy to use FOC supporting driver boards
- For official driver boards see [SimpleFOCBoards](https://docs.simplefoc.com/boards)
- Many many more boards developed by the community members, see [SimpleFOC Community](https://community.simplefoc.com/)
> NEW RELEASE 📢 : SimpleFOClibrary v2.4.0
> - STM32
> - Added support for ADC reads in addition to Lowside current sense [#506](https://github.com/simplefoc/Arduino-FOC/pull/506)
> - Added support for multiple motors low-side CS (one per ADC) with ADC current sensing [#503](https://github.com/simplefoc/Arduino-FOC/pull/503)
> - BG341 low-side current sense sync was lost in v2.3.5 - fixed [#482](https://github.com/simplefoc/Arduino-FOC/pull/482)
> - ESP32
> - Many ESP32 safety optimisations by [@uLipe](https://github.com/uLipe): [#490](https://github.com/simplefoc/Arduino-FOC/pull/490),[#491](https://github.com/simplefoc/Arduino-FOC/pull/491),[#492](https://github.com/simplefoc/Arduino-FOC/pull/492),[#493](https://github.com/simplefoc/Arduino-FOC/pull/493),[#495](https://github.com/simplefoc/Arduino-FOC/pull/495)
> - Better ADC-Timer alignement for more stable current sensing [See this commit](https://github.com/simplefoc/Arduino-FOC/commit/877699b4db4e6e3ecc16b16cc4337af928e746f4)
> - Now compiles for all v3.x arduino-esp32 versions (v2.3.5 was compatible with v3.2.x)
> - `adcRead` small refactor - no more magic numbers
> - Others
> - Teensy4 support for phase state setting [#498](https://github.com/simplefoc/Arduino-FOC/pull/498) by [@Ragiton](https://github.com/Ragiton)
> - Added support for Arduino Nano Matter board by [@silabs-szabog](https://github.com/silabs-szabog) : [#485](https://github.com/simplefoc/Arduino-FOC/pull/484)
> - **Major New features**
> - Add current and voltage feed forward terms to motor classes by [@Copper280z](https://github.com/Copper280z) in [#454](https://github.com/simplefoc/Arduino-FOC/pull/454)
> - Velocity Calculation rework by [@Copper280z](https://github.com/Copper280z) in [#45](https://github.com/simplefoc/Arduino-FOC/pull/45)
> - Motion control - [docs](https://docs.simplefoc.com/motion_control)
> - Added `custom` motion control mode - see in [docs](https://docs.simplefoc.com/custom_control) and in [examples](https://github.com/simplefoc/Arduino-FOC/tree/master/examples/motion_control)
> - Added `angle_nocascade` control mode for position control without velocity cascade - see in [docs](https://docs.simplefoc.com/angle_loop) - [#384](https://github.com/simplefoc/Arduino-FOC/pull/384)
> - **Now all the closed and open loop modes can be used with any torque control modes (voltage and current)**
> - Ex. `velocity_openloop` with `foc_current` torque control
> - Torque control - [docs](https://docs.simplefoc.com/torque_control)
> - Added `estimated_current` torque control mode for model-based current estimation without current sensing - see in [docs](https://docs.simplefoc.com/estimated_current_mode)
> - Now we can easily switch between voltage and estimated current control
> - Docs updates - see [docs](https://docs.simplefoc.com/)
> - Write the code page updated - see [docs](https://docs.simplefoc.com/code)
> - Better step-by-step setup guides - see [docs](https://docs.simplefoc.com/example_from_scratch)
> - New motion control documentation - see [docs](https://docs.simplefoc.com/motion_control)
> - New torque/FOC control documentation - see [docs](https://docs.simplefoc.com/torque_control)
> - Theory corner updated and extended - see [docs](https://docs.simplefoc.com/theory_corner)
> - Library source updated and extended - see [docs](https://docs.simplefoc.com/source_code)
> - Practical guides updated and extended - see [docs](https://docs.simplefoc.com/practical_guides)
> - Motor parameter measurement guide - see [docs](https://docs.simplefoc.com/practical_guides#motor-parameters-and-characterization)
> - PID tuning guides - see [docs](https://docs.simplefoc.com/practical_guides#pid-tuning)
> - Examples
> - `align_current_sense.ino` example added to the `examples/utils/current_sense_test` allowing to verify the alignment between the driver and the current sense phases
> - Changelog
> - See the release notes for more details: [see release](https://github.com/simplefoc/Arduino-FOC/releases)
> - See the milestones: [v2.3.6 (unreleased)](https://github.com/simplefoc/Arduino-FOC/milestone/14) and [v2.4.0](https://github.com/simplefoc/Arduino-FOC/milestone/13)
## Arduino *SimpleFOClibrary* 
SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors.
A. Skuric, HS. Bank, R. Unger, O. Williams, D. González-Reyes
Journal of Open Source Software, 7(74), 4232, https://doi.org/10.21105/joss.04232