+ {% if page.toc == true %}
+
+
+ On this page
+
+
+
+
+
+
+ {{ content | toc_only }}
+
+ {% endif %}
+ {% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="" anchorClass="anchor-heading" %}
- {% else %}
+ {% else %}
{{ content }}
{% endif %}
{% if page.has_children == true and page.has_toc != false %}
diff --git a/_sass/overrides.scss b/_sass/overrides.scss
index 51639ce..cd2a93b 100644
--- a/_sass/overrides.scss
+++ b/_sass/overrides.scss
@@ -433,4 +433,80 @@ a.remove_dec{
.inline_block_top{
display: inline-block;
vertical-align: top;
+}
+
+.hide {
+ display: none;
+}
+
+
+
+// custom inpage toc
+.inpage_toc {
+ position:fixed;
+ right:20px;
+ background-color: rgb(252, 252, 252);
+ padding: 10px;
+ max-width: 300px;
+ z-index: 100;
+}
+.inpage_toc a {
+ text-overflow: ellipsis;
+ white-space: normal !important;
+}
+
+.inpage_toc {
+ margin: 0.2em;
+ margin-left: 0.7em;
+ padding: 5px;
+ padding-left: 10px;
+ border-right: 5px solid;
+ border-radius: 3px;
+ color: #686969;
+ opacity: 0.95;
+}
+.inpage_toc summary{
+ cursor: pointer;
+ font-size: 1em !important;
+ // text-transform: none !important;
+ color: #686969;
+ margin: 10px;
+}
+.inpage_toc ul{
+ list-style-type: none; /* Remove bullets */
+}
+details[open] .marker-open {
+ display: inline;
+}
+details[open] .marker-closed {
+ display: none;
+}
+details .marker-open {
+ display: none;
+}
+details .marker-closed {
+ display: inline;
+}
+
+.inpage_toc .marker-closed{
+float: right;
+}
+.inpage_toc .marker-open{
+ float: right;
+}
+#toc li {
+ // margin: 0px;
+ font-size: 0.95em;
+}
+ /* Styles for larger screens (default open) */
+ @media (min-width: 768px) {
+ .inpage_toc{
+ display: block;
+ }
+}
+/* Styles for smaller screens (default closed) */
+@media (max-width: 767px) {
+ .inpage_toc{
+ display: none;
+ }
}
\ No newline at end of file
diff --git a/docs/boards/index.md b/docs/boards/index.md
index 17c67e0..248407f 100644
--- a/docs/boards/index.md
+++ b/docs/boards/index.md
@@ -6,6 +6,7 @@ nav_order: 2
permalink: /boards
has_children: true
has_toc: false
+toc: true
---
# SimpleFOC Boards
@@ -33,7 +34,7 @@ In addition to the official boards, there are many other boards compatible with
These boards are designed to be compatible with the Arduino UNO R3 headers, enabling an easy to start experience with the SimpleFOClibrary and the Arduino IDE. The boards can be used with any board with the standard Arduino headers, such as the Arduino MEGA, STM32 Nucleo boards, Adafruit Metro, ESP32 D1 R3, Arudino UNO R4 and many others. This format enables usesr to easily exchange the microcontrollers and find the best solution for their application. The boards are fully open-source and the fabrication files are available in the respective repositories, as well as detailed guides on how to fabricate the boards yourself. The boards are additionally available in the [shop](https://www.simplefoc.com/shop) for those who prefer to buy them, as well as on other mainstream platforms like Aliexpress and Ebay (no relation to the SimpleFOCproject).
-## SimpleFOCShield v3.2 - [Find out more](arduino_simplefoc_shield_showcase)
+### SimpleFOCShield v3.2 - [Find out more](arduino_simplefoc_shield_showcase)


@@ -48,6 +49,7 @@ The SimpleFOCShield, in com
### Features
+{: .no_toc }
- **Plug & play**: In combination with Arduino *Simple**FOC**library* - [github](https://github.com/simplefoc/Arduino-FOC)
- **Low-cost**: Price of 15-30€ - [Check the pricing](https://www.simplefoc.com/shop)
- **In-line current sensing**: Up to 5Amps bidirectional
@@ -72,7 +74,7 @@ The SimpleFOCShield, in com
-## SimpleFOCPowerShield v0.2 ⚠️( development abandoned )
+### SimpleFOCPowerShield v0.2 ⚠️( development abandoned )
A powerful arduino shield for running BLDC motors using the FOC algorithm. This board is based on the [BTN8982](https://www.infineon.com/dgdl/Infineon-BTN8982TA-DS-v01_00-EN.pdf?fileId=db3a30433fa9412f013fbe32289b7c17) half bridges and can support currents up to 30 Amps continuos and 50Amps peak. Making it a board that can run virtually any BLDC motor.
@@ -91,6 +93,7 @@ This does not mean that the board itself is not functional or that it will not w
### Features
+{: .no_toc }
- **Plug & play**: In combination with Arduino SimpleFOClibrary
- **Low-cost**: Fabrication price under €25/pcs - **⚠️ will not be sold by silplefoc.com**
- **High-side current sensing**: - not yet supported by *Simple**FOC**library*
@@ -114,7 +117,7 @@ Read more about this board at [link](https://github.com/simplefoc/Arduino-Simple
This is a set of miniature boards designed to be small, low-cost, and easy to use. They are intended for low power applications and are designed to be compatible with the SimpleFOClibrary. The boards are created as minimal working examples and are intended to be used as a reference design for the community to build upon. The boards are fully open-source and the fabrication files are available in the respective repositories, as well as detailed guides on how to fabricate the boards yourself. The boards are additionally available in the [shop](https://www.simplefoc.com/shop) for those who prefer to buy them, as well as on other mainstream platforms like Aliexpress and Ebay (no relation to the SimpleFOCproject).
-## SimpleFOCMini v1.1 - [Find out more](simplefocmini)
+### SimpleFOCMini v1.1 - [Find out more](simplefocmini)


@@ -128,7 +131,8 @@ Small package, low-cost BLDC driver board fully compatible with the SimpleFOClibrary
- **DRV8313 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8313.pdf?ts=1650461862269&ref_url=https%253A%252F%252Fwww.google.com%252F)
- Power supply: 8-35V
@@ -149,7 +153,7 @@ Read more about this board at [link](https://github.com/simplefoc/SimpleFOCMini)
-## SimpleFOCStepMini v1.0 - [See on Github](https://github.com/simplefoc/SimpleFOC-StepMini)
+### SimpleFOCStepMini v1.0 - [See on Github](https://github.com/simplefoc/SimpleFOC-StepMini)


@@ -160,7 +164,8 @@ Small package, low-cost Stepper driver board fully compatible with the
-## Features
+### Features
+{: .no_toc }
- **Plug & play**: In combination with Arduino SimpleFOClibrary
- **DRV8844 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8844.pdf)
- Power supply: 8-35V
diff --git a/docs/boards/simplefoc_mini/getting_started/code.md b/docs/boards/simplefoc_mini/getting_started/code.md
index 717310a..8cfc2e2 100644
--- a/docs/boards/simplefoc_mini/getting_started/code.md
+++ b/docs/boards/simplefoc_mini/getting_started/code.md
@@ -7,8 +7,10 @@ nav_order: 2
permalink: /mini_code
grand_parent: SimpleFOCMini
grand_grand_parent: SimpleFOC Boards
+toc: true
---
+
# Writing the code
Once you have all the [hardware connected](mini_connect_hardware):
- Microcontroller
diff --git a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md
index f72b856..68c33f2 100644
--- a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md
+++ b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md
@@ -8,9 +8,11 @@ parent: Connecting the hardware
grand_parent: Starting with Mini
grand_grand_parent: SimpleFOCMini
grand_grand_grand_parent: SimpleFOC Boards
+toc: true
---
+
# Connecting the hardware to SimpleFOCMini v1
Connecting the SimpleFOCMini to the microcontroller, BLDC motor and power-supply is very straight forward.
diff --git a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md
index 64a80f0..9596b5d 100644
--- a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md
+++ b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md
@@ -8,6 +8,7 @@ parent: Connecting the hardware
grand_parent: Starting with Mini
grand_grand_parent: SimpleFOCMini
grand_grand_grand_parent: SimpleFOC Boards
+toc: true
---
# Connecting the hardware to SimpleFOCMini v1.1
diff --git a/docs/boards/simplefoc_mini/index.md b/docs/boards/simplefoc_mini/index.md
index a39ce43..ede9955 100644
--- a/docs/boards/simplefoc_mini/index.md
+++ b/docs/boards/simplefoc_mini/index.md
@@ -7,6 +7,7 @@ nav_order: 2
permalink: /simplefocmini
has_children: true
has_toc: false
+toc: true
---
diff --git a/docs/boards/simplefoc_mini/mini_fabrication.md b/docs/boards/simplefoc_mini/mini_fabrication.md
index 41bc877..c34cf82 100644
--- a/docs/boards/simplefoc_mini/mini_fabrication.md
+++ b/docs/boards/simplefoc_mini/mini_fabrication.md
@@ -8,6 +8,7 @@ nav_order: 2
permalink: /mini_fabrication
has_children: true
has_toc: false
+toc: true
---
diff --git a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v1.md b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v1.md
index 32d7a03..84e4e95 100644
--- a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v1.md
+++ b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v1.md
@@ -7,7 +7,9 @@ grand_parent: SimpleFOCShieldSimpleFOC Boards
nav_order: 1
permalink: /arduino_simplefoc_shield_fabrication_v1
+toc: true
---
+
# Fabrication guide for SimpleFOCShieldv1.x
Here is a quick guide how to fabricate the Arduino SimpleFOCShield [version V1.3.3](https://github.com/simplefoc/Arduino-SimpleFOCShield/releases)
diff --git a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v2.md b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v2.md
index 13f4d8c..d0cb015 100644
--- a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v2.md
+++ b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v2.md
@@ -7,7 +7,9 @@ grand_parent: SimpleFOCShieldSimpleFOC Boards
nav_order: 2
permalink: /arduino_simplefoc_shield_fabrication_v2
+toc: true
---
+
# Fabrication guide for SimpleFOCShieldv2.x
Here is a quick guide how to fabricate the Arduino SimpleFOCShield [version V2.0.4](https://github.com/simplefoc/Arduino-SimpleFOCShield/releases)
diff --git a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v3.md b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v3.md
index 79e89c5..1d3bafe 100644
--- a/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v3.md
+++ b/docs/boards/simplefoc_shield/fabrication/shield_fabrication_v3.md
@@ -7,7 +7,9 @@ grand_parent: SimpleFOCShieldSimpleFOC Boards
nav_order: 3
permalink: /arduino_simplefoc_shield_fabrication_v3
+toc: true
---
+
# Fabrication guide for SimpleFOCShieldv3.x
Here is a quick guide how to fabricate the Arduino SimpleFOCShield [version V3.2](https://github.com/simplefoc/Arduino-SimpleFOCShield/releases)
diff --git a/docs/boards/simplefoc_shield/getting_started/code.md b/docs/boards/simplefoc_shield/getting_started/code.md
index 8a850a2..762cb54 100644
--- a/docs/boards/simplefoc_shield/getting_started/code.md
+++ b/docs/boards/simplefoc_shield/getting_started/code.md
@@ -7,6 +7,7 @@ nav_order: 3
permalink: /foc_shield_code
grand_parent: SimpleFOCShield
grand_grand_parent: SimpleFOC Boards
+toc: true
---
# Writing the code
diff --git a/docs/boards/simplefoc_shield/getting_started/connections.md b/docs/boards/simplefoc_shield/getting_started/connections.md
index b7a682e..cf4141e 100644
--- a/docs/boards/simplefoc_shield/getting_started/connections.md
+++ b/docs/boards/simplefoc_shield/getting_started/connections.md
@@ -7,6 +7,7 @@ nav_order: 2
permalink: /foc_shield_connect_hardware
grand_parent: SimpleFOCShield
grand_grand_parent: SimpleFOC Boards
+toc: true
---
# Connecting the hardware
diff --git a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v1.md b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v1.md
index 7be7638..cf36b15 100644
--- a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v1.md
+++ b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v1.md
@@ -8,7 +8,9 @@ nav_order: 1
permalink: /pads_soldering_v1
grand_grand_parent: SimpleFOCShield
grand_grand_grand_parent: SimpleFOC Boards
+toc: true
---
+
# Hardware configuration using soldering pads SimpleFOCShield v1
One of the very important features of the Arduino SimpleFOCShield is the hardware configuration.
diff --git a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v2.md b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v2.md
index 771037b..c6b3d73 100644
--- a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v2.md
+++ b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v2.md
@@ -8,7 +8,9 @@ nav_order: 2
permalink: /pads_soldering_v2
grand_grand_parent: SimpleFOCShield
grand_grand_grand_parent: SimpleFOC Boards
+toc: true
---
+
# Hardware configuration using soldering pads SimpleFOCShield v2
One of the very important features of the Arduino SimpleFOCShield is the hardware configuration.
diff --git a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v3.md b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v3.md
index de369fa..c535cf9 100644
--- a/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v3.md
+++ b/docs/boards/simplefoc_shield/getting_started/soldering_pads/pads_v3.md
@@ -8,6 +8,7 @@ nav_order: 3
permalink: /pads_soldering_v3
grand_grand_parent: SimpleFOCShield
grand_grand_grand_parent: SimpleFOC Boards
+toc: true
---
+SimpleFOCMini V1.0
+SimpleFOCMini V1.1
-SimpleFOCMini V1.0
-SimpleFOCMini V1.1
-
+
## Encoder
- Channels `A` and `B` are connected to the Arduino UNO pins `2` and `3`.
@@ -55,10 +41,13 @@ Choose your SimpleFOCMini v
- Motor phases `a`, `b` and `c` are connected directly the motor terminal connector connectors `M1`, `M2` and `M3` of the SimpleFOCMini board
-
- The most convenient way of plugging the SimpleFOCMini v1.0 board to the Arduino UNO is to stack it on its pins `8-12`.
- `GND` - `12`
- `IN1` - `11`
@@ -73,9 +62,7 @@ Pin `12` is not a real ground pin. As no power is transferred through the mini's
-
-
-## SimpleFOCMini v1.1
+
- The most convenient way of plugging the SimpleFOCMini v1.1 board to the Arduino UNO is to stack it on its pins `9-12`.
- `GND` - `GND`
@@ -88,7 +75,7 @@ Pin `12` is not a real ground pin. As no power is transferred through the mini's
-### Small motivation :D
+# Small motivation :D
@@ -127,6 +114,10 @@ And that is it, let's setup the motor.
## Motor code
+
+SimpleFOCMini V1.0
+SimpleFOCMini V1.1
+
First we need to define the `BLDCMotor` class with the number od pole pairs (`11`)
```cpp
// define BLDC motor
@@ -134,7 +125,7 @@ BLDCMotor motor = BLDCMotor(11);
```
If you are not sure what your pole pairs number is please check the find_pole_pairs.ino example.
-
+
Next we need to define the `BLDCDriver3PWM` class with the PWM pin numbers of the motor and the driver enable pin
```cpp
@@ -329,7 +320,7 @@ void loop() {
-
+
```cpp
#include
diff --git a/docs/simplefoc_library/examples/position_control_example_mini_nucleo.md b/docs/simplefoc_library/examples/position_control_example_mini_nucleo.md
index ff13da2..2b831dd 100644
--- a/docs/simplefoc_library/examples/position_control_example_mini_nucleo.md
+++ b/docs/simplefoc_library/examples/position_control_example_mini_nucleo.md
@@ -6,9 +6,11 @@ description: "Arduino Simple Field Oriented Control (FOC) library ."
nav_order: 10
permalink: /mini_example_nucleo
grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# Position control example using SimpleFOCMini
For this BLDC motor position control example we are going to be using this hardware:
@@ -24,30 +26,11 @@ For more information about the SimpleFOC<
Choose your SimpleFOCMini version:
-
-
-
-
-
-SimpleFOCMini V1.0
-SimpleFOCMini V1.1
+SimpleFOCMini V1.0
+SimpleFOCMini V1.1
-
+
## Encoder
- Channels `A` and `B` are connected to the Arduino UNO pins `2` and `3`.
@@ -55,10 +38,12 @@ Choose your SimpleFOCMini v
## Motor
- Motor phases `a`, `b` and `c` are connected directly the motor terminal connector connectors `M1`, `M2` and `M3` of the SimpleFOCMini board
+## SimpleFOCMini
-
- The most convenient way of plugging the SimpleFOCMini board to the Nucleo board is to stack it on its pins `10-13`.
- `GND` - `GND`
@@ -70,9 +55,7 @@ Choose your SimpleFOCMini v
-
-
-## SimpleFOCMini v1.1
+
- The most convenient way of plugging the SimpleFOCMini board to the Nucleo board is to stack it on its pins `10-13`.
- `GND` - `GND`
@@ -118,6 +101,11 @@ And that is it, let's setup the motor.
## Motor code
+
+
+SimpleFOCMini V1.0
+SimpleFOCMini V1.1
+
First we need to define the `BLDCMotor` class with the number od pole pairs (`11`)
```cpp
// define BLDC motor
@@ -136,7 +124,7 @@ Next we need to define the `BLDCDriver3PWM` class with the PWM pin numbers of th
BLDCDriver3PWM driver = BLDCDriver3PWM(13, 12, 11, 10);
```
-
+
```cpp
// define BLDC driver
@@ -219,6 +207,10 @@ That is it, let's see the full code now!
To the full code I have added a small serial [commander interface](commander_interface), to be able to change position/angle target value in real time.
+
+SimpleFOCMini V1.0
+SimpleFOCMini V1.1
+
```cpp
@@ -309,7 +301,7 @@ void loop() {
-
+
```cpp
#include
diff --git a/docs/simplefoc_library/examples/position_control_example_nucleo.md b/docs/simplefoc_library/examples/position_control_example_nucleo.md
index 440c518..f7121fe 100644
--- a/docs/simplefoc_library/examples/position_control_example_nucleo.md
+++ b/docs/simplefoc_library/examples/position_control_example_nucleo.md
@@ -6,9 +6,11 @@ description: "Arduino Simple Field Oriented Control (FOC) library ."
nav_order: 5
permalink: /position_control_nucleo_example
grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# Position control example using SimpleFOCShield and Stm32 Nucleo-64
For this BLDC motor position control example we are going to be using this hardware:
diff --git a/docs/simplefoc_library/examples/stepper_control_nucleo.md b/docs/simplefoc_library/examples/stepper_control_nucleo.md
index d6659cc..1515d81 100644
--- a/docs/simplefoc_library/examples/stepper_control_nucleo.md
+++ b/docs/simplefoc_library/examples/stepper_control_nucleo.md
@@ -6,9 +6,11 @@ description: "Arduino Simple Field Oriented Control (FOC) library ."
nav_order: 8
permalink: /stepper_control_nucleo
grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# Stepper motor control example using L298N and Stm32 Nucleo-64
For this stepper motor control example we are going to be using this hardware:
diff --git a/docs/simplefoc_library/examples/velocity_control_example.md b/docs/simplefoc_library/examples/velocity_control_example.md
index cd0faba..10f9aa9 100644
--- a/docs/simplefoc_library/examples/velocity_control_example.md
+++ b/docs/simplefoc_library/examples/velocity_control_example.md
@@ -6,8 +6,10 @@ description: "Arduino Simple Field Oriented Control (FOC) library ."
nav_order: 2
permalink: /velocity_control_example
grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# Velocity control example using Drotek's L6234 driver
[Drotek's L6234 breakout board](https://store-drotek.com/212-brushless-gimbal-controller-l6234.html) is a very minimalistic 3-phase BLDC motor driver and is very suitable for jump-starting your FOC experience. Here we the velocity control example project using the SimpleFOClibrary and this hardware:
diff --git a/docs/simplefoc_library/hardware/drivers/BLDC_drivers.md b/docs/simplefoc_library/hardware/drivers/BLDC_drivers.md
index c2bebec..3717383 100644
--- a/docs/simplefoc_library/hardware/drivers/BLDC_drivers.md
+++ b/docs/simplefoc_library/hardware/drivers/BLDC_drivers.md
@@ -7,8 +7,10 @@ permalink: /bldc_drivers
parent: Drivers
grand_parent: Supported Hardware
grand_grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# BLDC motor drivers
This library will be compatible with most 3 phase BLDC motor drivers. Such as [ L6234](https://www.st.com/en/motor-drivers/l6234.html), [ DRV8305](https://www.ti.com/product/DRV8305), [ DRV8313](https://www.ti.com/product/DRV8313) or even [ L293](http://www.ti.com/lit/ds/symlink/l293.pdf).
diff --git a/docs/simplefoc_library/hardware/mcus/esp32.md b/docs/simplefoc_library/hardware/mcus/esp32.md
index e0118de..e9f61dc 100644
--- a/docs/simplefoc_library/hardware/mcus/esp32.md
+++ b/docs/simplefoc_library/hardware/mcus/esp32.md
@@ -11,18 +11,30 @@ grand_grand_parent: Arduino SimpleFOCSimpleFOClibrary and will work with all driver types.
-
+### PWM drivers
+
+Esp32 mcus have two different low-level drivers for PWM generation: `MCPWM` and `LEDC`. The `MCPWM` driver (**M**otor **C**ontrol **PWM**) is a more advanced driver that allows more control over the PWM signals and is used by default in the SimpleFOClibrary. The `LEDC` driver is a simpler driver that is by default intended for LED control but can also be used for motor control. The `LEDC` driver is a lot les flexible than the `MCPWM` driver but SimpleFOClibrary supports it as well. By default the `MCPWM` driver is used on all other esp32 devices if available, if not the `LEDC` driver is used (ex. esp32-s2 and esp32-c3 devices).
+If you are using an esp32 device that supports the `MCPWM` driver and you want to use the `LEDC` driver, you can force the use of the `LEDC` driver by defining the `SIMPLEFOC_ESP32_USELEDC` build flag.
+
+
RULE OF THUMB: `MCPWM` vs `LEDC`
+If you are using an esp32 device that supports the `MCPWM` driver, it is recommended to use it. The `MCPWM` driver is more flexible and allows more control over the PWM signals. If you are using an esp32 device that does not support the `MCPWM` driver, the `LEDC` driver can be used as well.
+
A short guide the units for the main motor/sensor parameters and control variables and how to transfor them
+
+
diff --git a/docs/simplefoc_library/practical/library_units.md b/docs/simplefoc_library/practical/library_units.md
new file mode 100644
index 0000000..fb3a4c1
--- /dev/null
+++ b/docs/simplefoc_library/practical/library_units.md
@@ -0,0 +1,320 @@
+---
+layout: default
+title: Units in the library
+nav_order: 5
+permalink: /library_units
+parent: Practical guides
+grand_parent: Arduino SimpleFOClibrary
+toc: true
+---
+
+
+# Units in the library
+
+All the motor/driver/sensor parameters and control variables are defined in the following units:
+
+Physical value | Description | Unit | Comment
+--- | --- | --- | ---
+Position/angle | `Radians` | `RAD` | Motor and sensor position in radians
+Velocity | `Radians per second` | `RAD/s` | Motor and sensor velocity in radians per second
+Torque/Current | `Amperes` | `A` | Motor torque or current
+Voltage | `Volts` | `V` | Motor/Driver voltage
+Phase resistance | `Ohms` | `Ω` | Motor phase resistance
+Phase inductance | `Henries` | `H` | Motor phase inductance
+KV rating | `Radians per second per volt` | `RAD/s/V` | Motor velocity constant
+PWM frequency | `Hertz` | `Hz` | Motor/driver PWM frequency
+PMW duty cycle | `No unit` | - | All duty cycles have the range: `0 - 1.0`
+
+
+
+## Position/angle units
+
+The motor and sensor position is defined in radians. One full rotation of the motor is equal to $$2\pi$$ (6.14) radians is equal to 360 degrees.
+
+### Some important variables in radians (`RAD`)
+
+- `motor.shaft_angle` - the current motor position in radians
+- `motor.electrical_angle` - the current motor electrical position in radians
+- `motor.target` - the target motor position in radians ( in closed-loop and open-loop angle control)
+- `sensor.getAngle()` - the current sensor position in radians ( in closed-loop control)
+
+### Converting the angle to degrees
+
+In order to convert the angle from radians to degrees, you can use the following formula:
+
+$$
+a_{deg} = a_{rad} \cdot \frac{360}{2\pi}
+$$
+
+#### Setting the target angle in degrees
+
+For example, if you wish to set the target angle in degrees:
+
+```cpp
+motor.target = my_target_in_degrees * _2PI/360;
+```
+
+Or for example if you're using [commander interface](commander) to set the target angle in degrees:
+
+```cpp
+void onTarget(char* cmd){
+ // get the target angle in degrees
+ float target_angle_deg = atof(cmd);
+ // set the target angle in radians
+ motor.target = target_angle_deg * _2PI/360;
+}
+...
+void setup(){
+ ...
+ // add the command to the commander
+ commander.add('A', onTarget, "angle in degrees");
+ ...
+}
+```
+
+#### Reading the sensor angle in degrees
+
+If you wish to read motor position in degrees, you can easily convert it using
+
+```cpp
+float angle_deg = motor.shaft_angle * 360/_2PI;
+```
+
+The same can be done for the outputs of the `Sensor` class:
+```cpp
+float angle_deg = sensor.getAngle() * 360/_2PI;
+```
+
+### Converting the angle to rotations (turns)
+
+To convert the angle from radians to turns (rotations) you can use the following formula:
+
+$$
+a_{rot} = a_{rad} \cdot \frac{1}{2\pi}
+$$
+
+#### Setting the target angle in turns
+
+For example, if you wish to set the target angle in turns:
+
+```cpp
+motor.target = my_target_in_turns / _2PI;
+```
+
+Or for example if you're using [commander interface](commander) to set the target angle in turns:
+
+```cpp
+void onTarget(char* cmd){
+ // get the target angle in turns
+ float target_angle_turns = atof(cmd);
+ // set the target angle in radians
+ motor.target = target_angle_turns / _2PI;
+}
+...
+void setup(){
+ ...
+ // add the command to the commander
+ commander.add('A', onTarget, "angle in turns");
+ ...
+}
+```
+
+#### Reading the sensor angle in turns
+
+If you wish to read motor position in turns, you can easily convert it using
+
+```cpp
+float angle_turns = motor.shaft_angle / _2PI;
+```
+
+The same can be done for the outputs of the `Sensor` class:
+```cpp
+float angle_turns = sensor.getAngle() / _2PI;
+```
+
+## Velocity units
+
+All the parameters/variables related to the velocity, both for the motor and sensor, are defined in radians per second. One full rotation of the motor is equal to $$2\pi$$ (6.14) radians is equal to 360 degrees.
+Some other standard units for the velocity are RPM (revolutions per minute) and 1/s (turns per second).
+
+
+### Some important variables in radians per second (`RAD/s`)
+
+- `motor.shaft_velocity` - the current motor velocity in radians per second
+- `motor.velocity_limit` - the velocity limit in radians per second
+- `motor.feedback_velocity` - the current motor velocity in radians per second ( in closed-loop control)
+- `motor.target` - the target motor velocity in radians per second ( in closed-loop and open-loop velocity control)
+- `sensor.getVelocity()` - the current sensor velocity in radians per second ( in closed-loop control)
+
+### Converting the velocity to RPM
+
+In order to convert the velocity from radians per second to RPM, you can use the following formula:
+
+$$
+v_{RPM} = v_{RAD/s} \cdot \frac{60}{2\pi}
+$$
+
+
+
RULE OF THUMB
+
+The motor velocity in `RPM` is approximately 10 times the motor velocity in radians per second `RAD/s`, as $$\frac{60}{2\pi}\approx 10$$
+
+So the conversion can be approximated as:
+
+$$v_{RPM} = 10 \cdot v_{RAD/s} $$
+
+
+
+#### Setting the target velocity in RPM
+
+For example, if you wish to set the target velocity in RPM:
+
+```cpp
+motor.target = my_target_in_RPM * _2PI/60;
+```
+
+Or for example if you're using [commander interface](commander) to set the target velocity in RPM:
+
+```cpp
+void onTarget(char* cmd){
+ // get the target velocity in RPM
+ float target_velocity_RPM = atof(cmd);
+ // set the target velocity in radians per second
+ motor.target = target_velocity_RPM * _2PI/60;
+}
+...
+void setup(){
+ ...
+ // add the command to the commander
+ commander.add('V', onTarget, "velocity in RPM");
+ ...
+}
+```
+
+#### Reading the sensor velocity in RPM
+
+If you wish to read motor velocity in RPM, you can easily convert it using
+
+```cpp
+float velocity_RPM = motor.shaft_velocity * 60/_2PI;
+```
+
+The same can be done for the outputs of the `Sensor` class:
+```cpp
+float velocity_RPM = sensor.getVelocity() * 60/_2PI;
+```
+
+### Converting the velocity to turns per second
+
+To convert the velocity from radians per second to turns per second, you can use the following formula:
+
+$$
+v_{tps} = v_{rad/s} \cdot \frac{1}{2\pi}
+$$
+
+#### Setting the target velocity in turns per second
+
+For example, if you wish to set the target velocity in turns per second:
+
+```cpp
+motor.target = my_target_in_tps / _2PI;
+```
+
+Or for example if you're using [commander interface](commander) to set the target velocity in turns per second:
+
+```cpp
+void onTarget(char* cmd){
+ // get the target velocity in turns per second
+ float target_velocity_tps = atof(cmd);
+ // set the target velocity in radians per second
+ motor.target = target_velocity_tps / _2PI;
+}
+...
+void setup(){
+ ...
+ // add the command to the commander
+ commander.add('V', onTarget, "velocity in turns per second");
+ ...
+}
+```
+
+#### Reading the sensor velocity in turns per second
+
+If you wish to read motor velocity in turns per second, you can easily convert it using
+
+```cpp
+float velocity_tps = motor.shaft_velocity / _2PI;
+```
+
+The same can be done for the outputs of the `Sensor` class:
+```cpp
+float velocity_tps = sensor.getVelocity() / _2PI;
+```
+
+## Torque/Current units
+
+The motor torque or current is defined in Amperes. The torque is directly proportional to the current flowing through the motor windings. The torque constant $$K_t$$ is a parameter that describes the relationship between the motor torque and the current.
+
+### Some important variables in Amperes [`A`]
+
+- `motor.current_limit` - the current motor limit in Amperes
+- `motor.target` - the target motor current in Amperes ( in closed-loop torque control or in voltage control with current estimation)
+- `motor.currents.q` - the current motor currents in Amperes
+- `motor.currents.q` - the current motor currents in Amperes
+- `current_sense.getFOCCurrent()` - the current motor currents in Amperes
+- `current_sense.getDCCurrents()` - the current measured current magnitude in Amperes
+- `current_sense.getPhaseCurrents()` - the current motor phase currents in Amperes
+- `PhaseCurrent_s` - the structure that holds the motor phase currents in Amperes
+- `DQCurrent_s` - the structure that holds the D and Q motor currents in Amperes
+- `ABCurrent_s` - the structure that holds the Alpha and Beta motor currents in Amperes
+
+
+### Converting the current to torque
+
+The motor torque is directly proportional to the current through the torque constant $$K_t$$. The torque constant is defined in the motor datasheet and often can be approximated to be the same as the electrical (BEMF) constant $$K_t \approx K_e$$.
+
+$$
+\tau = K_t \cdot I
+$$
+
+#### Setting the target torque in `Nm`
+
+For example, if you wish to set the target torque in Nm:
+
+```cpp
+float Kt = ....; // datasheet value
+motor.target = my_target_in_Nm / Kt; // Nm / (Nm/A) = Amps
+```
+
+Or for example if you're using [commander interface](commander) to set the target torque in Nm:
+
+```cpp
+void onTarget(char* cmd){
+ // get the target torque in Nm
+ float target_torque_Nm = atof(cmd);
+ // set the target current in Amperes
+ motor.target = target_torque_Nm / Kt;
+}
+...
+void setup(){
+ ...
+ // add the command to the commander
+ commander.add('T', onTarget, "torque in Nm");
+ ...
+}
+```
+
+#### Reading the sensor current in Nm
+
+If you wish to read motor current in Nm, you can easily convert it using
+
+```cpp
+float current_Nm = motor.currents.q * Kt;
+```
+
+Or directly from the current sensor:
+
+```cpp
+DQCurrent_s c = current_sense.getFOCCurrent();
+float current_Nm = c.q * Kt; // torque in Nm
+```
diff --git a/docs/simplefoc_library/digging_deeper/practical/phase_resistance.md b/docs/simplefoc_library/practical/phase_resistance.md
similarity index 96%
rename from docs/simplefoc_library/digging_deeper/practical/phase_resistance.md
rename to docs/simplefoc_library/practical/phase_resistance.md
index 4c5d8a5..1813ec4 100644
--- a/docs/simplefoc_library/digging_deeper/practical/phase_resistance.md
+++ b/docs/simplefoc_library/practical/phase_resistance.md
@@ -5,10 +5,11 @@ nav_order: 3
description: "Arduino Simple Field Oriented Control (FOC) library ."
permalink: /phase_resistance
parent: Practical guides
-grand_parent: Digging deeper
-grand_grand_parent: Arduino SimpleFOClibrary
+grand_parent: Arduino SimpleFOClibrary
+toc: true
---
+
# Phase resistance
The term "phase resistance" may lend itself to some ambiguity, in both meaning and method for measurement. This page attempts to explain how to measure its value, which is required by several of the control algorithms in SimpleFOC.
diff --git a/extras/Images/angle_loop_stepper_curr.png b/extras/Images/angle_loop_stepper_curr.png
new file mode 100644
index 0000000..7c2ab2c
Binary files /dev/null and b/extras/Images/angle_loop_stepper_curr.png differ
diff --git a/extras/Images/angle_loop_stepper_volt.png b/extras/Images/angle_loop_stepper_volt.png
new file mode 100644
index 0000000..63a3b4f
Binary files /dev/null and b/extras/Images/angle_loop_stepper_volt.png differ
diff --git a/extras/Images/bldc.png b/extras/Images/bldc.png
new file mode 100644
index 0000000..3292876
Binary files /dev/null and b/extras/Images/bldc.png differ
diff --git a/extras/Images/bldc_align_a.png b/extras/Images/bldc_align_a.png
new file mode 100644
index 0000000..5bfb17f
Binary files /dev/null and b/extras/Images/bldc_align_a.png differ
diff --git a/extras/Images/bldc_align_ab.png b/extras/Images/bldc_align_ab.png
new file mode 100644
index 0000000..20c0cdf
Binary files /dev/null and b/extras/Images/bldc_align_ab.png differ
diff --git a/extras/Images/bldc_align_b.png b/extras/Images/bldc_align_b.png
new file mode 100644
index 0000000..4f59fab
Binary files /dev/null and b/extras/Images/bldc_align_b.png differ
diff --git a/extras/Images/closed_loop_stepper1.jpg b/extras/Images/closed_loop_stepper1.jpg
new file mode 100644
index 0000000..e182765
Binary files /dev/null and b/extras/Images/closed_loop_stepper1.jpg differ
diff --git a/extras/Images/closed_loop_stepper2.jpg b/extras/Images/closed_loop_stepper2.jpg
new file mode 100644
index 0000000..3f1cbbf
Binary files /dev/null and b/extras/Images/closed_loop_stepper2.jpg differ
diff --git a/extras/Images/closed_loop_stepper3.jpg b/extras/Images/closed_loop_stepper3.jpg
new file mode 100644
index 0000000..795cbe3
Binary files /dev/null and b/extras/Images/closed_loop_stepper3.jpg differ
diff --git a/extras/Images/current_sense_align.png b/extras/Images/current_sense_align.png
new file mode 100644
index 0000000..549c3e2
Binary files /dev/null and b/extras/Images/current_sense_align.png differ
diff --git a/extras/Images/current_sense_align_stepper.png b/extras/Images/current_sense_align_stepper.png
new file mode 100644
index 0000000..b3b2833
Binary files /dev/null and b/extras/Images/current_sense_align_stepper.png differ
diff --git a/extras/Images/dc_current_stepper.png b/extras/Images/dc_current_stepper.png
new file mode 100644
index 0000000..c74f792
Binary files /dev/null and b/extras/Images/dc_current_stepper.png differ
diff --git a/extras/Images/foc_current_stepper.png b/extras/Images/foc_current_stepper.png
new file mode 100644
index 0000000..113d7cb
Binary files /dev/null and b/extras/Images/foc_current_stepper.png differ
diff --git a/extras/Images/inline_stepper.png b/extras/Images/inline_stepper.png
new file mode 100644
index 0000000..d535ffd
Binary files /dev/null and b/extras/Images/inline_stepper.png differ
diff --git a/extras/Images/lowside_stepper.png b/extras/Images/lowside_stepper.png
new file mode 100644
index 0000000..708e13a
Binary files /dev/null and b/extras/Images/lowside_stepper.png differ
diff --git a/extras/Images/open_loop_control (1).jpg b/extras/Images/open_loop_control (1).jpg
new file mode 100644
index 0000000..ddf00ab
Binary files /dev/null and b/extras/Images/open_loop_control (1).jpg differ
diff --git a/extras/Images/open_loop_control (2).jpg b/extras/Images/open_loop_control (2).jpg
new file mode 100644
index 0000000..e12f14e
Binary files /dev/null and b/extras/Images/open_loop_control (2).jpg differ
diff --git a/extras/Images/open_loop_control.jpg b/extras/Images/open_loop_control.jpg
new file mode 100644
index 0000000..c3b6c5e
Binary files /dev/null and b/extras/Images/open_loop_control.jpg differ
diff --git a/extras/Images/open_loop_stepper_angle.jpg b/extras/Images/open_loop_stepper_angle.jpg
new file mode 100644
index 0000000..728eb86
Binary files /dev/null and b/extras/Images/open_loop_stepper_angle.jpg differ
diff --git a/extras/Images/open_loop_stepper_vel.jpg b/extras/Images/open_loop_stepper_vel.jpg
new file mode 100644
index 0000000..f246a6b
Binary files /dev/null and b/extras/Images/open_loop_stepper_vel.jpg differ
diff --git a/extras/Images/open_loop_vel_steppe1.jpg b/extras/Images/open_loop_vel_steppe1.jpg
new file mode 100644
index 0000000..a0fb07a
Binary files /dev/null and b/extras/Images/open_loop_vel_steppe1.jpg differ
diff --git a/extras/Images/open_loop_vel_steppe2.jpg b/extras/Images/open_loop_vel_steppe2.jpg
new file mode 100644
index 0000000..c21bbb3
Binary files /dev/null and b/extras/Images/open_loop_vel_steppe2.jpg differ
diff --git a/extras/Images/open_loop_vel_steppe3.jpg b/extras/Images/open_loop_vel_steppe3.jpg
new file mode 100644
index 0000000..b5826d4
Binary files /dev/null and b/extras/Images/open_loop_vel_steppe3.jpg differ
diff --git a/extras/Images/stepper_align.png b/extras/Images/stepper_align.png
new file mode 100644
index 0000000..6a24b5b
Binary files /dev/null and b/extras/Images/stepper_align.png differ
diff --git a/extras/Images/stepper_align_a.png b/extras/Images/stepper_align_a.png
new file mode 100644
index 0000000..8d65eca
Binary files /dev/null and b/extras/Images/stepper_align_a.png differ
diff --git a/extras/Images/stepper_align_b.png b/extras/Images/stepper_align_b.png
new file mode 100644
index 0000000..637bf36
Binary files /dev/null and b/extras/Images/stepper_align_b.png differ
diff --git a/extras/Images/torque_curr_stepper.png b/extras/Images/torque_curr_stepper.png
new file mode 100644
index 0000000..5a1a271
Binary files /dev/null and b/extras/Images/torque_curr_stepper.png differ
diff --git a/extras/Images/torque_stepper1.jpg b/extras/Images/torque_stepper1.jpg
new file mode 100644
index 0000000..420fcad
Binary files /dev/null and b/extras/Images/torque_stepper1.jpg differ
diff --git a/extras/Images/torque_stepper2.jpg b/extras/Images/torque_stepper2.jpg
new file mode 100644
index 0000000..98379d6
Binary files /dev/null and b/extras/Images/torque_stepper2.jpg differ
diff --git a/extras/Images/torque_stepper3.jpg b/extras/Images/torque_stepper3.jpg
new file mode 100644
index 0000000..6eebd08
Binary files /dev/null and b/extras/Images/torque_stepper3.jpg differ
diff --git a/extras/Images/torque_stepper4.jpg b/extras/Images/torque_stepper4.jpg
new file mode 100644
index 0000000..b372825
Binary files /dev/null and b/extras/Images/torque_stepper4.jpg differ
diff --git a/extras/Images/torque_volt_stepper.png b/extras/Images/torque_volt_stepper.png
new file mode 100644
index 0000000..896971c
Binary files /dev/null and b/extras/Images/torque_volt_stepper.png differ
diff --git a/extras/Images/v3_pads_encoder_pul.psd b/extras/Images/v3_pads_encoder_pul.psd
new file mode 100644
index 0000000..e4546ec
Binary files /dev/null and b/extras/Images/v3_pads_encoder_pul.psd differ
diff --git a/extras/Images/velocity_loop_stepper_curr.png b/extras/Images/velocity_loop_stepper_curr.png
new file mode 100644
index 0000000..2136a0e
Binary files /dev/null and b/extras/Images/velocity_loop_stepper_curr.png differ
diff --git a/extras/Images/velocity_loop_stepper_volt.png b/extras/Images/velocity_loop_stepper_volt.png
new file mode 100644
index 0000000..42b105e
Binary files /dev/null and b/extras/Images/velocity_loop_stepper_volt.png differ
diff --git a/extras/Images/voltage_loop_stepper1.jpg b/extras/Images/voltage_loop_stepper1.jpg
new file mode 100644
index 0000000..985bf5a
Binary files /dev/null and b/extras/Images/voltage_loop_stepper1.jpg differ
diff --git a/extras/Images/voltage_loop_stepper2.jpg b/extras/Images/voltage_loop_stepper2.jpg
new file mode 100644
index 0000000..e77671f
Binary files /dev/null and b/extras/Images/voltage_loop_stepper2.jpg differ
diff --git a/extras/Images/voltage_loop_stepper3.jpg b/extras/Images/voltage_loop_stepper3.jpg
new file mode 100644
index 0000000..097a784
Binary files /dev/null and b/extras/Images/voltage_loop_stepper3.jpg differ
diff --git a/extras/Images/voltage_loop_stepper4.jpg b/extras/Images/voltage_loop_stepper4.jpg
new file mode 100644
index 0000000..cdf1097
Binary files /dev/null and b/extras/Images/voltage_loop_stepper4.jpg differ
diff --git a/index.md b/index.md
index 5f6fcb0..bd0c2c3 100644
--- a/index.md
+++ b/index.md
@@ -9,6 +9,7 @@ permalink: /


+
[](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d)

@@ -27,21 +28,24 @@ Therefore this is an attempt to:
- Many many more boards developed by the community members, see [SimpleFOC Community](https://community.simplefoc.com/)
-
NEW RELEASE 📢: SimpleFOClibrary v2.3.3 see release
- - STM32 MCUs
- - support for center aligned pwm (even across multiple timers and motors/drivers) [#374](https://github.com/simplefoc/Arduino-FOC/pull/374), [#388](https://github.com/simplefoc/Arduino-FOC/pull/388)
- - support for DMA based low-side current sensing: [#383](https://github.com/simplefoc/Arduino-FOC/pull/383),[#378](https://github.com/simplefoc/Arduino-FOC/pull/378)
- - support for F7 architecture [#388](https://github.com/simplefoc/Arduino-FOC/pull/388),[#394](https://github.com/simplefoc/Arduino-FOC/pull/394)
-- Teensy4 MCUs
- - support for low-side current sensing [#392](https://github.com/simplefoc/Arduino-FOC/pull/392)
- - support for center aligned 6pwm and 3pwm (optional) [#392](https://github.com/simplefoc/Arduino-FOC/pull/392)
- - KV rating calculation fix [#347](https://github.com/simplefoc/Arduino-FOC/pull/347)
- - Much more performant Park/Clarke calculation [#340](https://github.com/simplefoc/Arduino-FOC/pull/340)
- - And much more - see the complete list of bugfixes and new features of v2.3.3 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/10?closed=1)
+
NEW RELEASE 📢: SimpleFOClibrary v2.3.4 see release
+ - ESP32 MCUs extended support [#414](https://github.com/simplefoc/Arduino-FOC/pull/414)
+ - Transition to the arduino-esp32 version v3.x (ESP-IDF v5.x) [#387](https://github.com/espressif/arduino-esp32/releases)
+ - New support for MCPWM driver
+ - New support for LEDC drivers - center-aligned PWM and 6PWM available
+ - Rewritten and simplified the fast ADC driver code (`adcRead`) - for low-side and inline current sensing.
+ - Stepper motors current sensing support [#421](https://github.com/simplefoc/Arduino-FOC/pull/421)
+ - Support for current sensing (low-side and inline) - [see in docs](current_sense)
+ - Support for true FOC control - `foc_current` torque control - [see in docs](motion_control)
+ - New current sense alignment procedure [#422](https://github.com/simplefoc/Arduino-FOC/pull/422) - [see in docs](current_sense_align)
+ - Support for steppers
+ - Much more robust and reliable
+ - More verbose and informative
+ - Support for HallSensors without interrupts [#4224](https://github.com/simplefoc/Arduino-FOC/pull/424) - [see in docs](hall_sensors)
- Docs
- - Added a practical guides section - [see the docs](digging_deeper)
- - Added a guide to choosing PWM pins for your application - [see the docs](choosing_pwm_pins)
- - Added docs on stm32 PWM and ADC pinouts - [ stm32 pinouts](https://docs.simplefoc.com/stm32pinouts/)
+ - A short guide to debugging of common issues - [see in docs](example_from_scratch)
+ - A short guide to the units in the library - [see in docs](library_units)
+ - See the complete list of bugfixes and new features of v2.3.4 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/11)