Skip to content

Commit 92fd0a6

Browse files
committed
next release preparation
1 parent 37f2a6b commit 92fd0a6

29 files changed

+946
-25
lines changed

docs/simplefoc_library/code/current_sense/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ stm32f1 family | ✔️ | ✔️ (one motor) | ❌
5252
stm32f4 family | ✔️ | ✔️ (one motor) | ❌
5353
stm32g4 family | ✔️ | ✔️ (one motor) | ❌
5454
stm32l4 family | ✔️ | ✔️ (one motor) | ❌
55-
stm32f7 family | ✔️ | ✔️ (initial) | ❌
55+
stm32f7 family | ✔️ | ✔️ (one motor) | ❌
56+
stm32h7 family | ✔️ | ✔️ (one motor) | ❌
5657
stm32 B_G431B_ESC1 | ❌ | ✔️ (one motor) | ❌
5758
esp32/esp32s3 | ✔️ | ✔️ | ❌
5859
esp32s2/esp32c3 | ✔️ | ❌ | ❌

docs/simplefoc_library/code/current_sense/low_side.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ Low side current sensing for all the architectures is on our road-map and we are
2121
<a href ="javascript:show('stepper','type');" id="btn-stepper" class="btn btn-type btn-stepper"> Stepper motors</a>
2222

2323
<p class="type type-bldc" ><img src="extras/Images/low-side.png" class="width50"></p>
24-
<p class="type type-stepper hide" ><img src="extras/Images/lowside_stepper.png" class="width60"></p>
24+
<div class="type type-stepper hide" >
25+
26+
<img src="extras/Images/lowside_stepper.png" class="width60">
27+
28+
<blockquote class="info">
29+
<p class="heading">Other topologies for low-side current sensing for Steppers</p>
30+
See the link <a href="https://community.simplefoc.com/t/low-side-current-sensing-for-stepper-motors/7235">Low-side current sensing for stepper motors</a> in the community forum for more information about other topologies for low-side current sensing for stepper motors.
31+
</blockquote>
32+
</div>
2533

2634

2735
<blockquote class="info" markdown="1">
@@ -44,6 +52,7 @@ STM32f4 family | ✔️ (one motor) | DMA| ~25kHz| all
4452
STM32g4 family | ✔️ (one motor) | DMA| ~25kHz| all
4553
STM32l4 family | ✔️ (one motor) | DMA| ~25kHz| all
4654
STM32f7 family | ✔️ (one motor) | DMA| ~25kHz | all
55+
STM32h7 family | ✔️ (one motor) | DMA| ~25kHz | all
4756
STM32 B_G431B_ESC1 | ✔️ | DMA| ~25kHz| all
4857
ESP32 with MCPWM |✔️ | Interrupts| ~20kHz| all
4958
ESP32 with LEDC | ❌ | -| -| -

docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_3pwm.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,26 @@ Examples:
2323
- X-NUCLEO-IHM07M1
2424
- etc.
2525

26+
<a href="javascript:show('bldc','motor');" class="btn btn-bldc btn-motor btn-primary">BLDCMotor</a>
27+
<a href="javascript:show('stepper','motor');" class="btn btn-stepper btn-motor">HybridStepperMotor</a>
2628

29+
30+
31+
<div class="motor motor-bldc" markdown="1">
2732
<img src="extras/Images/3pwm_driver.png" class="width40">
33+
</div>
34+
35+
<div class="motor motor-stepper hide" markdown="1">
36+
<img src="extras/Images/hybrid_3pwm.jpg" class="width40">
37+
38+
<blockquote class="warning" markdown="1">
39+
⚠️ **Note:** When using the 3PWM BLDC driver with a stepper motor, ensure that the common phase `Uo` is connected to the driver's C phase pin.
40+
</blockquote>
41+
42+
</div>
43+
44+
45+
2846

2947

3048
## Step 1. Hardware setup
@@ -46,6 +64,39 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11, 8, 7, 6);
4664

4765
<blockquote class="info"> 📢 Here is a quick guide to choosing appropriate PWM pins for different MCU architectures <a href="choosing_pwm_pins">see in docs</a>.</blockquote>
4866

