Skip to content

Commit 84cc799

Browse files
author
Richard Unger
committed
Merge branch 'dev' of https://github.com/simplefoc/Arduino-FOC into dev
2 parents c87318c + b300dab commit 84cc799

File tree

31 files changed

+1052
-272
lines changed

31 files changed

+1052
-272
lines changed

.github/workflows/ccpp.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ jobs:
1010
arduino-boards-fqbn:
1111
- arduino:avr:uno # arudino uno
1212
- arduino:sam:arduino_due_x # arduino due
13+
- arduino:avr:mega # arduino mega2650
14+
- arduino:avr:leonardo # arduino leonardo
1315
- arduino:samd:nano_33_iot # samd21
1416
- adafruit:samd:adafruit_metro_m4 # samd51
1517
- esp32:esp32:esp32doit-devkit-v1 # esp32
1618
- esp32:esp32:esp32s2 # esp32s2
19+
- esp32:esp32:esp32s3 # esp32s3
1720
- STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 # stm32 bluepill
1821
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE # stm32 nucleo
1922
- STMicroelectronics:stm32:GenF4:pnum=GENERIC_F405RGTX # stm32f405 - odrive
@@ -24,11 +27,17 @@ jobs:
2427
- arduino-boards-fqbn: arduino:avr:uno # arudino uno - compiling almost all examples
2528
sketch-names: '**.ino'
2629
required-libraries: PciManager
27-
sketches-exclude: bluepill_position_control, esp32_position_control, esp32_i2c_dual_bus_example, stm32_i2c_dual_bus_example, magnetic_sensor_spi_alt_example, osc_esp32_3pwm, osc_esp32_fullcontrol, nano33IoT_velocity_control, smartstepper_control,esp32_current_control_low_side, stm32_spi_alt_example, esp32_spi_alt_example, B_G431B_ESC1, odrive_example_spi, odrive_example_encoder, single_full_control_example, double_full_control_example
30+
sketches-exclude: bluepill_position_control, esp32_position_control, esp32_i2c_dual_bus_example, stm32_i2c_dual_bus_example, magnetic_sensor_spi_alt_example, osc_esp32_3pwm, osc_esp32_fullcontrol, nano33IoT_velocity_control, smartstepper_control,esp32_current_control_low_side, stm32_spi_alt_example, esp32_spi_alt_example, B_G431B_ESC1, odrive_example_spi, odrive_example_encoder, single_full_control_example, double_full_control_example, stm32_current_control_low_side
2831

2932
- arduino-boards-fqbn: arduino:sam:arduino_due_x # arduino due - one full example
3033
sketch-names: single_full_control_example.ino
3134

35+
- arduino-boards-fqbn: arduino:avr:leonardo # arduino leonardo - one full example
36+
sketch-names: open_loop_position_example.ino
37+
38+
- arduino-boards-fqbn: arduino:avr:mega # arduino mega2660 - one full example
39+
sketch-names: single_full_control_example.ino
40+
3241
- arduino-boards-fqbn: arduino:samd:nano_33_iot # samd21
3342
sketch-names: nano33IoT_velocity_control.ino, smartstepper_control.ino
3443

@@ -43,6 +52,10 @@ jobs:
4352
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
4453
sketch-names: bldc_driver_3pwm_standalone.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone
4554

55+
- arduino-boards-fqbn: esp32:esp32:esp32s3 # esp32s3
56+
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
57+
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino
58+
4659
- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
4760
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
4861
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino
@@ -54,16 +67,18 @@ jobs:
5467
- arduino-boards-fqbn: STMicroelectronics:stm32:Disco:pnum=B_G431B_ESC1 # B-G431-ESC1
5568
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
5669
sketch-names: B_G431B_ESC1.ino
70+
build-properties:
71+
B_G431B_ESC1:
72+
-DHAL_OPAMP_MODULE_ENABLED
5773

5874
- arduino-boards-fqbn: STMicroelectronics:stm32:GenF4:pnum=GENERIC_F405RGTX # stm32f405 - odrive
5975
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
60-
sketch-names: odrive_example_encoder.ino, odrive_example_spi.ino
76+
sketch-names: odrive_example_encoder.ino, odrive_example_spi.ino, stm32_current_control_low_side.ino
6177

6278
- arduino-boards-fqbn: STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_F411RE # nucleo one full example
6379
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
64-
sketch-names: single_full_control_example.ino, stm32_spi_alt_example.ino, sdouble_full_control_example.ino
80+
sketch-names: single_full_control_example.ino, stm32_spi_alt_example.ino, sdouble_full_control_example.ino, stm32_current_control_low_side.ino
6581

66-
6782

