Skip to content

Commit 4a97baf

Browse files
authored
Merge pull request #40 from simplefoc/next
Next v2.3.5
2 parents 37f2a6b + b446efe commit 4a97baf

32 files changed

+1108
-50
lines changed

docs/boards/index.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ There two main formats of the official drivers boards developed by the <span cla
1818

1919
- <span class="simple">Shield</span> form factor: These boards are designed to be compatible with the Arduino ecosystem and are intended to be used with the <span class="simple">Simple<span class="foc">FOC</span>library</span> and the Arduino IDE. They are designed to be easy to use and are intended for low to mid power applications.
2020
- <span class="simple">Simple<span class="foc">FOC</span>Shield</span> - <small>[Find out more](arduino_simplefoc_shield_showcase)</small>
21-
- <span class="simple">Simple<span class="foc">FOC</span> <b>Power</b>Shield</span> - <small>⚠️<i>( development abandoned )</i></small> - <small>[Find out more](#arduino-simplefoc-powershield-v02-️-development-abandoned-)</small>
21+
- <span class="simple">Simple<span class="foc">FOC</span> <b>Power</b>Shield</span> - <small>⚠️<i>( development abandoned )</i></small> - <small>[Find out more](#simplefoc-powershield-v02-️-development-abandoned-)</small>
22+
- 📢**NEW**: <span class="simple">Simple<span class="foc">FOC</span><b>Drive</b></span> - <small>[Find out more](boards#simplefoc-drive-v10---find-out-more)</small>
2223

2324
- <span class="simple">Mini</span> form factor: These boards are designed to be small, low-cost, and easy to use. They are intended for low power applications and are designed to be compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>.
2425
- <span class="simple">Simple<span class="foc">FOC</span>Mini</span> - <small>[Find out more](simplefocmini)</small>
25-
- <span class="simple">Simple<span class="foc">FOC</span> <b>Step</b>Mini</span> (📢**NEW**) - <small> [Find out more](#simplefoc-stepmini-v10---see-on-github)
26+
- <span class="simple">Simple<span class="foc">FOC</span> <b>Step</b>Mini</span> - <small> [Find out more](#simplefoc-stepmini-v10---see-on-github)
2627

2728

2829
In addition to the official boards, there are many other boards compatible with <span class="simple">Simple<span class="foc">FOC</span>library</span> that you can explore, see the [docs](supported_hardware). Additionally, some other cool hardware designs have been proposed by the community. Check out our [community forum](https://community.simplefoc.com/) for more info.
@@ -111,6 +112,39 @@ This does not mean that the board itself is not functional or that it will not w
111112

112113
Read more about this board at [link](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield)
113114

115+
### <span class="simple">Simple<span class="foc">FOC</span> <b>Drive</b></span> <small>v1.0</small> - <small>[Find out more](https://github.com/simplefoc/SimpleFOC-DriveShield)</small>
116+
117+
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?color=blue)
118+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/simplefoc/SimpleFOC-DriveShield)
119+
![GitHub Release Date](https://img.shields.io/github/release-date/simplefoc/SimpleFOC-DriveShield?color=blue)
120+
121+
<div class="width40">
122+
<img src="https://raw.githubusercontent.com/simplefoc/SimpleFOC-DriveShield/refs/heads/main/images/top.jpg" />
123+
</div>
124+
125+
This is an open-source low-cost BLDC driver boards in the form of a Arduino shield. It is a part of the SimpleFOC project. The board is the big brother of the SimpleFOCShield and is designed to drive motors with higher current requirements, up to 30Amps. The board is created with the same philosophy as the SimpleFOCShield - to be simple to use, low-cost, and open-source and fully compatible with the SimpleFOClibrary.
126+
127+
Additionally the aim of the board is to serve as a template project for the community to build their own motor drivers.
128+
129+
- The board is relatively simple and can be easily modified to fit different requirements.
130+
- The board is designed in EasyEDA and all the fabrication files are available for download
131+
132+
### Features
133+
{: .no_toc }
134+
135+
- **Boards absolute max ratings**
136+
- Max current: 20A continuous (peak 30A - measured)
137+
- Max input voltage: 30V
138+
- **Stackable**: running 2 motors in the same time
139+
- **Encoder/Hall sensors interface**: Integrated 3.3kΩ pullups (configurable)
140+
- **I2C interface**: Integrated 4.7kΩ pullups (configurable)
141+
- **Configurable pinout**: Hardware configuration - soldering connections
142+
- **Arduino headers**: Arduino UNO, Arduino MEGA, STM32 Nucleo boards...
143+
- **Open Source**:
144+
- Fully designed in EasyEDA: [EasyEDA project](https://oshwlab.com/the.skuric/SimpleFOC-Drive)
145+
- Fully available on github: [GitHub project](https://github.com/simplefoc/SimpleFOC-DriveShield)
146+
- **Low-cost**: Estimated price of 25-40€ - Will be available in the SimpleFOC shop
147+
114148

115149
## Boards in the <span class="simple">Mini</span> form factor
116150

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() {

0 commit comments

Comments
 (0)