From 3469bee12deea9778032c81640e64f0076f607f5 Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:25:32 +0100 Subject: [PATCH 01/10] Add CNAME for custom domain --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000..c15caf78 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +source.simplefoc.com From fea18f58f41af9e1eea90c3d063211692156961c Mon Sep 17 00:00:00 2001 From: gospar Date: Wed, 18 Feb 2026 16:27:41 +0100 Subject: [PATCH 02/10] new release changelog --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1a834e25..5e65d674 100644 --- a/README.md +++ b/README.md @@ -34,16 +34,52 @@ Therefore this is an attempt to: > NEXT RELEASE 📢 : SimpleFOClibrary v2.4.0 > -> - STM32 bugfix -> - BG341 low-side current sense sync was lost in v2.3.5 - fixed [#482](https://github.com/simplefoc/Arduino-FOC/pull/482) -> - ESP32 bugfix -> - 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 -> - New functionality -> - 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/45 +> - STM32 +> - New features +> - 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) +> - bugfix +> - BG341 low-side current sense sync was lost in v2.3.5 - fixed [#482](https://github.com/simplefoc/Arduino-FOC/pull/482) +> - ESP32 +> - New features +> - 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) +> - bugfix +> - 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 +> - Teensy4 +> - support for phase state setting [#498](https://github.com/simplefoc/Arduino-FOC/pull/498) by [@Ragiton](https://github.com/Ragiton) +> - Silabs - Arduino Nano Matter +> - Added support for Arduino Nano Matter board by [@silabs-szabog](https://github.com/silabs-szabog) : [#485](https://github.com/simplefoc/Arduino-FOC/pull/484) +> - 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/utls/current_sense_test` allowing to verify the alignment between the driver and the current sense phases +> - `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) From 92bd7ff48ec7a7122fb75dbfcb0a917fd37ab812 Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:41:06 +0100 Subject: [PATCH 03/10] Update README.md --- README.md | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 5e65d674..27c8a226 100644 --- a/README.md +++ b/README.md @@ -33,29 +33,23 @@ Therefore this is an attempt to: > NEXT RELEASE 📢 : SimpleFOClibrary v2.4.0 -> > - STM32 -> - New features -> - 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) -> - bugfix -> - BG341 low-side current sense sync was lost in v2.3.5 - fixed [#482](https://github.com/simplefoc/Arduino-FOC/pull/482) +> - 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 -> - New features -> - 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) -> - bugfix -> - 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 -> - Teensy4 -> - support for phase state setting [#498](https://github.com/simplefoc/Arduino-FOC/pull/498) by [@Ragiton](https://github.com/Ragiton) -> - Silabs - Arduino Nano Matter +> - 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) -> - New features +> - **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 `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 @@ -82,7 +76,6 @@ Therefore this is an attempt to: > - 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* ![GitHub release (latest by date)](https://img.shields.io/github/v/release/simplefoc/arduino-foc)

From 1e8a70f41b96f22d0d182416e546b1a87e5f784c Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:42:19 +0100 Subject: [PATCH 04/10] Revise README with new torque control and examples Updated documentation with new features and guides. --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 27c8a226..313427a7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ Therefore this is an attempt to: > - 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) @@ -67,10 +66,8 @@ Therefore this is an attempt to: > - 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) From 4f072b365f6e0185adca544071e595834405babc Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:06:45 +0100 Subject: [PATCH 05/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 313427a7..763656d7 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Therefore this is an attempt to: - Many many more boards developed by the community members, see [SimpleFOC Community](https://community.simplefoc.com/) -> NEXT RELEASE 📢 : SimpleFOClibrary v2.4.0 +> 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) From 3877084cb3abdd9def2e77bd064a2b49b0f99d11 Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:54:20 +0100 Subject: [PATCH 06/10] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 763656d7..b9b52b84 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ This video is a bit outdated but it demonstrates the *Simple**FOC**library* basi - PlatformIO - **Open-Source**: Full code and documentation available on github - **Goal**: - - Support as many [sensor](position_sensors) + [motor](motors) + [driver](drivers) + [current sense](current_sense) combinations as possible + - Support as many [sensor](https://docs.simplefoc.com/position_sensors) + [motor](https://docs.simplefoc.com/motors) + [driver](https://docs.simplefoc.com/drivers) + [current sense](https://docs.simplefoc.com/current_sense) combinations as possible - Make transitioning from one hardware combination to another as seamless as possible - Provide up-to-date and in-depth documentation with API references and examples - **Easy to setup and configure**: @@ -97,11 +97,11 @@ This video is a bit outdated but it demonstrates the *Simple**FOC**library* basi - Each hardware component is a C++ object (easy to understand) - Easy [tuning the control loops](motion_control) - Advanced control features: velocity and current feed-forward, improved velocity calculation - - [*Simple**FOC**Studio*](studio) configuration GUI tool for real-time tuning and monitoring + - [*Simple**FOC**Studio*](https://docs.simplefoc.com/studio) 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](microcontrollers): + - Supports multiple [MCU architectures](https://docs.simplefoc.commicrocontrollers): - Arduino: UNO R4, UNO, MEGA, DUE, Leonardo, Nano, Nano33, MKR .... - STM32 (Nucleo, Bluepill, B-G431B-ESC1, H7 family, etc.) - ESP32 (ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6) From 222e54714a6a13c8d18afba1dd66653c6bf8d2e3 Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:55:07 +0100 Subject: [PATCH 07/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9b52b84..9bb5a80b 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ This video is a bit outdated but it demonstrates the *Simple**FOC**library* basi - **Easy to setup and configure**: - Easy hardware configuration - Each hardware component is a C++ object (easy to understand) - - Easy [tuning the control loops](motion_control) + - Easy [tuning the control loops](https://docs.simplefoc.com/motion_control) - Advanced control features: velocity and current feed-forward, improved velocity calculation - [*Simple**FOC**Studio*](https://docs.simplefoc.com/studio) configuration GUI tool for real-time tuning and monitoring - Built-in communication and monitoring via Serial, I2C, or custom protocols From 26dc6e8a4d6a34f11b657c1583de209588f2158d Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Sun, 22 Feb 2026 05:32:06 +0100 Subject: [PATCH 08/10] Integrate torque control into motor loop Added torque control call to motor loop in the main loop. --- .../open_loop_velocity_example.ino | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/motion_control/open_loop_motor_control/open_loop_velocity_example/open_loop_velocity_example.ino b/examples/motion_control/open_loop_motor_control/open_loop_velocity_example/open_loop_velocity_example.ino index b1bc2760..dd0c4452 100644 --- a/examples/motion_control/open_loop_motor_control/open_loop_velocity_example/open_loop_velocity_example.ino +++ b/examples/motion_control/open_loop_motor_control/open_loop_velocity_example/open_loop_velocity_example.ino @@ -68,7 +68,10 @@ void setup() { } void loop() { - + + //torque control + // should be called as frequently as possible + motor.loopFOC(); // open loop velocity movement // using motor.voltage_limit and motor.velocity_limit // to turn the motor "backwards", just set a negative target_velocity From 7f9c45fa3af42eec993b807b97dc544f50975e73 Mon Sep 17 00:00:00 2001 From: Antun Skuric <36178713+askuric@users.noreply.github.com> Date: Sun, 22 Feb 2026 05:32:24 +0100 Subject: [PATCH 09/10] Implement torque control in loop function Added torque control call to motor loop in the main loop. --- .../open_loop_position_example/open_loop_position_example.ino | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino b/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino index 6db1b979..d564f47e 100644 --- a/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino +++ b/examples/motion_control/open_loop_motor_control/open_loop_position_example/open_loop_position_example.ino @@ -71,6 +71,9 @@ void setup() { } void loop() { + //torque control + // should be called as frequently as possible + motor.loopFOC(); // open loop angle movements // using motor.voltage_limit and motor.velocity_limit // angles can be positive or negative, negative angles correspond to opposite motor direction From 60ff3e7a747958fd62ab2ea2883ffb7725e71e8b Mon Sep 17 00:00:00 2001 From: Austin Bowen Date: Sun, 12 Apr 2026 11:30:14 -0400 Subject: [PATCH 10/10] Correct sensor angle calculation by subtracting min_raw_count from raw_count --- src/sensors/MagneticSensorAnalog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sensors/MagneticSensorAnalog.cpp b/src/sensors/MagneticSensorAnalog.cpp index d4adad60..41698392 100644 --- a/src/sensors/MagneticSensorAnalog.cpp +++ b/src/sensors/MagneticSensorAnalog.cpp @@ -33,7 +33,7 @@ void MagneticSensorAnalog::init(){ float MagneticSensorAnalog::getSensorAngle(){ // raw data from the sensor raw_count = getRawCount(); - return ( (float) (raw_count) / (float)cpr) * _2PI; + return ( (float) (raw_count - min_raw_count) / (float)cpr) * _2PI; } // function reading the raw counter of the magnetic sensor