Published February 19, 2026 | Version v2.4.0
Software Open

SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors

Description

SimpleFOClibrary v2.4.0

Main features

  • STM32
    • Added support for ADC reads in addition to Lowside current sense #506
    • Added support for multiple motors low-side CS (one per ADC) with ADC current sensing #503
    • BG341 low-side current sense sync was lost in v2.3.5 - fixed #482
  • ESP32
    • Many ESP32 safety optimisations by @uLipe: #490,#491,#492,#493,#495
    • Better ADC-Timer alignement for more stable current sensing See this commit
    • 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
  • Major New features
    • Add current and voltage feed forward terms to motor classes by @Copper280z in #454
    • Velocity Calculation rework by @Copper280z in #45
    • Motion control - docs
      • Added custom motion control mode - see in docs and in examples
      • Added angle_nocascade control mode for position control without velocity cascade - see in docs - #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
      • Added estimated_current torque control mode for model-based current estimation without current sensing - see in docs
      • Now we can easily switch between voltage and estimated current control
  • Docs updates - see docs
    • Write the code page updated - see docs
    • Better step-by-step setup guides - see docs
    • New motion control documentation - see docs
    • New torque/FOC control documentation - see docs
    • Theory corner updated and extended - see docs
    • Library source updated and extended - see docs
    • Practical guides updated and extended - see docs
      • Motor parameter measurement guide - see docs
      • PID tuning guides - see docs
  • 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

See the milestones: v2.3.6 (unreleased) and v2.4.0

What's Changed

  • Add current and voltage feed forward terms to motor classes by @Copper280z in https://github.com/simplefoc/Arduino-FOC/pull/454
  • Velocity Calculation rework by @Copper280z in https://github.com/simplefoc/Arduino-FOC/pull/453
  • Feat bg341 sync lost fix by @askuric in https://github.com/simplefoc/Arduino-FOC/pull/482
  • Add Silabs drivers and examples by @silabs-szabog in https://github.com/simplefoc/Arduino-FOC/pull/485
  • ESP32: improve PWM driver fast funcrtions by @uLipe in https://github.com/simplefoc/Arduino-FOC/pull/492
  • Move the mcpwm on_full callback entry point to the IRAM. by @uLipe in https://github.com/simplefoc/Arduino-FOC/pull/490
  • ESP32: move adc runtime reading functions to IRAM. by @uLipe in https://github.com/simplefoc/Arduino-FOC/pull/491
  • ESP32C3 fix ledc_channel_config(847): sleep_mode argument invalid by @bisak in https://github.com/simplefoc/Arduino-FOC/pull/489
  • ESP32: replaced the mod base circular increment by @uLipe in https://github.com/simplefoc/Arduino-FOC/pull/493
  • g431-esc: use internal ADC channels, also fix some typos by @Moddingear in https://github.com/simplefoc/Arduino-FOC/pull/487
  • fix minor magnetic_sensor_i2c warning by @Moddingear in https://github.com/simplefoc/Arduino-FOC/pull/496
  • driver: adc_esp32: protect the adc reading against core migration. by @uLipe in https://github.com/simplefoc/Arduino-FOC/pull/495
  • Update teensy4_mcu.cpp _writeDutyCycle6PWM to handle phase_state to allow disabling the motor by @Ragiton in https://github.com/simplefoc/Arduino-FOC/pull/498
  • Fix the issue of abnormal modification of motion_downsample by @CodeMan-P in https://github.com/simplefoc/Arduino-FOC/pull/438
  • initial support for low-side current sensing with multiple motors for stm32 by @askuric in https://github.com/simplefoc/Arduino-FOC/pull/503
  • Add a MotionControlMode::angle_nocascade which uses a single PID for angle control by @runger1101001 in https://github.com/simplefoc/Arduino-FOC/pull/384
  • Autotunng + a big reactor without API chnage by @askuric in https://github.com/simplefoc/Arduino-FOC/pull/504
  • Current PI Autotuning by @Candas1 in https://github.com/simplefoc/Arduino-FOC/pull/426
  • Feat custom motion control by @askuric in https://github.com/simplefoc/Arduino-FOC/pull/514
  • Feat allow spi clock speed change by @askuric in https://github.com/simplefoc/Arduino-FOC/pull/515

New Contributors

  • @silabs-szabog made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/485
  • @uLipe made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/492
  • @bisak made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/489
  • @Moddingear made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/487
  • @Ragiton made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/498
  • @CodeMan-P made their first contribution in https://github.com/simplefoc/Arduino-FOC/pull/438

Full Changelog: https://github.com/simplefoc/Arduino-FOC/compare/v2.3.5...v2.4.0

Notes

If you use this software, please cite it as below.

Files

simplefoc/Arduino-FOC-v2.4.0.zip

Files (5.9 MB)

Name Size Download all
md5:1046f7e41df2318372a0f762f49c9c3f
5.9 MB Preview Download

Additional details

Related works