67+
<blockquote class="warning" markdown="1">
68+
<p class="heading">⚠️ <b>Note:</b> When using the 3PWM BLDC driver with a stepper motor, ensure that the common phase `Uo` is connected to the driver's C phase pin.</p>
69+
70+
Even if the common phase `Uo` is physically connected to some other driver output (`A` or `B`), please provide it as the `C` phase pin in the driver constructor. This is important for the correct operation of the stepper motor.
71+
72+
Consider an example of the driver connected to the MCU pins as follows:
73+
74+
```cpp
75+
#define PIN_A 9
76+
#define PIN_B 10
77+
#define PIN_C 11
78+
#define ENABLE 8
79+
```
80+
81+
If the common phase `Uo` is connected to the driver pin `A`, you should still provide it as the `C` phase pin in the driver constructor:
82+
```cpp
83+
// common phase `Uo` connected to driver pin `A` so it is provided as the `C` phase pin
84+
BLDCDriver3PWM driver = BLDCDriver3PWM(PIN_C, PIN_B, PIN_A, ENABLE);
85+
```
86+
87+
If the common phase `Uo` is connected to the driver pin `B`, you should provide it as the `C` phase pin in the driver constructor:
88+
```cpp
89+
// common phase `Uo` connected to driver pin `B` so it is provided as the `C` phase pin
90+
BLDCDriver3PWM driver = BLDCDriver3PWM(PIN_A, PIN_C, PIN_B, ENABLE);
91+
```
92+
93+
Or if the common phase `Uo` is connected to the driver pin `C`, you should provide it as the `C` phase pin in the driver constructor:
94+
```cpp
95+
// common phase `Uo` connected to driver pin `C` so it is provided as the `C` phase pin
96+
BLDCDriver3PWM driver = BLDCDriver3PWM(PIN_A, PIN_B, PIN_C, ENABLE);
97+
```
98+
</blockquote>
99+
49100
### Low-side current sensing considerations
50101