6883
# Do not cancel all jobs / architectures if one job fails
6984
fail-fast: false
@@ -78,3 +93,4 @@ jobs:
7893
platform-url: ${{ matrix.platform-url }}
7994
sketch-names: ${{ matrix.sketch-names }}
8095
sketches-exclude: ${{ matrix.sketches-exclude }}
96+
build-properties: ${{ toJson(matrix.build-properties) }}

CITATION.cff

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
cff-version: 1.0.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- family-names: "Skuric"
5+
given-names: "Antun"
6+
orcid: "https://orcid.org/0000-0002-3323-4482"
7+
- family-names: "Bank"
8+
given-names: "Hasan Sinan"
9+
orcid: "https://orcid.org/0000-0002-0626-2664"
10+
- family-names: "Unger"
11+
given-names: "Richard"
12+
- family-names: "Williams"
13+
given-names: "Owen"
14+
- family-names: "González-Reyes"
15+
given-names: "David"
16+
orcid: "https://orcid.org/0000-0002-1535-3007"
17+
title: "SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors"
18+
version: 2.2.2
19+
doi: 10.21105/joss.04232
20+
date-released: 2022-06-26
21+
url: "https://github.com/simplefoc/Arduino-FOC"
22+
23+
preferred-citation:
24+
type: article
25+
authors:
26+
- family-names: "Skuric"
27+
given-names: "Antun"
28+
orcid: "https://orcid.org/0000-0002-3323-4482"
29+
- family-names: "Bank"
30+
given-names: "Hasan Sinan"
31+
orcid: "https://orcid.org/0000-0002-0626-2664"
32+
- family-names: "Unger"
33+
given-names: "Richard"
34+
- family-names: "Williams"
35+
given-names: "Owen"
36+
- family-names: "González-Reyes"
37+
given-names: "David"
38+
orcid: "https://orcid.org/0000-0002-1535-3007"
39+
doi: "10.21105/joss.04232"
40+
journal: "Journal of Open Source Software"
41+
url: "https://doi.org/10.21105/joss.04232"
42+
month: 6
43+
start: 4232 # First page number
44+
end: 4232 # Last page number
45+
title: "SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors"
46+
volume: 7
47+
issue: 74
48+
year: 2022

README.md

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# Arduino Simple Field Oriented Control (FOC) library
2-
1+
# SimpleFOClibrary - **Simple** Field Oriented Control (FOC) **library** <br>
2+
### A Cross-Platform FOC implementation for BLDC and Stepper motors<br> based on the Arduino IDE and PlatformIO
33

