Skip to content

Commit c72f063

Browse files
authored
Merge pull request #425 from simplefoc/dev
Dev to master for the release v2.3.4
2 parents 463eb31 + 2de948c commit c72f063

File tree

117 files changed

+2963
-2602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2963
-2602
lines changed

.github/workflows/esp32.yml

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- esp32:esp32:esp32doit-devkit-v1 # esp32
2020
- esp32:esp32:esp32s2 # esp32s2
2121
- esp32:esp32:esp32s3 # esp32s3
22+
- esp32:esp32:esp32c3 # esp32c3
2223

2324
include:
2425

@@ -30,6 +31,10 @@ jobs:
3031
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3132
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino
3233

34+
- arduino-boards-fqbn: esp32:esp32:esp32c3 # esp32c3
35+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
36+
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, stepper_driver_2pwm_standalone.ino, stepper_driver_4pwm_standalone.ino
37+
3338
- arduino-boards-fqbn: esp32:esp32:esp32doit-devkit-v1 # esp32
3439
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
3540
sketch-names: esp32_position_control.ino, esp32_i2c_dual_bus_example.ino, esp32_current_control_low_side.ino, esp32_spi_alt_example.ino

README.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
![GitHub commits since tagged version](https://img.shields.io/github/commits-since/simplefoc/arduino-foc/latest/dev)
1414
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/simplefoc/arduino-foc/dev)
1515

