diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b6c3f24 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "cSpell.words": [ + "Adafruit", + "Aideepen", + "Aliexpress", + "Atmega", + "autoplay" + ] +} \ No newline at end of file diff --git a/docs/boards/index.md b/docs/boards/index.md index 7aafcd1..f304ce6 100644 --- a/docs/boards/index.md +++ b/docs/boards/index.md @@ -32,7 +32,7 @@ In addition to the official boards, there are many other boards compatible with ## Boards in the Shield form factor -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). +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, Arduino UNO R4 and many others. This format enables users 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) @@ -86,26 +86,26 @@ A powerful arduino shield for running BLDC motors using the FOC algorithm. This
### Features {: .no_toc } - **Plug & play**: In combination with Arduino SimpleFOClibrary -- **Low-cost**: Fabrication price under €25/pcs - **⚠️ will not be sold by silplefoc.com** +- **Low-cost**: Fabrication price under €25/pcs - **⚠️ will not be sold by simplefoc.com** - **High-side current sensing**: - not yet supported by *Simple**FOC**library* - **In-line current sensing**: - supported by *Simple**FOC**library* - **Max power <500W**: max current 30A, power-supply 24V -- **Arduino headers**: Arduino UNO, Arduino MEGA, STM32 Nucleo boards, Aruidno DUE... +- **Arduino headers**: Arduino UNO, Arduino MEGA, STM32 Nucleo boards, Arduino DUE... - **Small size**: 53mm x 60mm - **Encoder/Hall sensors interface**: Integrated 3.3kΩ pullups (configurable) - **Open Source**: - Fully available fabrication files - - If never done it before, see a similar guide for *Simple**FOC**Shueld*: [how to make it yourself](https://docs.simplefoc.com/arduino_simplefoc_shield_fabrication) + - If never done it before, see a similar guide for *Simple**FOC**shield*: [how to make it yourself](https://docs.simplefoc.com/arduino_simplefoc_shield_fabrication) - Altium project - 3d model - schematics 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 68c33f2..3d2fc3f 100644 --- a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md +++ b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v1.md @@ -43,7 +43,7 @@ EN | Driver Enable Version v1.1 of the SimpleFOCMini has the order of the IN1,IN2,IN3 and EN changed with respect to the v1.0. -These pins need to ba connected whenever using the SimpleFOCMini. The 3 pwm pins and the enable pin are used to control the DRV8313 driver and in terms of the SimpleFOClibrary they correspond to the entries of the `BLDCDriver3PWM` class. The common ground pin is very important as well in order to make sure that all the PWM and Enable pins are read properly by the driver chip. Once you decide which pins you will be using for `INx` and `EN` pins you will be able to porvide them to the `BLDCDriver3PWM` class in your Arduino sketch. +These pins need to ba connected whenever using the SimpleFOCMini. The 3 pwm pins and the enable pin are used to control the DRV8313 driver and in terms of the SimpleFOClibrary they correspond to the entries of the `BLDCDriver3PWM` class. The common ground pin is very important as well in order to make sure that all the PWM and Enable pins are read properly by the driver chip. Once you decide which pins you will be using for `INx` and `EN` pins you will be able to provide them to the `BLDCDriver3PWM` class in your Arduino sketch. ```cpp BLDCDriver3PWM driver = BLDCDriver3PWM(IN1, IN2, IN3, EN); @@ -64,7 +64,7 @@ nFT | Fault output (active LOW) DRV8313 comes with the 3.3V voltage regulator and it is connected to the SimpleFOCMini's 3.3V pin. However it has a limitation of 10mA, which is in general not enough to power a microcontroller. But it might be enough to power a LED light or some position sensors. -Pin `nFT` (fault) is an active LOW output of the SimpleFOCMini which can be read to verify if the DRV8313 driver is working properly. If this pin is in LOW it means the DRV8313 is its fault state and it cannot drive the motor. Then the pin `nRT` (reset), which is also active LOW, can be used to reset the DRV8313 driver to reinitialise its internal state and exit the fault state, this cannot be done by simply toggling the enable pin. Finally the pin `nSP` (sleep) is an active LOW pin that puts the DRV8313 in the low-power sleep mode, consuming the current of under 1uA. +Pin `nFT` (fault) is an active LOW output of the SimpleFOCMini which can be read to verify if the DRV8313 driver is working properly. If this pin is in LOW it means the DRV8313 is its fault state and it cannot drive the motor. Then the pin `nRT` (reset), which is also active LOW, can be used to reset the DRV8313 driver to reinitialize its internal state and exit the fault state, this cannot be done by simply toggling the enable pin. Finally the pin `nSP` (sleep) is an active LOW pin that puts the DRV8313 in the low-power sleep mode, consuming the current of under 1uA. 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 9596b5d..3836400 100644 --- a/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md +++ b/docs/boards/simplefoc_mini/getting_started/connecting/mini_v11.md @@ -63,7 +63,7 @@ nFT | Fault output (active LOW) DRV8313 comes with the 3.3V voltage regulator and it is connected to the SimpleFOCMini's 3.3V pin. However it has a limitation of 10mA, which is in general not enough to power a microcontroller. But it might be enough to power a LED light or some position sensors. -Pin `nFT` (fault) is an active LOW output of the SimpleFOCMini which can be read to verify if the DRV8313 driver is working properly. If this pin is in LOW it means the DRV8313 is its fault state and it cannot drive the motor. Then the pin `nRT` (reset), which is also active LOW, can be used to reset the DRV8313 driver to reinitialise its internal state and exit the fault state, this cannot be done by simply toggling the enable pin. Finally the pin `nSP` (sleep) is an active LOW pin that puts the DRV8313 in the low-power sleep mode, consuming the current of under 1uA. +Pin `nFT` (fault) is an active LOW output of the SimpleFOCMini which can be read to verify if the DRV8313 driver is working properly. If this pin is in LOW it means the DRV8313 is its fault state and it cannot drive the motor. Then the pin `nRT` (reset), which is also active LOW, can be used to reset the DRV8313 driver to reinitialize its internal state and exit the fault state, this cannot be done by simply toggling the enable pin. Finally the pin `nSP` (sleep) is an active LOW pin that puts the DRV8313 in the low-power sleep mode, consuming the current of under 1uA. diff --git a/docs/boards/simplefoc_mini/index.md b/docs/boards/simplefoc_mini/index.md index ede9955..d3efbea 100644 --- a/docs/boards/simplefoc_mini/index.md +++ b/docs/boards/simplefoc_mini/index.md @@ -88,7 +88,7 @@ This project can be entirely done by using the Simple -This video demonstrates SimpleFOCShield support for stacking with Arudino UNO and STM32 Nucleo-64 board. As well as support for different sensors magnetic and encoders with relatively large precision span. +This video demonstrates SimpleFOCShield support for stacking with Arduino UNO and STM32 Nucleo-64 board. As well as support for different sensors magnetic and encoders with relatively large precision span. The control algorithms implemented in this project are : - **Steer by wire** (force feedback): two motors with virtually coupled positions diff --git a/docs/boards/simplefoc_mini/mini_fabrication.md b/docs/boards/simplefoc_mini/mini_fabrication.md index c34cf82..aaeb37d 100644 --- a/docs/boards/simplefoc_mini/mini_fabrication.md +++ b/docs/boards/simplefoc_mini/mini_fabrication.md @@ -33,7 +33,7 @@ The BOM and CPL files should be loaded automatically so then you should be able⚠️ BEWARE: BTN8982/IFX007T performance issues
-BTN8982 and IFX007T drivers have been designed for DC motors and are based on old H-bridge technology. They have very long mosfet rise time (multiple microseconds) which in many cases presents a considerable part of the PWM duty cycle. When runnig the BLDC motors, precise PWM duty cycle setting is crutial for smooth and efficient operation. Therefore these drivers will not be able to provide very smooth operation on high frequency PWM (above 15kHz). Read more about it in the community thread: [link](https://community.simplefoc.com/t/simplefoc-powershield/582).
+BTN8982 and IFX007T drivers have been designed for DC motors and are based on old H-bridge technology. They have very long mosfet rise time (multiple microseconds) which in many cases presents a considerable part of the PWM duty cycle. When running the BLDC motors, precise PWM duty cycle setting is crucial for smooth and efficient operation. Therefore these drivers will not be able to provide very smooth operation on high frequency PWM (above 15kHz). Read more about it in the community thread: [link](https://community.simplefoc.com/t/simplefoc-powershield/582).
This performance constraint is the main reason why the SimpleFOC PowerShield project has for now been put on hold, and although these boards are available through Aliexpress and some other platforms, they will not be available through simplefoc.com.
-This does not mean that the board itself is not functional or that it will not work in your project though. It is still one of the cheepest (simplest) solutions out there for mid to high power BLDC control and with proper tuning of control loops you will still be able to get some good results with it. +This does not mean that the board itself is not functional or that it will not work in your project though. It is still one of the cheapest (simplest) solutions out there for mid to high power BLDC control and with proper tuning of control loops you will still be able to get some good results with it.
.png)
.png)
.png)
\ No newline at end of file +Pin 13 or pin 11
We advise you to try first with the pin 13 configured and then with pin 11 if this does not work. Tested boards are Nucleo-F401RE - pin 13 works / pin 11 doesn't and Nucleo-F466RE pin 11 works/ pin 13 doesnt.
\ No newline at end of file diff --git a/docs/boards/simplefoc_shield/index.md b/docs/boards/simplefoc_shield/index.md index 93ecfa3..146eabe 100644 --- a/docs/boards/simplefoc_shield/index.md +++ b/docs/boards/simplefoc_shield/index.md @@ -97,7 +97,7 @@ For full documentation of necessary components, design choices and the code plea ## Project example : Steer by wire - bidirectional haptic control examples -This video demonstrates SimpleFOCShield support for stacking with Arudino UNO and STM32 Nucleo-64 board. As well as support for different sensors magnetic and encoders with relatively large precision span. +This video demonstrates SimpleFOCShield support for stacking with Arduino UNO and STM32 Nucleo-64 board. As well as support for different sensors magnetic and encoders with relatively large precision span. The control algorithms implemented in this project are : - **Steer by wire** (force feedback): two motors with virtually coupled positions diff --git a/docs/simplefoc_libraries/libraries/drivers_library.md b/docs/simplefoc_libraries/libraries/drivers_library.md index 5f31097..75a00ee 100644 --- a/docs/simplefoc_libraries/libraries/drivers_library.md +++ b/docs/simplefoc_libraries/libraries/drivers_library.md @@ -44,7 +44,7 @@ It is steadily growing, but at the moment we have: - The drivers in the drivers repo enable functionality for components that don't work with the standard core library. For example, the TLE5012B sensor is not supported by the generic MagneticSensorSPI class, but there is a specific driver for it in the drivers repository. -- The drivers in the drivers repo may have extended functionality. So for example while the AS5048A sensor is supported by the generic MagneticSensorSPI class, the specific driver for it allows querying its other registers, allows detecting sensor erros, and is easier to use because it has the correct settings "embedded". +- The drivers in the drivers repo may have extended functionality. So for example while the AS5048A sensor is supported by the generic MagneticSensorSPI class, the specific driver for it allows querying its other registers, allows detecting sensor errors, and is easier to use because it has the correct settings "embedded". - Using the comms drivers provided as a starting point not only gets you off to a quick start, but also makes it more likely your solutions will be interoperable with those of others (or at least easy to adapt). diff --git a/docs/simplefoc_libraries/tools/simplefocstudio.md b/docs/simplefoc_libraries/tools/simplefocstudio.md index 08a27a2..91081d7 100644 --- a/docs/simplefoc_libraries/tools/simplefocstudio.md +++ b/docs/simplefoc_libraries/tools/simplefocstudio.md @@ -81,7 +81,7 @@ Once you have your application running add a device by clicking thePin 13 or pin 11
We advise you to try first with the pin 13 configured and then with pin 11 if this does not work. Tested boards are Nucleo-F401RE - pin 13 works / pin 11 doesn't and Nucleo-F466RE pin 11 works/ pin 13 doesn't.
Arduino button in the toolbar.
- Choose which sets of parameters you wish to generate the code for and click OK
- In the new tab you will have a code of your tuned parameters.
diff --git a/docs/simplefoc_libraries/tools/webcontroller.md b/docs/simplefoc_libraries/tools/webcontroller.md
index 5769488..d41ae52 100644
--- a/docs/simplefoc_libraries/tools/webcontroller.md
+++ b/docs/simplefoc_libraries/tools/webcontroller.md
@@ -14,7 +14,7 @@ toc: true
This is a controller interface for the SimpleFOClibrary. It uses WebSerial to communicate with a suitable micro-controller using serial port communications and the [Commander](commander_interface) interface.
Most of the code for this application was provided by [@geekuillaume](https://github.com/geekuillaume), his github repository can be found [here](https://github.com/geekuillaume/simplefoc-webcontroller) and his application can be found [here](https://simplefoc.besson.co/).
-Our app is a fork of his code, that has been further extended to support more devices and configuration parameters, as well as to ease the monitoring visualisation.
+Our app is a fork of his code, that has been further extended to support more devices and configuration parameters, as well as to ease the monitoring visualization.
Github repo Open SimpleFOCwebcontroller
@@ -41,7 +41,7 @@ This project is still in its early stage, we are counting on your patience and l
*Simple**FOC**WebController* does not require any installation, its only requirement is that your browser has `WebSerial` support. Check the supportedd browsers [here](https://caniuse.com/web-serial).
### Motion control tunning blocks
-Once you have your application running in your browser, connected to your microcontroller running the SimpleFOClibrary. You can easily change most of the control parameters of different motion control loops and visualise different monitored variables.
+Once you have your application running in your browser, connected to your microcontroller running the SimpleFOClibrary. You can easily change most of the control parameters of different motion control loops and visualize different monitored variables.
diff --git a/docs/simplefoc_library/code/communication/commander/index.md b/docs/simplefoc_library/code/communication/commander/index.md
index b1e8f20..127f6bc 100644
--- a/docs/simplefoc_library/code/communication/commander/index.md
+++ b/docs/simplefoc_library/code/communication/commander/index.md
@@ -46,7 +46,7 @@ When the commander received the string:
-It first checks the command id, identifies its `M` and sends the remaining string to the motor handling callback. Then the motor callback checks what is the coommand id, finds `V` and sends the remaining string to the PID velocity callbacK. Then the PID velocity callback scans the command id and finds it is the `D`, so derivative gain and sets the value.
+It first checks the command id, identifies its `M` and sends the remaining string to the motor handling callback. Then the motor callback checks what is the command id, finds `V` and sends the remaining string to the PID velocity callbacK. Then the PID velocity callback scans the command id and finds it is the `D`, so derivative gain and sets the value.
Commander | Motor callback (cmd id `M` ) | PID callback (cmd id `V` )
--- | ---| ---
@@ -69,7 +69,7 @@ Command interface is implemented in the `Commander` class.
// Commander interface constructor
// - serial - optionally receives HardwareSerial/Stream instance
// - eol - optionally receives eol character - by default it is the newline: "\n"
-// - echo - option echo last typed character (for command line feedback) - defualt false
+// - echo - option echo last typed character (for command line feedback) - default false
Commander commander = Commander(Serial, "\n", false);
```
The end of line (eol) character is an optional input of the `Commander` class which represents end of command character. User can define its own end of command characters here, but by default the character used is newline character `\n`. For example i
@@ -264,16 +264,16 @@ Commander provides a very simple way to extend the command list and implement ne
- [Custom commands](commander_custom) - create your own callbacks
-## Commander with Serial Monitor in Arudino IDE
+## Commander with Serial Monitor in Arduino IDE
Once the commander interface is added to the code you will be able to communicate to it using the Serial Monitor of the Arduino IDE
-Commander paramters in the serial monitor are the same as for every other Arduino code working with the `Serial`.
+Commander parameters in the serial monitor are the same as for every other Arduino code working with the `Serial`.
Make sure to:
-- Set the baudrate number the same as in the `ino` file : for examle if in the `ino` file you have `Serial.begin(115200)`, the baud rate should be `115200`
+- Set the baudrate number the same as in the `ino` file : for example if in the `ino` file you have `Serial.begin(115200)`, the baud rate should be `115200`
- Make sure to set the termination character to `newline`
## *Simple**FOC**Studio* by [@JorgeMaker](https://github.com/JorgeMaker)
diff --git a/docs/simplefoc_library/code/communication/commander/motor.md b/docs/simplefoc_library/code/communication/commander/motor.md
index 05d75a0..35b1cf2 100644
--- a/docs/simplefoc_library/code/communication/commander/motor.md
+++ b/docs/simplefoc_library/code/communication/commander/motor.md
@@ -178,7 +178,7 @@ Finally once the motor is added to the commander interface the use will be able
- **S** - set monitoring variables
Using these commands you can change the downsampling rate (`motor.monitor_downsampling`) of the `monitor()` function that will determine your output sampling frequency. For example if your `loop` time is around 1ms, then with downsampling of monitor function with the rate of 100, it will output the motor variables each 100ms.
-If monitor dowsampling is set to 0 the `monitor()` function is disabled. The same is true if the `motor.monitor_variables` bitmap is empty (equal to `0`). Therefore the command **C** effectively does:
+If monitor downsampling is set to 0 the `monitor()` function is disabled. The same is true if the `motor.monitor_variables` bitmap is empty (equal to `0`). Therefore the command **C** effectively does:
```cpp
// when command MC is called
motor.monitor_variables = 0;
@@ -262,12 +262,12 @@ void setup() {
motor.useMonitoring(Serial);
motor.monitor_downsample = 0; // initially disable real-time monitoring
- // initialise motor
+ // initialize motor
motor.init();
// align encoder and start FOC
motor.initFOC();
- // set the inital target value
+ // set the initial target value
motor.target = 2;
// define the motor id
@@ -284,7 +284,7 @@ void loop() {
// iterative setting FOC phase voltage
motor.loopFOC();
- // iterative function setting the outter loop target
+ // iterative function setting the outer loop target
motor.move();
// monitoring
diff --git a/docs/simplefoc_library/code/communication/step_dir.md b/docs/simplefoc_library/code/communication/step_dir.md
index 36a6f22..a50e019 100644
--- a/docs/simplefoc_library/code/communication/step_dir.md
+++ b/docs/simplefoc_library/code/communication/step_dir.md
@@ -14,7 +14,7 @@ toc: true
Step/direction communication is one of the most common communication interface for running stepper motors. It is very basic, it uses two digital signals, `step` and `direction`. `step` signal produces and short impulse which signals that the motor should do a step with predefined length and `direction` signal determines the direction of the movement (ex. `HIGH` forward, `LOW` backward).
-As stated before this interface is particularly well suited for stepper motors because their motion is designed to be characterised by steps. But this interface can be used in many different ways that have nothing to do with stepper motors. In general step/dir interface can be described as a counter where `direction` signal determines the counting direction and `step` provides the impulses to be counted:
+As stated before this interface is particularly well suited for stepper motors because their motion is designed to be characterized by steps. But this interface can be used in many different ways that have nothing to do with stepper motors. In general step/dir interface can be described as a counter where `direction` signal determines the counting direction and `step` provides the impulses to be counted:
```cpp
// on rising edge of step signal
if(direction == HIGH) counter++;
@@ -34,7 +34,7 @@ In order to do this in a more concise manner SimpleSimpleFOC
diff --git a/docs/simplefoc_library/code/current_sense/index.md b/docs/simplefoc_library/code/current_sense/index.md
index 753e7da..b3c767f 100644
--- a/docs/simplefoc_library/code/current_sense/index.md
+++ b/docs/simplefoc_library/code/current_sense/index.md
@@ -24,9 +24,9 @@ up to this moment ( [check the releases ](https://githu
Each one of the current sensing classes will implement all the necessary functionalities for simple and robust implementation of FOC algorithm:
- Hardware config
- - ADC resoluton and frequency
+ - ADC resolution and frequency
- Automatic zero offset finding
-- Driver synchronisation
+- Driver synchronization
- ADC acquisition events triggering
- Adaptive alignment with driver phases
- Reading the phase currents
@@ -37,7 +37,7 @@ Each of the implemented classes can be used as stand-alone classes and they can
In order for FOC algorithm to work the current sense classes are linked to a `BLDCMotor` class which uses the driver to read the FOC currents.
## 🎯 Our implementation goals
-The current sense code will be written in a way to support as many different drivers out there as possible and in a way to be fully interchangeable. Due to the very hardware specific implementations of the ADC acquisition for different MCU architectures and due to very different driver/adc synchronisation requirements for different current sensing approaches this task is probably one of the most complex challenges for the SimpleFOClibrary so far. Therefore the work will be done in iterations and each release will better and better support. Please make sure to follow out github and [check the releases ](https://github.com/simplefoc/Arduino-FOC/releases).
+The current sense code will be written in a way to support as many different drivers out there as possible and in a way to be fully interchangeable. Due to the very hardware specific implementations of the ADC acquisition for different MCU architectures and due to very different driver/adc synchronization requirements for different current sensing approaches this task is probably one of the most complex challenges for the SimpleFOClibrary so far. Therefore the work will be done in iterations and each release will better and better support. Please make sure to follow out github and [check the releases ](https://github.com/simplefoc/Arduino-FOC/releases).
Also make sure to follow our [community forum](https://community.simplefoc.com), a lot of discussions is being held about current sensing and its applications!
diff --git a/docs/simplefoc_library/code/current_sense/inline.md b/docs/simplefoc_library/code/current_sense/inline.md
index 3d46754..a3b591f 100644
--- a/docs/simplefoc_library/code/current_sense/inline.md
+++ b/docs/simplefoc_library/code/current_sense/inline.md
@@ -170,9 +170,9 @@ current_sense.gain_b *= -1;
-## Initialising the current sense
+## initializing the current sense
-Once the current sense has been created it can be initialised. This `init()` function configures the ADC hardware for reading and finds the zero offsets of the ADC for each channel.
+Once the current sense has been created it can be initialized. This `init()` function configures the ADC hardware for reading and finds the zero offsets of the ADC for each channel.
```cpp
// init current sense
current_sense.init();
@@ -193,7 +193,7 @@ else{
return;
}
```
-Once when your current sense has been intialised and calibrated you can start measuring the currents!
+Once when your current sense has been initialized and calibrated you can start measuring the currents!
### Enable debugging output
If you wish to see a more verbose debugging output of the current sense configuration during the `current_sense.init()` and see more details about the configuration and possible errors, you can use the `SimpleFOCDebug` class.
@@ -257,12 +257,12 @@ void setup(){
```
-Current sense will be using driver parameters for different synchronisation and calibration procedures.
+Current sense will be using driver parameters for different synchronization and calibration procedures.
Once the driver is linked to the current sense, last step is to link the current sense with the `motor` you wish to use it with: @@ -294,7 +294,7 @@ void loop(){ motor.initFOC(); } ``` -Function `initFOC()` will make sure that the `driver` and `current_sense` classes are both aligned, it is very important that the phase `A` of the current sense is exactly the phase `A` of the driver etc. To verify this, the `initFOC` will be calling the current sense's funciton `current_sense.driverAlign(...)`. +Function `initFOC()` will make sure that the `driver` and `current_sense` classes are both aligned, it is very important that the phase `A` of the current sense is exactly the phase `A` of the driver etc. To verify this, the `initFOC` will be calling the current sense's function `current_sense.driverAlign(...)`. ### Alignment with the driver phases `driverAlign(...)` @@ -431,7 +431,7 @@ Sometimes the phase currents are hard to interpret, therefore this current sense float current_mag = current_sense.getDCCurrent(); ``` -Futhermore if you have an access to the position sensor of the motor connected to the driver you can get signed value of the DC current the motor is drawing by providing it to the `getDCCurrent` method. +Furthermore if you have an access to the position sensor of the motor connected to the driver you can get signed value of the DC current the motor is drawing by providing it to the `getDCCurrent` method. ```cpp float current = current_sense.getDCCurrent(motor_electrical_angle); ``` @@ -463,7 +463,7 @@ Here is a simple example of a inline current sense as a stand-alone sensor using InlineCurrentSense current_sense = InlineCurrentSense(0.01f, 50.0f, A0, A2); void setup() { - // initialise the current sensing + // initialize the current sensing current_sense.init(); // for SimpleFOCShield v2.01/v2.0.2 @@ -502,7 +502,7 @@ Here is a simple example of a inline current sense as a stand-alone sensor using InlineCurrentSense current_sense = InlineCurrentSense(185.0f, A0, A2); void setup() { - // initialise the current sensing + // initialize the current sensing current_sense.init(); Serial.begin(115200); diff --git a/docs/simplefoc_library/code/current_sense/low_side.md b/docs/simplefoc_library/code/current_sense/low_side.md index b35f327..ebd5c32 100644 --- a/docs/simplefoc_library/code/current_sense/low_side.md +++ b/docs/simplefoc_library/code/current_sense/low_side.md @@ -15,7 +15,7 @@ toc: true Low-side current sensing is probably the most common current sensing technique. The main reason why is because it does not require neither high-performance PWM rejection current sense amplifiers (as inline does) neither high-voltage supporting amplifiers (as high-side does). The shunt resistors are always placed in between low side mosfets and the ground making sure that the amplifiers always have very low voltages on their terminals. The main drawback of this approach is that, since the current passing through the shunt resistors is phase current only if the corresponding low side mosfet is ON, we can only measure it in those moments. The PWM frequency is usually 20 to 50 kHz, which means that the low-side mosfets turn on and off 20,000 to 50,000 times per second, therefore the synchronization in between PWM setting and ADC acquisition is very very important. -Low side current sensing for all the architectures is on our road-map and we are actively working on it. The main issue at the moment is very hardware specific synchronisation procedure of the PWM generation and ADC triggering. Therefore we are attacking one MCU architecture at the time. 😃 +Low side current sensing for all the architectures is on our road-map and we are actively working on it. The main issue at the moment is very hardware specific synchronization procedure of the PWM generation and ADC triggering. Therefore we are attacking one MCU architecture at the time. 😃 BLDC motors Stepper motors @@ -34,7 +34,7 @@ See the linkAPI change - SimpleFOClibrary v2.2.2
-Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronisation for current sensing. +Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronization for current sensing.
Using `LowsideCurrentSense` class with inline current sensing hardware
-In the SimpleFOClibrary the low-side current sensing is implemented in the `LowsideCurrentSense` class. This class is designed to work with the `BLDCDriver` and `StepperDriver` classes and it is used to measure the phase currents of the motor where the ADC conversions are synchoronised with the PWM generation of the driver. The `LowsideCurrentSense` class is impletmets this synchonisation, and even though it is primarily designed to be used with the low-side current sensing hardware, it can also be used with the inline current sensing hardware. And in some cases it is even suggested to use it with the inline current sensing hardware such as for stm32 architecture, as it has much better performance since it is using DMA for ADC conversions. +In the SimpleFOClibrary the low-side current sensing is implemented in the `LowsideCurrentSense` class. This class is designed to work with the `BLDCDriver` and `StepperDriver` classes and it is used to measure the phase currents of the motor where the ADC conversions are synchronized with the PWM generation of the driver. The `LowsideCurrentSense` class is impletmets this synchronization, and even though it is primarily designed to be used with the low-side current sensing hardware, it can also be used with the inline current sensing hardware. And in some cases it is even suggested to use it with the inline current sensing hardware such as for stm32 architecture, as it has much better performance since it is using DMA for ADC conversions. @@ -42,7 +42,7 @@ In the SimpleFOClibrary the Low side current sensing is currently supported for several MCU architectures supported by the SimpleFOClibrary. ESP32 architecture has the most generic support, supporting multiple motors per chip. Stm32 families f1, f4, l4, g4 and f7 are supported and support low-side sensing for only one motor. A special case of the STM32 board is the B-G431-ESC1 development kit which has very specific low-side implementation for its hardware configuration, and it is fully supported by the library. Samd21 architecture is under development, it has an initial support for only one motor, but for now as it has not been extensively tested, we suggest not to rely on our implementation. Teensy4 has an initial support for low-side sensing for one motor as well. -MCU | Low-side Current sensing | ADC conversion type | Max PWM freqeuncy | supported ADC +MCU | Low-side Current sensing | ADC conversion type | Max PWM frequency | supported ADC --- | --- | --- | --- | --- Arduino (8-bit) | ❌ | - | -| - Arduino DUE | ❌ | - | -| - @@ -60,20 +60,20 @@ ESP8266 | ❌ | -| -| - SAMD21 | ✔️/❌ (one motor, poorly tested) | Interrupts | ?| ? SAMD51 | ❌ | -| -| - Teensy3 | ❌| -| -| - -Teensy4 | ✔️ (inital)| Interrupts| ~20kHz| ADC1 +Teensy4 | ✔️ (initial)| Interrupts| ~20kHz| ADC1 Raspberry Pi Pico | ❌ | -| - Portenta H7 | ❌ | -| -| - Renesas (UNO R4) | ❌ (TBD) | -| -| - ### Important hardware considerations -Low-side current sensing requires very high synchronisation of the PWM generated by the `driver` and the ADC triggering. There are three main considerations to have in mind when choosing the MCU you wish to use and the driver you wish to use with the low-side current sensing: +Low-side current sensing requires very high synchronization of the PWM generated by the `driver` and the ADC triggering. There are three main considerations to have in mind when choosing the MCU you wish to use and the driver you wish to use with the low-side current sensing: 1. ADC conversion type - DMA or Interrupt based 2. PWM frequency considerations 3. Appropriate PWM and ADC pin considerations -See more info about driver paramers in the [driver docs](drivers_config)! +See more info about driver parameters in the [driver docs](drivers_config)! ### 1. ADC conversion type @@ -94,7 +94,7 @@ On the other hand, having higher PWM frequency will produce smoother operation,RULE OF THUMB: PWM frequency
-The rule of thumb is to stay arround 20kHz. +The rule of thumb is to stay around 20kHz.driver.pwm_frequency = 20000; @@ -103,11 +103,11 @@ driver.pwm_frequency = 20000; ### 3. Appropriate PWM and ADC pin considerations -As ADC conversion has to be synchronised with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM and that it supports triggering of the ADC conversion. Since the microcontrollers usually have more than one timer for PWM generation and more than one ADC for reading the analog values it is important to choose the right pins for the right phase. +As ADC conversion has to be synchronized with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM and that it supports triggering of the ADC conversion. Since the microcontrollers usually have more than one timer for PWM generation and more than one ADC for reading the analog values it is important to choose the right pins for the right phase.@@ -233,7 +233,7 @@ current_sense.gain_b *= -1; -## Synchronising the current sense with the driver PWM +## synchronizing the current sense with the driver PWMRULE OF THUMB: PWM timer and ADC pins
-In order to maximise your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same Timer, and the ADC pins chosen for your current sense all belong to the same ADC.
+In order to maximize your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same Timer, and the ADC pins chosen for your current sense all belong to the same ADC.
📢 Here is a quick guide to choosing appropriate PWM pins for different MCU architectures see in docs.
📢 Here is a quick guide to choosing appropriate ADC pins for different MCU architectures see in docs.@@ -242,15 +242,15 @@ Since the low-side current sensing technique requires triggering of the ADC acqu // link current sense and driver current_sense.linkDriver(&driver); ``` -Current sense will be using driver parameters for different synchronisation and calibration procedures. +Current sense will be using driver parameters for different synchronization and calibration procedures.
-## Initialising the current sense +## initializing the current sense -Once the current sense has been created and linked with the driver it can be initialised. This `init()` function configures the ADC hardware for reading and finds the zero offsets of the ADC for each channel. +Once the current sense has been created and linked with the driver it can be initialized. This `init()` function configures the ADC hardware for reading and finds the zero offsets of the ADC for each channel. ```cpp // init current sense current_sense.init(); @@ -272,7 +272,7 @@ else{ } ``` -When your current sense has been intialised and calibrated you can start measuring the currents! +When your current sense has been initialized and calibrated you can start measuring the currents! ### Enable debugging output @@ -336,12 +336,12 @@ void setup(){ ``` -Current sense will be using driver parameters for different synchronisation and calibration procedures. +Current sense will be using driver parameters for different synchronization and calibration procedures.API change - SimpleFOClibrary v2.2.2
-Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronisation for current sensing. +Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronization for current sensing.Once the driver is linked to the current sense, last step is to link the current sense with the `motor` you wish to use it with: @@ -376,7 +376,7 @@ void setup(){ motor.initFOC(); } ``` -Function `initFOC()` will make sure that the `BLDCDriver` and `LowsideCurrentSense` classes are both well aligned, it is very important that the phase `A` of the current sense is exactly the phase `A` of the driver, phase `B` of the current sense exactly pahse `B` of the driver and the same for the phase `C`. To verify this, the `initFOC` will be calling the current sense's function `current_sense.driverAlign(...)`. +Function `initFOC()` will make sure that the `BLDCDriver` and `LowsideCurrentSense` classes are both well aligned, it is very important that the phase `A` of the current sense is exactly the phase `A` of the driver, phase `B` of the current sense exactly phase `B` of the driver and the same for the phase `C`. To verify this, the `initFOC` will be calling the current sense's function `current_sense.driverAlign(...)`. ### Alignment with the motor phases `driverAlign(...)` @@ -452,7 +452,7 @@ See the full example for the Aliexpress DRB8302 based board in the library examp BLDC motors Stepper motors -Since the low-side current sense has to be synchornised with PWM of a driver of interest it does not make sense to use it as a stand-alone sensor. +Since the low-side current sense has to be synchronized with PWM of a driver of interest it does not make sense to use it as a stand-alone sensor. But once you have linked the current sense with the `driver` you can use it to read your phase currents, overall current magnitude and DQ currents. Reading the phase currents can be done by calling: @@ -485,7 +485,7 @@ Sometimes the phase currents are hard to interpret, therefore this current sense float current_mag = current_sense.getDCCurrent(); ``` -Futhermore if you have an access to the position sensor of the motor connected to the driver you can get signed value of the DC current the motor is drawing by providing it to the `getDCCurrent` method. +Furthermore if you have an access to the position sensor of the motor connected to the driver you can get signed value of the DC current the motor is drawing by providing it to the `getDCCurrent` method. ```cpp float current = current_sense.getDCCurrent(motor_electrical_angle); ``` @@ -535,7 +535,7 @@ void setup() { motor.init(); ... - // initialise the current sensing + // initialize the current sensing current_sense.init(); motor.linkCurrentSense(¤t_sense); @@ -589,7 +589,7 @@ void setup() { motor.init(); ... - // initialise the current sensing + // initialize the current sensing current_sense.init(); motor.linkCurrentSense(¤t_sense); diff --git a/docs/simplefoc_library/code/debug.md b/docs/simplefoc_library/code/debug.md index e83f2ae..e2ff36a 100644 --- a/docs/simplefoc_library/code/debug.md +++ b/docs/simplefoc_library/code/debug.md @@ -21,7 +21,7 @@ There are different techniques to help you find problems on the software side, b SimpleFOClibrary provides debug output using the `Serial` port which is enabled by adding the following line to your `setup` function. -Place this function call early in the `setup` function to see the debug output of the motor intialization, which can be important to help you find problems with your setup. +Place this function call early in the `setup` function to see the debug output of the motor initialization, which can be important to help you find problems with your setup. ```cpp @@ -107,7 +107,7 @@ Why have our own `SimpleFOCDebug`? Wny not just use `Serial.println`? When supporting many hardware platforms (as SimpleFOClibrary does), we can't make assumptions about the availability of the `Serial` object. While it is a pretty standard feature of Arduino framework, a given board may not support it, or may for whatever reasons have a different name for it. We also can't make assumptions about *which* `Serial` object you would want to use. Some MCUs support 6 or more Serial ports. -We also like the abstraction it provides, making it easier to port SimpleFOClibrary to other platforms/frameworks. In future we may abstract the debug output functionality one level further, allowing debug output via SPI, MQTT or other protocols. For this reason it is also good to have a seperation between debug and `Serial`. +We also like the abstraction it provides, making it easier to port SimpleFOClibrary to other platforms/frameworks. In future we may abstract the debug output functionality one level further, allowing debug output via SPI, MQTT or other protocols. For this reason it is also good to have a separation between debug and `Serial`. ## Other debugging methods @@ -121,7 +121,7 @@ Yes and no... There is no problem with calling Serial.println() in your sketches ### Spare pins -A great way to debug simple things is to use `digitalWrite` and an usused pin: +A great way to debug simple things is to use `digitalWrite` and an unused pin: ```cpp digitalWrite(5, HIGH); // 5 is an unused pin @@ -130,7 +130,7 @@ digitalWrite(5, HIGH); // 5 is an unused pin digitalWrite(5, LOW); ``` -Using this technique will not impact the execution time, and using your oscilloscope or logic analyser you can check the output pin and see things like how long calls are taking to execute, whether the code is taking certain branches, etc... +Using this technique will not impact the execution time, and using your oscilloscope or logic analyzer you can check the output pin and see things like how long calls are taking to execute, whether the code is taking certain branches, etc... ### IDE Debugger @@ -142,7 +142,7 @@ But it would depend on the problem you're trying to catch, the MCU and debugging We can't stress enough how much help the SimpleFOClibrary communities can be if you're having problems! -We have a [Discourse Forum](https://community.simplefoc.com/) and a [Discord Server](https://discord.com/invite/JbH772tfnB) you can join any time and ask questions. Our members are both knowledgable and helpful, so rather than sweat it out by yourself, drop by and ask some like-minded souls for advice. +We have a [Discourse Forum](https://community.simplefoc.com/) and a [Discord Server](https://discord.com/invite/JbH772tfnB) you can join any time and ask questions. Our members are both knowledgeable and helpful, so rather than sweat it out by yourself, drop by and ask some like-minded souls for advice. ### Report it! diff --git a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_3pwm.md b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_3pwm.md index 6f38204..9b46852 100644 --- a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_3pwm.md +++ b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_3pwm.md @@ -99,12 +99,12 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(PIN_A, PIN_B, PIN_C, ENABLE); ### Low-side current sensing considerations -As ADC conversion has to be synchronised with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM. Since the microcontrollers usually have more than one timer for PWM generation on its pins, different architectures of microcontrollers have different degrees of alinement in between the PWM generated from different timers. +As ADC conversion has to be synchronized with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM. Since the microcontrollers usually have more than one timer for PWM generation on its pins, different architectures of microcontrollers have different degrees of alinement in between the PWM generated from different timers.API change - SimpleFOClibrary v2.2.2
-Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronisation for current sensing. +Driver linking to the current sense is introduced from the library version v2.2.2 in order to propagate different hardware specific parameters in between ADC and PWM timers needed for advanced synchronization for current sensing.RULE OF THUMB: PWM timer pins
-In order to maximise your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same Timer. +In order to maximize your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same Timer. Finding out which pins belong to different timers might require some time to be spent in the MCU datasheet 😄 You can also always ask the community for help - community link! @@ -137,7 +137,7 @@ On the other hand, having higher PWM frequency will produce smoother operation,RULE OF THUMB: PWM frequency
-The rule of thumb is to stay arround 20kHz. +The rule of thumb is to stay around 20kHz.driver.pwm_frequency = 20000; @@ -171,7 +171,7 @@ This parameter is used by the `BLDCMotor` class as well. As shown on the figure Therefore this parameter is very important if there is concern of too high currents generated by the motor. In those cases this parameter can be used as a security feature. -## Step 2.3 Initialisation +## Step 2.3 initialization Once when all the necessary configuration parameters are set the driver function `init()` is called. This function uses the configuration parameters and configures all the necessary hardware and software for driver code execution. ```cpp // driver init diff --git a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md index 81529f5..8f050c6 100644 --- a/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md +++ b/docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md @@ -124,7 +124,7 @@ BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB15); ``` #### Software 6 PWM mode -If it is not possible to use the hardware 6 PWM mode with your board SimpleFOClibrary enables you to use any two channels of any of the timers as your high/low side PWM pair. Basically, the library will automatically configure the complementary channels on the provided low side pins. The only requirement for this code to work properly is exatcly the same as for the Arudino UNO, each phase high/low PWM pair needs to belong to the same timer. +If it is not possible to use the hardware 6 PWM mode with your board SimpleFOClibrary enables you to use any two channels of any of the timers as your high/low side PWM pair. Basically, the library will automatically configure the complementary channels on the provided low side pins. The only requirement for this code to work properly is exactly the same as for the Arduino UNO, each phase high/low PWM pair needs to belong to the same timer. For example, if we take STM32 Nucleo F401RE board we can take for example: ```cpp // BLDCDriver6PWM( int phA_h, int phA_l, int phB_h, int phB_l, int phC_h, int phC_l, int en) @@ -153,12 +153,12 @@ ESP32 boards support `MCPWM` interface that is intended for this kind of applica ### Low-side current sensing considerations -As ADC conversion has to be synchronised with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM. Since the microcontrollers usually have more than one timer for PWM generation on its pins, different architectures of microcontrollers have different degrees of alinement in between the PWM generated from different timers. +As ADC conversion has to be synchronized with the PWM generated on ALL the phases, it is important that all the PWM generated for all the phases have aligned PWM. Since the microcontrollers usually have more than one timer for PWM generation on its pins, different architectures of microcontrollers have different degrees of alinement in between the PWM generated from different timers.RULE OF THUMB: PWM timer pins
-In order to maximise your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same timer. +In order to maximize your chances for the low-side current sensing to work well we suggest to make sure that the PWM pins chosen for your driver all belong to the same timer. Finding out which pins belong to different timers might require some time to be spent in the MCU datasheet 😄 To try to save you some time, we have created a quick guide to choosing appropriate PWM pins for different MCU architectures see in docs. @@ -192,7 +192,7 @@ On the other hand, having higher PWM frequency will produce smoother operation,diff --git a/docs/simplefoc_library/code/motion_control/open_loop/angle_openloop.md b/docs/simplefoc_library/code/motion_control/open_loop/angle_openloop.md index 9ef5e97..aa3dbad 100644 --- a/docs/simplefoc_library/code/motion_control/open_loop/angle_openloop.md +++ b/docs/simplefoc_library/code/motion_control/open_loop/angle_openloop.md @@ -97,7 +97,7 @@ U_{limit} \quad [Volts] $$ This is very inefficient, as for different motors with different phase resistances the same voltage values can produce wildly different currents. -For gimbal motor, you can run it in the open loop with the voltage limits of 5-10 Volts and it will reach the currents of 0.5-2 amps as it has the phase resistance from 5-15 Ohms. For drone motors, the voltage limits should stay very low, under 1 volt. Because they have phase resisatnce of 0.05 to 0.2 Ohms. +For gimbal motor, you can run it in the open loop with the voltage limits of 5-10 Volts and it will reach the currents of 0.5-2 amps as it has the phase resistance from 5-15 Ohms. For drone motors, the voltage limits should stay very low, under 1 volt. Because they have phase resistance of 0.05 to 0.2 Ohms. ### Current limiting approaches diff --git a/docs/simplefoc_library/code/motion_control/open_loop/index.md b/docs/simplefoc_library/code/motion_control/open_loop/index.md index 8c1acac..e1d7e9e 100644 --- a/docs/simplefoc_library/code/motion_control/open_loop/index.md +++ b/docs/simplefoc_library/code/motion_control/open_loop/index.md @@ -22,8 +22,8 @@ Choose the voltage control type: Velocity controlRULE OF THUMB: PWM frequency
-The rule of thumb is to stay arround 20kHz. +The rule of thumb is to stay around 20kHz.driver.pwm_frequency = 20000; @@ -210,7 +210,7 @@ driver.pwm_frequency = 20000; // dead_zone [0,1] - default 0.02 - 2% driver.dead_zone = 0.05; ``` -The dead zone parameter is defined as the amount of the duty cycle that is reserved in between changing the active mosfet. Each time the high/low side is deacitvated and low/high side is activated half of the `dead_zone` is injected. This parameter is equivalent to the dead time, dead_time can be calculated as: +The dead zone parameter is defined as the amount of the duty cycle that is reserved in between changing the active mosfet. Each time the high/low side is deactivated and low/high side is activated half of the `dead_zone` is injected. This parameter is equivalent to the dead time, dead_time can be calculated as: ```cpp dead_time = 1/pwm_frequency*dead_zone ``` @@ -240,7 +240,7 @@ This parameter is used by the `BLDCMotor` class as well. As shown on the figure Therefore this parameter is very important if there is concern of too high currents generated by the motor. In those cases this parameter can be used as a security feature. -## Step 2.3 Initialisation +## Step 2.3 initialization Once when all the necessary configuration parameters are set the driver function `init()` is called. This function uses the configuration parameters and configures all the necessary hardware and software for driver code execution. ```cpp // driver init @@ -305,7 +305,7 @@ void setup() { driver.voltage_power_supply = 12; // Max DC voltage allowed - default voltage_power_supply driver.voltage_limit = 12; - // daad_zone [0,1] - default 0.02 - 2% + // dead_zone [0,1] - default 0.02 - 2% driver.dead_zone = 0.05; // driver init diff --git a/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_2pwm.md b/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_2pwm.md index ab0de7d..8a99d9a 100644 --- a/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_2pwm.md +++ b/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_2pwm.md @@ -95,7 +95,7 @@ This parameter is used by the `StepperMotor` class as well. As shown on the figu Therefore this parameter is very important if there is concern of too high currents generated by the motor. In those cases this parameter can be used as a security feature. -## Step 2.3 Initialisation +## Step 2.3 initialization Once when all the necessary configuration parameters are set the driver function `init()` is called. This function uses the configuration parameters and configures all the necessary hardware and software for driver code execution. ```cpp // driver init diff --git a/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_4pwm.md b/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_4pwm.md index 022166f..4a5ddd8 100644 --- a/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_4pwm.md +++ b/docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_4pwm.md @@ -71,7 +71,7 @@ This parameter is used by the `StepperMotor` class as well. As shown on the figu Therefore this parameter is very important if there is concern of too high currents generated by the motor. In those cases this parameter can be used as a security feature. -## Step 2.3 Initialisation +## Step 2.3 initialization Once when all the necessary configuration parameters are set the driver function `init()` is called. This function uses the configuration parameters and configures all the necessary hardware and software for driver code execution. ```cpp // driver init diff --git a/docs/simplefoc_library/code/from_scratch.md b/docs/simplefoc_library/code/from_scratch.md index 6ad9d57..ba18ff5 100644 --- a/docs/simplefoc_library/code/from_scratch.md +++ b/docs/simplefoc_library/code/from_scratch.md @@ -42,7 +42,7 @@ void setup() { // monitoring port Serial.begin(115200); - // initialise magnetic sensor hardware + // initialize magnetic sensor hardware sensor.init(); Serial.println("Sensor ready"); @@ -79,7 +79,7 @@ void setup() { // configure i2C Wire.setClock(400000); - // initialise magnetic sensor hardware + // initialize magnetic sensor hardware sensor.init(); Serial.println("Sensor ready"); @@ -117,7 +117,7 @@ void setup() { // monitoring port Serial.begin(115200); - // initialise magnetic sensor hardware + // initialize magnetic sensor hardware sensor.init(); Serial.println("Sensor ready"); @@ -155,7 +155,7 @@ void setup() { // monitoring port Serial.begin(115200); - // initialise sensor hardware + // initialize sensor hardware sensor.init(); Serial.println("Sensor ready"); @@ -183,7 +183,7 @@ void loop() { #includeEncoder encoder = Encoder(2, 3, 500); -// interrupt routine initialisation +// interrupt routine initialization void doA(){encoder.handleA();} void doB(){encoder.handleB();} @@ -191,7 +191,7 @@ void setup() { // monitoring port Serial.begin(115200); - // initialise encoder hardware + // initialize encoder hardware encoder.init(); // hardware interrupt enable encoder.enableInterrupts(doA, doB); @@ -296,7 +296,7 @@ void setup() { driver.voltage_power_supply = 12; // Max DC voltage allowed - default voltage_power_supply driver.voltage_limit = 12; - // daad_zone [0,1] - default 0.02f - 2% + // dead_zone [0,1] - default 0.02f - 2% driver.dead_zone = 0.05f; // driver init @@ -407,7 +407,7 @@ void loop() { ``` -Once you have the code ready, upload it to your board and open the serial terminal. If everything is connected correctly your PWM driver should be ready and you should see the `Driver ready!` message in the serial terminal. If the driver does not initialise correctly, please check the following things: +Once you have the code ready, upload it to your board and open the serial terminal. If everything is connected correctly your PWM driver should be ready and you should see the `Driver ready!` message in the serial terminal. If the driver does not initialize correctly, please check the following things: 1. Make sure to change the driver parameters to suit your application, such as pin numbers, PWM frequency, power supply voltage and similar. Make sure to go through the [driver docs](drivers_config) if you are not sure about some of the parameters. 2. Make sure you use the right driver class and right pwm pins, this one is usually very simple and you can find a lot of docs about these things in our [driver docs](drivers_config) and in our [guide to choosing the PWM pins](choosing_pwm_pins). If you are not sure and cannot seem to make it work please do not hesitate to ask in our [community forum](https://community.simplefoc.com). @@ -749,7 +749,7 @@ If you cannot find the phase resistance of your motor and cannot measure it with 3. Make sure to put the right pole pair number. This you can find in most data-sheets, if you are not sure what is the true number don't worry this step is intended to test/find exactly this value. 😄 @@ -290,7 +290,7 @@ With the $$R$$ and $$KV$$ information the Simple☑️ Simple tests
-1. Verify in your serial terminal that the motor and the driver have been initialised without any issues. That you can see `Motor ready!` and not see `Motor init failed!` or `Driver init failed!`. +1. Verify in your serial terminal that the motor and the driver have been initialized without any issues. That you can see `Motor ready!` and not see `Motor init failed!` or `Driver init failed!`. 2. In velocity mode: (`motor.controller = MotionControlType::velocity_openloop;`)
set your target velocity (`T6.28`) to 6.28 ($$2\pi$$) rad/s (type `T6.28`), this should be exactly one rotation per second. 3. In position mode, (`motor.controller = MotionControlType::angle_openloop;`)
@@ -1037,12 +1037,12 @@ Until now, you already know the good configuration of your sensor, your driver aThe most common issues that might arise are: - The motor does not spin at all - - The driver is probably not initialised correctly, check the serial terminal output for any errors. + - The driver is probably not initialized correctly, check the serial terminal output for any errors. - The motor spins during the `motor.initFOC()` function but it does not spin afterwards - Verify the output of the `motor.initFOC()` function, there is probably an error with the sensor alignment or pole pairs number. - The motor spins but is unstable and makes a lot of noise @@ -1401,7 +1401,7 @@ void loop() { ``` -This example code is almost exactly the same as the Step 3. code so you should not have much trouble configuring motor, sensor and driver. In this step you will be testing if your current sense is working well. In the call of the `motor.monitor()` function the current sense will be read and the current d and q are going to be printed to the serial terminal. You can open the Serial Plotter to visualise them. +This example code is almost exactly the same as the Step 3. code so you should not have much trouble configuring motor, sensor and driver. In this step you will be testing if your current sense is working well. In the call of the `motor.monitor()` function the current sense will be read and the current d and q are going to be printed to the serial terminal. You can open the Serial Plotter to visualize them.☑️ Simple test
1. If everything is connected correctly you should see the motor spinning and you should be able to set the target voltage through the serial terminal (command `M`). -2. If the motor is not spinning please verify that the motor and driver have been initialised without any issues by checking the serial terminal output (make sure that you can see `Motor ready!` and not see `Motor init failed!` or `Driver init failed!`). +2. If the motor is not spinning please verify that the motor and driver have been initialized without any issues by checking the serial terminal output (make sure that you can see `Motor ready!` and not see `Motor init failed!` or `Driver init failed!`).-If the motor is not spinning please verify that the motor and driver have been initialised without any issues by checking the serial terminal output (make sure that you can see `Motor ready!` and not see `Motor init failed!`, `Driver init failed!` or `Current sense init failed!`). Our debugging interface will output a lot of information during the driver, current sense and motor init that can help you debug potential issues with your setup. If you are having issues with the current sense please go through the [current sense docs](current_sense) to see the supported sensors and all the configuration parameters. +If the motor is not spinning please verify that the motor and driver have been initialized without any issues by checking the serial terminal output (make sure that you can see `Motor ready!` and not see `Motor init failed!`, `Driver init failed!` or `Current sense init failed!`). Our debugging interface will output a lot of information during the driver, current sense and motor init that can help you debug potential issues with your setup. If you are having issues with the current sense please go through the [current sense docs](current_sense) to see the supported sensors and all the configuration parameters. The most common issues that might arise are: - Current sense pins are not ADC pins - see our [guide to choosing ADC pins](choosing_adc_pins) for more info. - The driver is not linked to the current sense - make sure you have the `current_sense.linkDriver(&driver);` line in your code. -- PWM timer and ADC cannot be synchronised - see our [guide to choosing PWM pins](choosing_pwm_pins) for more info. +- PWM timer and ADC cannot be synchronized - see our [guide to choosing PWM pins](choosing_pwm_pins) for more info. - Current sense alignment has failed - verify the debugging output of the `motor.initFOC()` function and try to change the `motor.voltage_sensor_align` value. ## Step 5. Full FOC motion control using current sensing - if available diff --git a/docs/simplefoc_library/code/index.md b/docs/simplefoc_library/code/index.md index 6278fe8..eee23b3 100644 --- a/docs/simplefoc_library/code/index.md +++ b/docs/simplefoc_library/code/index.md @@ -88,10 +88,10 @@ void loop() { } ``` -This is an example initialisation of a 14 bit SPI based magnetic sensor such as the AS5047u , connected to pin `10`.☑️ Simple test
1. If everything is connected correctly you should see the motor spinning and you should be able to set the target voltage through the serial terminal (command `M`). @@ -1409,12 +1409,12 @@ This example code is almost exactly the same as the Step 3. code so you should n 3. Leave the motor to rotate. See that your currents d and q drop to a lower level than for static motor. Also try to see that the current d is almost 0 for low velocities and starts rising proportionally to the motor velocity.
+This is an example initialization of a 14 bit SPI based magnetic sensor such as the AS5047u , connected to pin `10`.
Magnetic sensors using the SPI protocol are implemented in the class `MagneticSensorSPI` and are defined with their - `chip_select` pin: `10` - - bit resoluion of the sensor overall `12` the `CPR` can be calculated as `CPR = 2^14bit =16384` + - bit resolution of the sensor overall `12` the `CPR` can be calculated as `CPR = 2^14bit =16384` - `angle` SPI register: `0x3FFF` @@ -390,7 +390,7 @@ void setup() { // link driver and the current sense // link the motor to current sense - motor.linkCurrentSense(¤t_sese); + motor.linkCurrentSense(¤t_sense); // set control loop type to be used motor.controller = MotionControlType::velocity; @@ -432,7 +432,7 @@ void setup() { // link driver and the current sense // link the motor to current sense - motor.linkCurrentSense(¤t_sese); + motor.linkCurrentSense(¤t_sense); // set control loop type to be used motor.controller = MotionControlType::velocity; @@ -576,7 +576,7 @@ This debugging interface will output a more detailed information about: - motor FOC initialization (during the `motor.initFOC()` function) The debugging output will provide more information about the state of the motor, driver and current sense during and after the initialization process and will help you to debug your setup. -It will also provide MCU architecture specific information such as which Timers and channels are used for PWM generation, which ADC is used for current sensing, did the TIME-ADC synchronisation work, etc. +It will also provide MCU architecture specific information such as which Timers and channels are used for PWM generation, which ADC is used for current sensing, did the TIME-ADC synchronization work, etc.📢 We strongly advise to use the debugging mode when starting with the SimpleFOClibrary. @@ -588,7 +588,7 @@ It provides much more information than the standard monitoring output and can he Debugging outputs are strings which can take a considerable amount of memory space, so it's not recommended to use it in the final application.-Debugging output is disabled by default and can be enabled by calling the `SimpleFOCDebug::enable(&Serial)` function before any of the `driver`, `sensor`, `current_sense` or `motor` initalisation (`init` calls). Preferably put the `SimpleFOCDebug::enable(&Serial)` function call at the beginning of the `setup()` function. +Debugging output is disabled by default and can be enabled by calling the `SimpleFOCDebug::enable(&Serial)` function before any of the `driver`, `sensor`, `current_sense` or `motor` initialization (`init` calls). Preferably put the `SimpleFOCDebug::enable(&Serial)` function call at the beginning of the `setup()` function. ```cpp #include@@ -847,7 +847,7 @@ void setup() { // enable the debugging output SimpleFOCDebug::enable(&Serial); - // initialise magnetic sensor hardware + // initialize magnetic sensor hardware sensor.init(); // link the motor to the sensor motor.linkSensor(&sensor); @@ -862,7 +862,7 @@ void setup() { // set control loop type to be used motor.controller = MotionControlType::torque; - // contoller configuration based on the control type + // controller configuration based on the control type motor.PID_velocity.P = 0.2; motor.PID_velocity.I = 20; motor.PID_velocity.D = 0; @@ -881,12 +881,12 @@ void setup() { // comment out if not needed motor.useMonitoring(Serial); - // initialise motor + // initialize motor motor.init(); // align encoder and start FOC motor.initFOC(); - // set the inital target value + // set the initial target value motor.target = 2; // define the motor id @@ -903,7 +903,7 @@ void loop() { // iterative setting of the FOC phase voltage motor.loopFOC(); - // iterative function setting the outter loop target + // iterative function setting the outer loop target // velocity, position or voltage // if target not set in parameter uses motor.target variable motor.move(); diff --git a/docs/simplefoc_library/code/monitoring.md b/docs/simplefoc_library/code/monitoring.md index c63284e..4b4e479 100644 --- a/docs/simplefoc_library/code/monitoring.md +++ b/docs/simplefoc_library/code/monitoring.md @@ -29,7 +29,7 @@ Note: you can also use other serial ports, e.g. Serial1, Serial2, as supported b At the moment, enabling monitoring using@@ -148,7 +148,7 @@ motor.monitor_start_char = '\0'; //!< monitor starting character motor.monitor_end_char = '\0'; //!< monitor outputs ending character motor.monitor_separator = '\t'; //!< monitor outputs separation character ``` -The initial parameters are set so that the Arduino IDE's serial plotter can nicely parse the variables. However if you wish to use some other serial plotter application, for example [CieNTi/serial_port_plotter](https://github.com/CieNTi/serial_port_plotter), you can easily adapt the monitoring format so that you can visualise motor variables in it +The initial parameters are set so that the Arduino IDE's serial plotter can nicely parse the variables. However if you wish to use some other serial plotter application, for example [CieNTi/serial_port_plotter](https://github.com/CieNTi/serial_port_plotter), you can easily adapt the monitoring format so that you can visualize motor variables in it ```cpp motor.monitor_separator= ' '; diff --git a/docs/simplefoc_library/code/motion_control/closed_loop_control/torque_control/voltage.md b/docs/simplefoc_library/code/motion_control/closed_loop_control/torque_control/voltage.md index 793df0e..77ab4d5 100644 --- a/docs/simplefoc_library/code/motion_control/closed_loop_control/torque_control/voltage.md +++ b/docs/simplefoc_library/code/motion_control/closed_loop_control/torque_control/voltage.md @@ -206,7 +206,7 @@ With the $$R$$ and $$KV$$ information the Simplemotor.useMonitoringwill also enable debug output - see [debugging](debugging) for details. -In a future release, debug output and telemetry output will be seperated and themotor.useMonitoringfunction will likely be deprecated. +In a future release, debug output and telemetry output will be separated and themotor.useMonitoringfunction will likely be deprecated. If the debug output is undesired or causing you problems, you can disable debug output (but keep monitoring) like this:⚠️ Practical limitations
-Back-EMF voltage is defined as \(U_{bemf} = k_{bemf}v\) and calculating it based on the motor \(KV\) rating of the motor is just an approximation because the motor BEMF constant \(k_{bemf}\) is not exacly \(k_{bemf}=1/KV\). +Back-EMF voltage is defined as \(U_{bemf} = k_{bemf}v\) and calculating it based on the motor \(KV\) rating of the motor is just an approximation because the motor BEMF constant \(k_{bemf}\) is not exactly \(k_{bemf}=1/KV\). It can be shown that the back-emf constant is always somewhat smaller than the inverse of the KV rating: \[k_{bemf}<\frac{1}{KV}\]⚠️ Practical limitations
-Back-EMF voltage is defined as \(U_{bemf} = k_{bemf}v\) and calculating it based on the motor \(KV\) rating of the motor is just an approximation because the motor BEMF constant \(k_{bemf}\) is not exacly \(k_{bemf}=1/KV\). +Back-EMF voltage is defined as \(U_{bemf} = k_{bemf}v\) and calculating it based on the motor \(KV\) rating of the motor is just an approximation because the motor BEMF constant \(k_{bemf}\) is not exactly \(k_{bemf}=1/KV\). It can be shown that the back-emf constant is always somewhat smaller than the inverse of the KV rating: \[k_{bemf}<\frac{1}{KV}\]-- +
+