You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proper low cost FOC supporting boards are very hard to find these days and even may not exist. The reason may be that the hobby community has not yet dug into it properly. Therefore this is the attempt to demistify the Field Oriented Control (FOC) algorithm and make a robust but simple implementation for usage with Arduino hadrware.
9
9
@@ -13,7 +13,6 @@ Proper low cost FOC supporting boards are very hard to find these days and even
13
13
- Simple usage and scalability (Arduino)
14
14
and demistify FOC control in a simple way.
15
15
16
-
17
16
For minimal version of the code more suitable for experimenting please visit the [minimal branch](https://github.com/askuric/Arduino-FOC/tree/minimal).
18
17
19
18
#### The closest you can get to FOC support and low cost (I was able to find) is:
@@ -28,7 +27,7 @@ For minimal version of the code more suitable for experimenting please visit the
@@ -182,12 +181,12 @@ First thing you can configure is your `power_supply_voltage` value. The default
182
181
// power supply voltage
183
182
motor.power_supply_voltage = 12;
184
183
```
185
-
You can also change driver type by changing the value of the variable `motor.driver`. It tells the algorithm to generate unipolar of bipolar FOC voltages. This basically means if your BLDC driver can only output voltages in range `[0,power_supply_voltage]` your driver is `DriverType::unipolar` and if it can output voltage in range `[-power_supply_voltage, power_supply_voltage]` than you driver is `DriverType::bipolar` what is case in most of the drivers and what is default value as well.
184
+
You can also change driver type by changing the value of the variable `motor.driver`. It tells the algorithm to generate unipolar of bipolar FOC voltages. This basically means if your BLDC driver can only output voltages in range `[0,power_supply_voltage]` your driver is `DriverType::half_bridge` and if it can output voltage in range `[-power_supply_voltage, power_supply_voltage]` than you driver is `DriverType::full_bridge` what is case in most of the drivers and what is default value as well.
186
185
```cpp
187
186
// set driver type
188
-
// DriverType::unipolar // HMBGC
189
-
// DriverType::bipolar // L6234 (default)
190
-
motor.driver = DriverType::bipolar;
187
+
// DriverType::full_bridge // HMBGC
188
+
// DriverType::half_bridge // L6234 (default)
189
+
motor.driver = DriverType::half_bridge;
191
190
```
192
191
## Control loop setup
193
192
First parameter you can change is the variable you want to control. You set it by changing the `motor.controller` variable. If you want to control the motor angle you will set the `controller` to `ControlType::angle`, if youy seek the DC motor behavior behaviour by controlling the voltage use `ControlType::voltage`, if you wish to control motor angular velocity `ControlType::velocity`. If you wish to control velocities which are very very slow, typically around ~0.01 rad/s you can use the `ControlType::velocity_ultra_slow` controller.
@@ -327,7 +326,7 @@ The real time execution of the Arduino Simple FOC library is govenred by two fun
327
326
// the best would be to be in ~10kHz range
328
327
motor.loopFOC();
329
328
```
330
-
The funciton `loopFOC()` gets the current motor angle from the encoder, turns in into the electrical angle and computes Clarke transfrom to set the desired $U_q$ voltage to the motor. Basically it implements the funcitonality of the [velocity control loop](#voltage-control-loop).
329
+
The funciton `loopFOC()` gets the current motor angle from the encoder, turns in into the electrical angle and computes Clarke transfrom to set the desired $U_q$ voltage to the motor. Basically it implements the funcitonality of the [voltage control loop](#voltage-control-loop).
331
330
- The faster you can run this funciton the better
332
331
- In the empty arduino loop it runs at ~1kHz but idealy it would be around ~10kHz
0 commit comments