51102
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.
@@ -105,7 +156,16 @@ driver.voltage_power_supply = 12;
105156
driver.voltage_limit = 12;
106157
```
107158

159+
<a href="javascript:show('bldc','motor');" class="btn btn-bldc btn-motor btn-primary">BLDCMotor</a>
160+
<a href="javascript:show('stepper','motor');" class="btn btn-stepper btn-motor">HybridStepperMotor</a>
161+
162+
<div class="motor motor-bldc" markdown="1">
163+
108164
<img src="extras/Images/limits.png" class="width60">
165+
</div>
166+
<div class="motor motor-stepper hide" markdown="1">
167+
<img src="extras/Images/hybrid_limits.jpg" class="width60">
168+
</div>
109169

110170
This parameter is used by the `BLDCMotor` class as well. As shown on the figure above the once the voltage limit `driver.voltage_limit` is set, it will be communicated to the FOC algorithm in `BLDCMotor` class and the phase voltages will be centered around the `driver.voltage_limit/2`.
111171

docs/simplefoc_library/code/drivers/bldc_driver/bldc_driver_6pwm.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,22 @@ Examples:
2121
- ODrive 3.6
2222
- etc.
2323

24+
<a href="javascript:show('bldc','motor');" class="btn btn-bldc btn-motor btn-primary">BLDCMotor</a>
25+
<a href="javascript:show('stepper','motor');" class="btn btn-stepper btn-motor">HybridStepperMotor</a>
2426

27+
<div class="motor motor-bldc" markdown="1">
2528
<img src="extras/Images/6pwm_driver.png" class="width40">
29+
</div>
30+
31+
<div class="motor motor-stepper hide" markdown="1">
32+
<img src="extras/Images/hybrid_6pwm.jpg" class="width40">
33+
34+
35+
<blockquote class="warning" markdown="1">
36+
⚠️ **Note:** When using the 3PWM BLDC driver with a stepper motor, ensure that the common phase `Uo` is connected to the driver's C phase pin.
37+
</blockquote>
38+
39+
</div>
2640

2741
6 PWM control mode gives much more freedom for BLDC motor control than 3PWM control since each of the 6 half-bride mosfets can be controlled separately.
2842

@@ -42,6 +56,43 @@ BLDCDriver6PWM driver = BLDCDriver6PWM(5,6, 9,10, 3,11, 8);
4256

4357
<blockquote class="info"> 📢 Here is a quick guide to choosing appropriate PWM pins for different MCU architectures <a href="choosing_pwm_pins">see in docs</a>.</blockquote>
4458

59+
60+
<blockquote class="warning" markdown="1">
61+
<p class="heading">⚠️ <b>Note:</b> When using the 6PWM BLDC driver with a stepper motor, ensure that the common phase `Uo` is connected to the driver's C phase pin.</p>
62+
63+
Even if the common phase `Uo` is physically connected to some other driver output (`A` or `B`), please provide it as the `C` phase pin in the driver constructor. This is important for the correct operation of the stepper motor.
64+
65+
Consider an example of the driver connected to the MCU pins as follows:
66+
67+
```cpp
68+
#define PIN_A_H 9
69+
#define PIN_A_L 10
70+
#define PIN_B_H 11
71+
#define PIN_B_L 12
72+
#define PIN_C_H 13
73+
#define PIN_C_L 14
74+
#define ENABLE 8
75+
```
76+
77+
If the common phase `Uo` is connected to the driver pin `A`, you should still provide it as the `C` phase pin in the driver constructor:
78+
```cpp
79+
// common phase `Uo` connected to driver pin `A` so it is provided as the `C` phase pin
80+
BLDCDriver6PWM driver = BLDCDriver6PWM(PIN_C_H, PIN_C_L, PIN_B_H, PIN_B_L, PIN_A_H, PIN_A_L, ENABLE);
81+
```
82+
83+
If the common phase `Uo` is connected to the driver pin `B`, you should provide it as the `C` phase pin in the driver constructor:
84+
```cpp
85+
// common phase `Uo` connected to driver pin `B` so it is provided as the `C` phase pin
86+
BLDCDriver6PWM driver = BLDCDriver6PWM(PIN_A_H, PIN_A_L, PIN_C_H, PIN_C_L, PIN_B_H, PIN_B_L, ENABLE);
87+
```
88+
89+
Or if the common phase `Uo` is connected to the driver pin `C`, you should provide it as the `C` phase pin in the driver constructor:
90+
```cpp
91+
// common phase `Uo` connected to driver pin `C` so it is provided as the `C` phase pin
92+
BLDCDriver6PWM driver = BLDCDriver6PWM(PIN_A_H, PIN_A_L, PIN_B_H, PIN_B_L, PIN_C_H, PIN_C_L, ENABLE);
93+
```
94+
</blockquote>
95+
4596
### Arduino UNO support
4697
Arduino UNO and all the atmega328 based boards have only 6 PWM pins and in order to use the `BLDCDrievr6PWM` we need to use all of them. Those are `3`,`5`,`6`,`9`,`10` and `11`.
4798
Furthermore in order for the algorithm to work well we need to use the PWM pins that belong to the same timer for each high/low side pair of each phase.
@@ -174,7 +225,16 @@ driver.voltage_power_supply = 12;
174225
driver.voltage_limit = 12;
175226
```
176227

228+
<a href="javascript:show('bldc','motor');" class="btn btn-bldc btn-motor btn-primary">BLDCMotor</a>
229+
<a href="javascript:show('stepper','motor');" class="btn btn-stepper btn-motor">HybridStepperMotor</a>
230+
231+
<div class="motor motor-bldc" markdown="1">
232+
177233
<img src="extras/Images/limits.png" class="width60">
234+
</div>
235+
<div class="motor motor-stepper hide" markdown="1">
236+
<img src="extras/Images/hybrid_limits.jpg" class="width60">
237+
</div>
178238

179239
This parameter is used by the `BLDCMotor` class as well. As shown on the figure above the once the voltage limit `driver.voltage_limit` is set, it will be communicated to the FOC algorithm in `BLDCMotor` class and the phase voltages will be centered around the `driver.voltage_limit/2`.
180240

docs/simplefoc_library/code/drivers/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ has_toc: False
1717

1818
Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span> supports BLDC and stepper motor drivers:
1919

