Skip to content

Commit 0214d8e

Browse files
committed
Merge branch 'master' into dev
2 parents 0a6f4fd + 7727be8 commit 0214d8e

File tree

3 files changed

+56
-14
lines changed

3 files changed

+56
-14
lines changed

README.md

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Arduino Field Oriented Control (FOC) library
22

3+
34
![Library Compile](https://github.com/askuric/Arduino-FOC/workflows/Library%20Compile/badge.svg)
45
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
56

7+
68
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.
79

810
### This project aims to close the gap in the areas:
@@ -19,16 +21,16 @@ Proper low cost FOC supporting boards are very hard to find these days and even
1921
<img src="https://static1.squarespace.com/static/58aff26de4fcb53b5efd2f02/t/5c2c766921c67c143049cbd3/1546417803031/?format=1200w" width="400px"> | <img src="http://i3.ytimg.com/vi/g2BHEdvW9bU/maxresdefault.jpg" width="400px">
2022
:heavy_check_mark: Open Source | :x: Open Source
2123
:heavy_check_mark:Simple to use | :heavy_check_mark: Simple to use
22-
:x: Low cost | :x: Low cost
23-
:x: Low power | :heavy_check_mark: Low cost
24+
:x: Low cost ($100) | :x: Low cost ($100)
25+
:x: Low power (>50A) | :heavy_check_mark: Low power
2426

2527
<a href="https://www.infineon.com/cms/en/product/evaluation-boards/bldc_shield_tle9879/" >Infineon</a> | <a href="https://github.com/gouldpa/FOC-Arduino-Brushless">FOC-Arduino-Brushless</a>
2628
------------ | -------------
2729
<img src="https://www.infineon.com/export/sites/default/_images/product/evaluation-boards/BLDC_Motor_Shild_with_TLE9879QXA40.jpg_1711722916.jpg" height="300px" width="400px">| <img src="https://hackster.imgix.net/uploads/attachments/998086/dev_kit_89eygMekks.jpg?auto=compress%2Cformat&w=1280&h=960&fit=max" width="400px">
2830
:x: Open Source | :heavy_check_mark: Open Source
2931
:heavy_check_mark:Simple to use | :x: Simple to use
30-
:heavy_check_mark:Low cost | :heavy_check_mark: Low cost
31-
:heavy_check_mark: Low power | :heavy_check_mark: Low cost
32+
:heavy_check_mark:Low cost ($40) | :heavy_check_mark: Low cost
33+
:heavy_check_mark: Low power | :heavy_check_mark: Low power
3234

3335

3436

@@ -41,15 +43,20 @@ Proper low cost FOC supporting boards are very hard to find these days and even
4143

4244
Alternatively the library supports the arduino based gimbal controllers such as:
4345
- HMBGC V2.2 ([Ebay](https://www.ebay.com/itm/HMBGC-V2-0-3-Axle-Gimbal-Controller-Control-Plate-Board-Module-with-Sensor/351497840990?hash=item51d6e7695e:g:BAsAAOSw0QFXBxrZ:rk:1:pf:1))
44-
46+
4547

4648
## Arduino FOC Shield V1.2
4749

4850
At this moment we are developing an open source version of Arduin shiled specifically for FOC motor control.
4951
We already have prototypes of the board and we are in the testing phase. We will be coming out with the details very soon!
50-
***Let us know if you are interested!***
5152

52-
You can explore the [3D model of the board](extras/ArduinoFOCShieldV12.pdf)
53+
### Features
54+
- Plug and play capability with the Arduino FOC library
55+
- Price in the range of \$20-\$40
56+
- Gerber files and BOM available Open Source
57+
58+
***Let me know if you are interested! [email protected]***
59+
You can explore the [3D model of the board in the PDF form](extras/ArduinoFOCShieldV12.pdf).
5360

5461
<img src="extras/Images/AFSV11_side.png" height="300px"> <img src="extras/Images/AFSV11_top.png" height="200px"> <img src="extras/Images/AFSV11_bottom.png" height="200px">
5562

@@ -147,7 +154,7 @@ void setup(){
147154
}
148155
```
149156

150-
To explore better the encoder algorithm we provide an example `encoder_example.ino`.
157+
To explore better the encoder algorithm an example is provided `encoder_example.ino`.
151158

152159
## Motor setup
153160
To intialise the motor you need to input the `pwm` pins, number of `pole pairs` and optionally driver `enable` pin.
@@ -190,7 +197,6 @@ First parameter you can change is the variable you want to control. You set it b
190197
// ControlType::angle
191198
motor.controller = ControlType::angle;
192199
```
193-
194200
### Voltage control loop
195201
This control loop allows you to run the BLDC motor as it is simple DC motor using Park transformation. This mode is enabled by:
196202
```cpp
@@ -270,6 +276,35 @@ Additionally you can configure the `velocity_limit` value of the controller. Thi
270276

271277
Finally, each application is a bit different and the chances are you will have to tune the controller values a bit to reach desired behaviour.
272278

279+
280+
### Ultra slow velocity control loop
281+
This control loop allows you to spin your BLDC motor with desired velocity as well as the [velocity loop](#velocity-control-loop) but it is intended for very smooth operation in very low velocityes (< 0.1 rad/s). This mode is enabled by:
282+
```cpp
283+
// velocity ultra slow control loop
284+
motor.controller = ControlType::velocity_ultra_slow;
285+
```
286+
287+
<img src="extras/Images/velocity_ultraslow_loop.png" >
288+
289+
You can test this algorithm by running the example `velocity_ultrasloaw_control_serial.ino` .
290+
This type of the velocity control is nothing more but motor angle control. It works particularly well for the purposes of very slow movements because regular velocity calculation techniques are not vel suited for this application and regular [velocity control loop](#velocity-control-loop) would not work well.
291+
The behavior is achieved by integrating the user set target velocity $\textsf{v}_d$ to get the necessary angle $\textsf{a}_d$. And then controlling the motor angle $\textsf{a}$ with high-gain PI controller. This controller reads the motor angle $\textsf{a}$ and sets the $\textsf{u}_q$ voltage to the motor in a such maner that it closely follows the target angle $\textsf{a}_d$, to achieve the velocity profile $\textsf{v}_d$, set by the user.
292+
#### PI controller parameters
293+
To change the parameters of your PI controller to reach desired behaiour you can change `motor.PI_velocity` structure:
294+
```cpp
295+
// velocity PI controller parameters
296+
// default K=120.0 Ti = 100.0
297+
motor.PI_velocity_ultra_slow.K = 120;
298+
motor.PI_velocity_ultra_slow.Ti = 100;
299+
motor.PI_velocity_ultra_slow.u_limit = 12;
300+
```
301+
The parameters of the PI controller are proportional gain `K`, integral time constant `Ti` and voltage limit `u_limit` which is by default set to the `power_supply_voltage`.
302+
- The `u_limit` parameter is intended if some reason you wish to limit the voltage that can be sent to your motor.
303+
- In general by raising the proportional constant `K` your motor controller will be more reactive, but too much will make it unstable.
304+
- The same goes for integral time constant `Ti` the smaller it is the faster motors reaction to disturbance will be, but too small value will make it unstable. By defaualt the integral time constant `Ti` is set `100s`. Which means that it is extreamply slow, meaning that it is not effecting the behvior of the controlle, making it basically a P controller.
305+
306+
From the PI controller parameters you can see that the values are much higher than in the [velocity control loop](#velocity-control-loop). The reason is because the angle control loop is not the main loop and we need it to follow the profile as good as possible as fast as possible. Therefore we need much higher gain than before.
307+
273308
## FOC routine
274309
### Intialisation - `setup()`
275310
After the motor and encoder are intialised and the driver and control loops are configured you intialise the FOC algorithm.
@@ -310,7 +345,7 @@ It receives one parameter `BLDCMotor::move(float target)` which is current user
310345
- If the user runs the [voltage loop](#voltage-control-loop), `move` funciton will interpret the `target` parameter as voltage $\textbf{u}_q$.
311346

312347

313-
> At this point because we are goriented to simplicity we did not implement synchornious version of this code. Uing timer interrupt. The main reason for the moment is that Arduino UNO doesn't have enough timers to run it.
348+
> At this point because we are oriented to simplicity we did not implement synchornious version of this code. Uing timer interrupt. The main reason for the moment is that Arduino UNO doesn't have enough timers to run it.
314349
> *But in future we are planning to include this functionality.*
315350
316351
## Examples
@@ -397,8 +432,15 @@ class Encoder{
397432

398433

399434
# Future Work Roadmap
400-
- [ ] Encoder index proper implementation
401-
- [ ] Timer interrupt execution rather than in the `loop()`
435+
#### Library maintenance
402436
- [ ] Proper introduction of the **Arudino FOC Shield V1.2**
403437
- [ ] Make the library accesible in the Arduino Library Manager
404-
- [ ] Publish a video utilising the library and the samples
438+
- [ ] Publish a video utilising the library and the samples
439+
- [ ] Make minimal version of the arduino code - all in one arduino file
440+
441+
#### Code developement
442+
- [ ] Encoder index proper implementation
443+
- [ ] Enable more dirver types
444+
- [ ] Timer interrupt execution rather than in the `loop()`
445+
- [ ] Make support for magnetic encoder AS5048 and similar
446+
20.9 KB
Loading

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version=1.1.0
33
author=Antun Skuric <[email protected]>
44
maintainer=Antun Skuric <[email protected]>
55
sentence=A library demistifying FOC for BLDC motors
6-
paragraph=Simple library intended for hobby comunity to run the gimbal motors using FOC algorithm
6+
paragraph=Simple library intended for hobby comunity to run the gimbal motor using FOC algorithm
77
category=Device Control
88
url=http://github.com/askuric/Arduino-FOC/
99
architectures=*

0 commit comments

Comments
 (0)