16-
[![arduino-library-badge](https://ardubadge.simplefoc.com?lib=Simple%20FOC)](https://ardubadge.simplefoc.com?lib=Simple%20FOC)
16+
[![arduino-library-badge](https://ardubadge.simplefoc.com?lib=Simple%20FOC)](https://www.ardu-badge.com/badge/Simple%20FOC.svg)
17+
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/askuric/library/Simple%20FOC.svg)](https://registry.platformio.org/libraries/askuric/Simple%20FOC)
1718
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1819
[![status](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d/status.svg)](https://joss.theoj.org/papers/4382445f249e064e9f0a7f6c1bb06b1d)
1920

@@ -28,21 +29,27 @@ Therefore this is an attempt to:
2829
- For official driver boards see [<span class="simple">Simple<span class="foc">FOC</span>Boards</span>](https://docs.simplefoc.com/boards)
2930
- Many many more boards developed by the community members, see [<span class="simple">Simple<span class="foc">FOC</span>Community</span>](https://community.simplefoc.com/)
3031

31-
> NEW RELEASE 📢 : <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.3.3
32-
> - Teensy4
33-
> - support for low-side current sensing [#392](https://github.com/simplefoc/Arduino-FOC/pull/392)
34-
> - support for center aligned 6pwm and 3pwm (optional) [#392](https://github.com/simplefoc/Arduino-FOC/pull/392)
35-
> - stm32
36-
> - support for center aligned pwm (even across multiple timers and motors/drivers) [#374](https://github.com/simplefoc/Arduino-FOC/pull/374), [#388](https://github.com/simplefoc/Arduino-FOC/pull/388)
37-
> - support for DMA based low-side current sensing: [#383](https://github.com/simplefoc/Arduino-FOC/pull/383),[#378](https://github.com/simplefoc/Arduino-FOC/pull/378)
38-
> - support for f7 architecture [#388](https://github.com/simplefoc/Arduino-FOC/pull/388),[#394](https://github.com/simplefoc/Arduino-FOC/pull/394)
39-
> - KV rating calculation fix [#347](https://github.com/simplefoc/Arduino-FOC/pull/347)
40-
> - Much more performant Space Vector PWM calculation [#340](https://github.com/simplefoc/Arduino-FOC/pull/340)
41-
> - And much more:
42-
> - See the complete list of bugfixes and new features of v2.3.3 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/10?closed=1)
43-
44-
45-
## Arduino *SimpleFOClibrary* v2.3.3
32+
> NEXT RELEASE 📢 : <span class="simple">Simple<span class="foc">FOC</span>library</span> v2.3.4
33+
> - ESP32 MCUs extended support [#414](https://github.com/simplefoc/Arduino-FOC/pull/414)
34+
> - Transition to the arduino-esp32 version v3.x (ESP-IDF v5.x) [#387](https://github.com/espressif/arduino-esp32/releases)
35+
> - New support for MCPWM driver
36+
> - New support for LEDC drivers - center-aligned PWM and 6PWM available
37+
> - Rewritten and simplified the fast ADC driver code (`adcRead`) - for low-side and inline current sensing.
38+
> - Stepper motors current sensing support [#421](https://github.com/simplefoc/Arduino-FOC/pull/421)
39+
> - Support for current sensing (low-side and inline) - [see in docs](https://docs.simplefoc.com/current_sense)
40+
> - Support for true FOC control - `foc_current` torque control - [see in docs](https://docs.simplefoc.com/motion_control)
41+
> - New current sense alignment procedure [#422](https://github.com/simplefoc/Arduino-FOC/pull/422) - [see in docs](https://docs.simplefoc.com/current_sense_align)
42+
> - Support for steppers
43+
> - Much more robust and reliable
44+
> - More verbose and informative
45+
> - Support for HallSensors without interrupts [#424](https://docs.simplefoc.com/https://github.com/simplefoc/Arduino-FOC/pull/424) - [see in docs](hall_sensors)
46+
> - Docs
47+
> - A short guide to debugging of common issues
48+
> - A short guide to the units in the library - [see in docs](https://docs.simplefoc.com/library_units)
49+
> - See the complete list of bugfixes and new features of v2.3.4 [fixes and PRs](https://github.com/simplefoc/Arduino-FOC/milestone/11)
50+
51+
52+
## Arduino *SimpleFOClibrary* v2.3.4
4653

4754
<p align="">
4855
<a href="https://youtu.be/Y5kLeqTc6Zk">

examples/hardware_specific_examples/B_G431B_ESC1/B_G431B_ESC1.ino

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// Motor instance
88
BLDCMotor motor = BLDCMotor(11);
99
BLDCDriver6PWM driver = BLDCDriver6PWM(A_PHASE_UH, A_PHASE_UL, A_PHASE_VH, A_PHASE_VL, A_PHASE_WH, A_PHASE_WL);
10+
// Gain calculation shown at https://community.simplefoc.com/t/b-g431b-esc1-current-control/521/21
1011
LowsideCurrentSense currentSense = LowsideCurrentSense(0.003f, -64.0f/7.0f, A_OP1_OUT, A_OP2_OUT, A_OP3_OUT);
1112

1213

@@ -25,6 +26,12 @@ void doTarget(char* cmd) { command.motion(&motor, cmd); }
2526

2627
void setup() {
2728

29+
// use monitoring with serial
30+
Serial.begin(115200);
31+
// enable more verbose output for debugging
32+
// comment out if not needed
33+
SimpleFOCDebug::enable(&Serial);
34+
2835
// initialize encoder sensor hardware
2936
encoder.init();
3037
encoder.enableInterrupts(doA, doB);
@@ -75,9 +82,6 @@ void setup() {
7582
// maximal velocity of the position control
7683
motor.velocity_limit = 4;
7784

78-
79-
// use monitoring with serial
80-
Serial.begin(115200);
8185
// comment out if not needed
8286
motor.useMonitoring(Serial);
8387

@@ -107,4 +111,4 @@ void loop() {
107111

108112
// user communication
109113
command.run();
110-
}
114+
}

examples/hardware_specific_examples/Bluepill_examples/encoder/bluepill_position_control/bluepill_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialize encoder sensor hardware
3743
encoder.init();
3844
encoder.enableInterrupts(doA, doB, doI);
@@ -75,8 +81,6 @@ void setup() {
7581
motor.velocity_limit = 4;
7682

7783

78-
// use monitoring with serial
79-
Serial.begin(115200);
8084
// comment out if not needed
8185
motor.useMonitoring(Serial);
8286

examples/hardware_specific_examples/Bluepill_examples/magnetic_sensor/bluepill_position_control/bluepill_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3636

3737
void setup() {
3838

39+
// use monitoring with serial
40+
Serial.begin(115200);
41+
// enable more verbose output for debugging
42+
// comment out if not needed
43+
SimpleFOCDebug::enable(&Serial);
44+
3945
// initialise magnetic sensor hardware
4046
sensor.init();
4147
// link the motor to the sensor
@@ -72,8 +78,6 @@ void setup() {
7278
// maximal velocity of the position control
7379
motor.velocity_limit = 40;
7480

75-
// use monitoring with serial
76-
Serial.begin(115200);
7781
// comment out if not needed
7882
motor.useMonitoring(Serial);
7983

examples/hardware_specific_examples/DRV8302_driver/3pwm_example/encoder/full_control_serial/full_control_serial.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4343

4444
void setup() {
4545

46+
// use monitoring with serial
47+
Serial.begin(115200);
48+
// enable more verbose output for debugging
49+
// comment out if not needed
50+
SimpleFOCDebug::enable(&Serial);
51+
4652
// initialize encoder sensor hardware
4753
encoder.init();
4854
encoder.enableInterrupts(doA, doB);
@@ -90,9 +96,6 @@ void setup() {
9096
// angle loop velocity limit
9197
motor.velocity_limit = 50;
9298

93-
// use monitoring with serial for motor init
94-
// monitoring port
95-
Serial.begin(115200);
9699
// comment out if not needed
97100
motor.useMonitoring(Serial);
98101

examples/hardware_specific_examples/DRV8302_driver/6pwm_example/encoder/full_control_serial/full_control_serial.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
4646

4747
void setup() {
4848

49+
// use monitoring with serial
50+
Serial.begin(115200);
51+
// enable more verbose output for debugging
52+
// comment out if not needed
53+
SimpleFOCDebug::enable(&Serial);
54+
4955
// initialize encoder sensor hardware
5056
encoder.init();
5157
encoder.enableInterrupts(doA, doB);
@@ -91,9 +97,6 @@ void setup() {
9197
// angle loop velocity limit
9298
motor.velocity_limit = 50;
9399

94-
// use monitoring with serial for motor init
95-
// monitoring port
96-
Serial.begin(115200);
97100
// comment out if not needed
98101
motor.useMonitoring(Serial);
99102

examples/hardware_specific_examples/DRV8302_driver/esp32_current_control_low_side/esp32_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/stm32_current_control_low_side/stm32_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5151

5252
void setup() {
5353

54+
// use monitoring with serial
55+
Serial.begin(115200);
56+
// enable more verbose output for debugging
57+
// comment out if not needed
58+
SimpleFOCDebug::enable(&Serial);
59+
5460
// initialize encoder sensor hardware
5561
encoder.init();
5662
encoder.enableInterrupts(doA, doB);
@@ -115,10 +121,6 @@ void setup() {
115121
motor.voltage_limit = 12.0; // 12 Volt limit
116122
motor.current_limit = 2.0; // 2 Amp current limit
117123

118-
119-
// use monitoring with serial for motor init
120-
// monitoring port
121-
Serial.begin(115200);
122124
// comment out if not needed
123125
motor.useMonitoring(Serial);
124126
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/DRV8302_driver/teensy4_current_control_low_side/teensy4_current_control_low_side.ino

+6-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }
5454

5555
void setup() {
5656

57+
// use monitoring with serial
58+
Serial.begin(115200);
59+
// enable more verbose output for debugging
60+
// comment out if not needed
61+
SimpleFOCDebug::enable(&Serial);
62+
5763
// initialize encoder sensor hardware
5864
encoder.init();
5965
encoder.enableInterrupts(doA, doB);
@@ -116,10 +122,6 @@ void setup() {
116122
motor.voltage_limit = 12.0; // 12 Volt limit
117123
motor.current_limit = 2.0; // 2 Amp current limit
118124

119-
120-
// use monitoring with serial for motor init
121-
// monitoring port
122-
Serial.begin(115200);
123125
// comment out if not needed
124126
motor.useMonitoring(Serial);
125127
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q

examples/hardware_specific_examples/ESP32/encoder/esp32_position_control/esp32_position_control.ino

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
2424

2525
void setup() {
2626

27+
// use monitoring with serial
28+
Serial.begin(115200);
29+
// enable more verbose output for debugging
30+
// comment out if not needed
31+
SimpleFOCDebug::enable(&Serial);
32+
2733
// initialize encoder sensor hardware
2834
encoder.init();
2935
encoder.enableInterrupts(doA, doB);
@@ -66,9 +72,6 @@ void setup() {
6672
// maximal velocity of the position control
6773
motor.velocity_limit = 4;
6874

69-
70-
// use monitoring with serial
71-
Serial.begin(115200);
7275
// comment out if not needed
7376
motor.useMonitoring(Serial);
7477

examples/hardware_specific_examples/ESP32/magnetic_sensor/esp32_position_control/esp32_position_control.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
3333

3434
void setup() {
3535

36+
// use monitoring with serial
37+
Serial.begin(115200);
38+
// enable more verbose output for debugging
39+
// comment out if not needed
40+
SimpleFOCDebug::enable(&Serial);
41+
3642
// initialise magnetic sensor hardware
3743
sensor.init();
3844
// link the motor to the sensor
@@ -69,8 +75,6 @@ void setup() {
6975
// maximal velocity of the position control
7076
motor.velocity_limit = 40;
7177

72-
// use monitoring with serial
73-
Serial.begin(115200);
7478
// comment out if not needed
7579
motor.useMonitoring(Serial);
7680

examples/hardware_specific_examples/HMBGC_example/position_control/position_control.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }
4242

4343
void setup() {
4444

45+
// use monitoring with serial
46+
Serial.begin(115200);
47+
4548
// initialise encoder hardware
4649
encoder.init();
4750
// interrupt initialization
@@ -85,9 +88,6 @@ void setup() {
8588
// maximal velocity of the position control
8689
motor.velocity_limit = 4;
8790

88-
89-
// use monitoring with serial
90-
Serial.begin(115200);
9191
// comment out if not needed
9292
motor.useMonitoring(Serial);
9393

examples/hardware_specific_examples/Odrive_examples/odrive_example_encoder/odrive_example_encoder.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ void doI(){encoder.handleIndex();}
7070

7171
void setup(){
7272

73+
// use monitoring with serial
74+
Serial.begin(115200);
75+
// enable more verbose output for debugging
76+
// comment out if not needed
77+
SimpleFOCDebug::enable(&Serial);
78+
7379
// pwm frequency to be used [Hz]
7480
driver.pwm_frequency = 20000;
7581
// power supply voltage [V]
@@ -96,8 +102,6 @@ void setup(){
96102
// alignment voltage limit
97103
motor.voltage_sensor_align = 0.5;
98104

99-
100-
Serial.begin(115200);
101105
// comment out if not needed
102106
motor.useMonitoring(Serial);
103107
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;

examples/hardware_specific_examples/Odrive_examples/odrive_example_spi/odrive_example_spi.ino

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ SPIClass SPI_3(SPI3_MOSO, SPI3_MISO, SPI3_SCL);
6969

7070
void setup(){
7171

72+
// use monitoring with serial
73+
Serial.begin(115200);
74+
// enable more verbose output for debugging
75+
// comment out if not needed
76+
SimpleFOCDebug::enable(&Serial);
77+
7278
// pwm frequency to be used [Hz]
7379
driver.pwm_frequency = 20000;
7480
// power supply voltage [V]
@@ -94,8 +100,6 @@ void setup(){
94100
// alignment voltage limit
95101
motor.voltage_sensor_align = 0.5;
96102

97-
98-
Serial.begin(115200);
99103
// comment out if not needed
100104
motor.useMonitoring(Serial);
101105
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;

examples/hardware_specific_examples/SAMD_examples/nano33IoT/nano33IoT_velocity_control/nano33IoT_velocity_control.ino

+5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
2323

2424

2525
void setup() {
26+
// use monitoring with serial
2627
Serial.begin(115200);
28+
// enable more verbose output for debugging
29+
// comment out if not needed
30+
SimpleFOCDebug::enable(&Serial);
31+
2732
delay(1000);
2833
Serial.println("Initializing...");
2934

0 commit comments

Comments
 (0)