20-
- [BLDC driver <i class="fa fa-external-link"></i>](bldcdriver)
20+
- [BLDC driver <i class="fa fa-external-link"></i>](bldcdriver) (BLDC or Hybrid stepper motors)
2121
- **3 PWM signals** ( 3 phase ) - `BLDCDriver3PWM`
2222
- **6 PWM signals** ( 3 phase ) - `BLDCDriver6PWM`
23-
- [Stepper drivers <i class="fa fa-external-link"></i>](stepperdriver)
23+
- [Stepper drivers <i class="fa fa-external-link"></i>](stepperdriver) (Stepper motors)
2424
- **4 PWM signals** ( 2 phase ) - `StepperDriver4PWM`
2525
- **2 PWM signals** ( 2 phase ) - `StepperDriver2PWM`
2626

docs/simplefoc_library/code/index.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,12 @@ For full documentation of the setup and all configuration parameters please visi
316316

317317

318318
## Step 4. <a href="motors_config" class="remove_dec"> Motor setup </a>
319-
After the position sensor and the driver we proceed to initializing and configuring the motor. The library supports BLDC motors handled by the `BLDCMotor` class as well as stepper motors handled by the `StepperMotor` class. Both classes are instantiated by providing just the `pole_pairs` number of the motor and optionally the motors´ phase resistance and the KV rating.
319+
After the position sensor and the driver we proceed to initializing and configuring the motor. The library supports BLDC motors handled by the `BLDCMotor` class as well as stepper motors handled by the `StepperMotor` and `HybridStepperMotor` classes. Both classes are instantiated by providing just the `pole_pairs` number of the motor and optionally the motors' phase resistance and the KV rating.
320320

321321

322322
<a href="javascript:show('0m','motor');" id="btn-0m" class="btn-motor btn btn-primary">BLDC motor</a>
323323
<a href ="javascript:show('1m','motor');" id="btn-1m" class="btn-motor btn">Stepper motor</a>
324+
<a href ="javascript:show('2m','motor');" id="btn-2m" class="btn-motor btn">HybridStepper motor</a>
324325

325326

326327
<div class="motor motor-0m" markdown="1" style="display:block">
@@ -386,12 +387,60 @@ void setup() {
386387
// init driver
387388
// link the motor to the driver
388389
motor.linkDriver(&driver);
390+
// link driver and the current sense
391+
392+
// link the motor to current sense
393+
motor.linkCurrentSense(&current_sese);
394+
395+
// set control loop type to be used
396+
motor.controller = MotionControlType::velocity;
397+
// initialize motor
398+
motor.init();
399+
400+
// init current sense
401+
402+
}
403+
404+
void loop() {
405+
406+
}
407+
```
408+
</div>
409+
410+
411+
<div class="motor motor-2m" markdown="1" style="display:none">
412+
413+
In this example we will use HybridStepper motor (Stepper motor coupled with a BLDC driver):
414+
```cpp
415+
#include <SimpleFOC.h>
416+
417+
// HybridStepperMotor( int pole_pairs , (phase_resistance, KV_rating optional))
418+
HybridStepperMotor motor = HybridStepperMotor(50);
419+
420+
// instantiate driver
421+
// instantiate sensor
422+
// instantiate current sensor
423+
424+
void setup() {
425+
// init sensor
426+
// link the motor to the sensor
427+
motor.linkSensor(&sensor);
428+
429+
// init driver
430+
// link the motor to the driver
431+
motor.linkDriver(&driver);
432+
// link driver and the current sense
389433

434+
// link the motor to current sense
435+
motor.linkCurrentSense(&current_sese);
436+
390437
// set control loop type to be used
391438
motor.controller = MotionControlType::velocity;
392439
// initialize motor
393440
motor.init();
394441

442+
// init current sense
443+
395444
}
396445

397446
void loop() {

docs/simplefoc_library/code/motors/bldc_motors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: default
3-
title: BLDCMotor
3+
title: BLDC Motors
44
nav_order: 1
55
permalink: /bldcmotor
66
parent: Motor code

docs/simplefoc_library/code/motors/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span> su
2121
- 3 phase (3 wire):
2222
- Gimbal and High-performance BLDC motors
2323
- [Stepper motors <i class="fa fa-external-link"></i>](steppermotor)
24-
- 2 phase (4 wire)
25-
24+
- StepperMotor: 2 phase (4 wire)
25+
- 📢 NEW: HybridStepperMotor: 2 phase (3 wire)
2626

2727
The motor code is written in a way to support as many different motors out there as possible and in a way to be fully interchangeable.
2828

0 commit comments

Comments
 (0)