44
![Library Compile](https://github.com/simplefoc/Arduino-FOC/workflows/Library%20Compile/badge.svg)
5-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/simplefoc/arduino-foc)
6+
![GitHub Release Date](https://img.shields.io/github/release-date/simplefoc/arduino-foc?color=blue)
7+
![GitHub commits since tagged version](https://img.shields.io/github/commits-since/simplefoc/arduino-foc/latest/dev)
8+
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/simplefoc/arduino-foc/dev)
9+
610
[![arduino-library-badge](https://www.ardu-badge.com/badge/Simple%20FOC.svg?)](https://www.ardu-badge.com/badge/Simple%20FOC.svg)
11+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
712
[![status](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d/status.svg)](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d)
813

14+
915
We live in very exciting times 😃! BLDC motors are entering the hobby community more and more and many great projects have already emerged leveraging their far superior dynamics and power capabilities. BLDC motors have numerous advantages over regular DC motors but they have one big disadvantage, the complexity of control. Even though it has become relatively easy to design and manufacture PCBs and create our own hardware solutions for driving BLDC motors the proper low-cost solutions are yet to come. One of the reasons for this is the apparent complexity of writing the BLDC driving algorithms, Field oriented control (FOC) being an example of one of the most efficient ones.
1016
The solutions that can be found on-line are almost exclusively very specific for certain hardware configuration and the microcontroller architecture used.
1117
Additionally, most of the efforts at this moment are still channeled towards the high-power applications of the BLDC motors and proper low-cost and low-power FOC supporting boards are very hard to find today and even may not exist. <br>
@@ -18,49 +24,25 @@ Therefore this is an attempt to:
1824
- *Medium-power* BLDC driver (<30Amps): [Arduino <span class="simple">Simple<b>FOC</b>PowerShield</span> ](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield).
1925
- See also [@byDagor](https://github.com/byDagor)'s *fully-integrated* ESP32 based board: [Dagor Brushless Controller](https://github.com/byDagor/Dagor-Brushless-Controller)
2026

27+
<h3>NEWS 📢: SimpleFOClibrary has been published in the Journal of Open Source Software</h3>
28+
<p>
29+
<b>SimpleFOC</b>: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors.<br>
30+
A. Skuric, HS. Bank, R. Unger, O. Williams, D. González-Reyes<br>
31+
Journal of Open Source Software, 7(74), 4232, https://doi.org/10.21105/joss.04232
32+
</p>
2133

22-
23-
<blockquote class="info">
24-
<p class="heading">NEW RELEASE 📢: <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2.2 <a href="https://github.com/simplefoc/Arduino-FOC/releases/tag/v2.2.2">see release</a></p>
25-
<ul>
26-
<li>GenericCurrentSense bugfix and testing</li>
27-
<li>bugfix leonardo #170</li>
28-
<li>bugfix - no index search after specifying natural direction</li>
29-
<li>Low level API restructuring
30-
<ul dir="auto">
31-
<li>Driver API</li>
32-
<li>Current sense API</li>
33-
</ul>
34-
</li>
35-
<li>New debugging interface - <a href="https://docs.simplefoc.com/debugging">see in docs</a>
36-
<ul dir="auto">
37-
<li>Static class SimpleFOCDebug</li>
38-
</ul>
39-
</li>
40-
<li>CurrentSense API change - added method <code class="highlighter-rouge">linkDriver()</code> - <a href="https://docs.simplefoc.com/current_sense">see in docs</a></li>
41-
<li>Low-side current sensing - <a href="https://docs.simplefoc.com/low_side_current_sense">see in docs</a>
42-
<ul dir="auto">
43-
<li>ESP32 generic support for multiple motors</li>
44-
<li>Added low-side current sensing support for stm32 - only one motor
45-
<ul dir="auto">
46-
<li>f1 family</li>
47-
<li>f4 family</li>
48-
<li>g4 family</li>
49-
</ul>
50-
</li>
51-
</ul>
52-
</li>
53-
<li>New appraoch for current estimation for torque control using voltage - <a href="https://docs.simplefoc.com/voltage_torque_mode">see in docs </a>
54-
<ul dir="auto">
55-
<li>Support for motor KV rating - back emf estimation</li>
56-
<li>Using motor phase resistance</li>
57-
</ul>
58-
</li>
59-
<li>KV rating and phase resistance used for open-loop current limiting as well - <a href="https://docs.simplefoc.com/open_loop_motion_control">see in docs </a> </li>
60-
</ul>
61-
</blockquote>
62-
63-
## Arduino *SimpleFOClibrary* v2.2
34+
> FUTURE RELEASE : <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.2.3
35+
> - stm32 low-side current sensing
36+
> - g4 supported
37+
> - thoroughly tested f1/f4/g4
38+
> - bugfixing
39+
> - leonardo
40+
> - mega2560
41+
> - inline current sense without driver #188
42+
> - `initFOC` fails if current sense not initialised
43+
> - driver and cs have to be well initialised for `initFOC` to start
44+
> - `cs.init()` and `driver.init()` return `1` if well initialised and `0` if failed
45+
## Arduino *SimpleFOClibrary* v2.2.2
6446

6547
<p align="">
6648
<a href="https://youtu.be/Y5kLeqTc6Zk">
@@ -215,6 +197,34 @@ Here are some of the *Simple**FOC**library* and *Simple**FOC**Shield* applicatio
215197
</p>
216198

217199

200+
## Citing the *SimpleFOC*
201+
202+
We are very happy that *Simple**FOC**library* has been used as a component of several research project and has made its way to several scientific papers. We are hoping that this trend is going to continue as the project matures and becomes more robust!
203+
A short resume paper about *Simple**FOC*** has been published in the Journal of Open Source Software:
204+
<p>
205+
<b><i>SimpleFOC</i></b>: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors.<br>
206+
A. Skuric, HS. Bank, R. Unger, O. Williams, D. González-Reyes<br>
207+
Journal of Open Source Software, 7(74), 4232, https://doi.org/10.21105/joss.04232
208+
</p>
209+
210+
If you are interested in citing *Simple**FOC**library* or some other component of *Simple**FOC**project* in your research, we suggest you to cite our paper:
211+
212+
```bib
213+
@article{simplefoc2022,
214+
doi = {10.21105/joss.04232},
215+
url = {https://doi.org/10.21105/joss.04232},
216+
year = {2022},
217+
publisher = {The Open Journal},
218+
volume = {7},
219+
number = {74},
220+
pages = {4232},
221+
author = {Antun Skuric and Hasan Sinan Bank and Richard Unger and Owen Williams and David González-Reyes},
222+
title = {SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors},
223+
journal = {Journal of Open Source Software}
224+
}
225+
226+
```
227+
218228

219229
## Arduino FOC repo structure
220230
Branch | Description | Status

0 commit comments

Comments
 (0)