Skip to content

Commit e0a1810

Browse files
author
askuric
committed
added better inital code page + commander updated + suggested PWM form 50 to 20khz
1 parent 4ff807b commit e0a1810

File tree

11 files changed

+379
-88
lines changed

11 files changed

+379
-88
lines changed

docs/simplefoc_library/code/communication/commander/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,18 @@ Commander provides a very simple way to extend the command list and implement ne
245245
- [Custom commands](commander_custom) - create your own callbacks
246246

247247

248+
## Commander with Serial Monitor in Arudino IDE
249+
250+
251+
Once the commander interface is added to the code you will be able to communicate to it using the Serial Monitor of the Arduino IDE
252+
253+
<img src="extras/Images/commander.png">
254+
255+
Commander paramters in the serial monitor are the same as for every other Arduino code working with the `Serial`.
256+
Make sure to:
257+
- Set the baudrate number the same as in the `ino` file : for examle if in the `ino` file you have `Serial.begin(115200)`, the baud rate should be `115200`
258+
- Make sure to set the termination character to `newline`
259+
248260
## *Simple**FOC**Studio* by [@JorgeMaker](https://github.com/JorgeMaker)
249261

250262
SimpleFOCStudio is an awesome application built by [@JorgeMaker](https://github.com/JorgeMaker) which we will try to keep up to date with out library. It is a python application that uses commander interface for tunning and configuring the motor.

docs/simplefoc_library/code/communication/commander/motor.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ When using a standard callback for `BLDCMotor` and `StepperMotor` classes:`comma
2929
- **C** - Current
3030
- **U** - Voltage
3131
- **V** - Velocity
32-
- **R** - Motor phase resistance
32+
- **R** - Motor phase resistance
33+
- **K** - Motor KV rating
3334
- **S** - Sensor offsets
3435
- **M** - sensor offset
3536
- **E** - sensor electrical zero
@@ -70,10 +71,10 @@ For example if you have a BLDC motor added to the `commander`:
7071
BLDCMotor motor = ....
7172
Commander commander = ...
7273

73-
void onTarget(char* cmd){ commander.target(&motor,cmd); }
74+
void onMotor(char* cmd){ commander.motor(&motor,cmd); }
7475
void setup(){
7576
...
76-
commander.add('M',onTarget,"my motor motion");
77+
commander.add('M',onMotor,"my motor motion");
7778
...
7879
}
7980
void loop(){

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can also always ask the community for help - <a href="https://community.simp
6161
// pwm frequency to be used [Hz]
6262
// for atmega328 fixed to 32kHz
6363
// esp32/stm32/teensy configurable
64-
driver.pwm_frequency = 50000;
64+
driver.pwm_frequency = 20000;
6565
```
6666
<blockquote class="warning">
6767
⚠️ Arduino devices based on ATMega328 chips have fixed pwm frequency of 32kHz.
@@ -142,7 +142,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
142142
void setup() {
143143

144144
// pwm frequency to be used [Hz]
145-
driver.pwm_frequency = 50000;
145+
driver.pwm_frequency = 20000;
146146
// power supply voltage [V]
147147
driver.voltage_power_supply = 12;
148148
// Max DC voltage allowed - default voltage_power_supply
@@ -175,7 +175,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 11, 8, 7, 6);
175175
void setup() {
176176

177177
// pwm frequency to be used [Hz]
178-
driver.pwm_frequency = 50000;
178+
driver.pwm_frequency = 20000;
179179
// power supply voltage [V]
180180
driver.voltage_power_supply = 12;
181181
// Max DC voltage allowed - default voltage_power_supply

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ You can also always ask the community for help - <a href="https://community.simp
114114
// pwm frequency to be used [Hz]
115115
// for atmega328 fixed to 32kHz
116116
// esp32/stm32/teensy configurable
117-
driver.pwm_frequency = 50000;
117+
driver.pwm_frequency = 20000;
118118
```
119119
<blockquote class="warning">
120120
⚠️ Arduino devices based on ATMega328 chips have fixed pwm frequency of 32kHz.
@@ -209,7 +209,7 @@ BLDCDriver6PWM driver = BLDCDriver6PWM(5, 6, 9,10, 3, 11, 8);
209209
void setup() {
210210

211211
// pwm frequency to be used [Hz]
212-
driver.pwm_frequency = 50000;
212+
driver.pwm_frequency = 20000;
213213
// power supply voltage [V]
214214
driver.voltage_power_supply = 12;
215215
// Max DC voltage allowed - default voltage_power_supply

docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_2pwm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ StepperDriver2PWM driver = StepperDriver2PWM(3, 4, 5, 6, 11, 12);
5858
// pwm frequency to be used [Hz]
5959
// for atmega328 fixed to 32kHz
6060
// esp32/stm32/teensy configurable
61-
driver.pwm_frequency = 50000;
61+
driver.pwm_frequency = 20000;
6262
```
6363
<blockquote class="warning">
6464
⚠️ Arduino devices based on ATMega328 chips have fixed pwm frequency of 32kHz.

docs/simplefoc_library/code/drivers/stepper_driver/stepper_driver_4pwm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ StepperDriver4PWM driver = StepperDriver4PWM(5, 6, 9, 10, 7, 8);
3636
// pwm frequency to be used [Hz]
3737
// for atmega328 fixed to 32kHz
3838
// esp32/stm32/teensy configurable
39-
driver.pwm_frequency = 50000;
39+
driver.pwm_frequency = 20000;
4040
```
4141
<blockquote class="warning">
4242
⚠️ Arduino devices based on ATMega328 chips have fixed pwm frequency of 32kHz.
@@ -100,7 +100,7 @@ StepperDriver4PWM driver = StepperDriver4PWM(5, 6, 9,10, 7, 8);
100100
void setup() {
101101

102102
// pwm frequency to be used [Hz]
103-
driver.pwm_frequency = 50000;
103+
driver.pwm_frequency = 20000;
104104
// power supply voltage [V]
105105
driver.voltage_power_supply = 12;
106106
// Max DC voltage allowed - default voltage_power_supply

docs/simplefoc_library/code/from_scratch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
6262

6363
void setup() {
6464
// pwm frequency to be used [Hz]
65-
driver.pwm_frequency = 50000;
65+
driver.pwm_frequency = 20000;
6666
// power supply voltage [V]
6767
driver.voltage_power_supply = 12;
6868
// Max DC voltage allowed - default voltage_power_supply

0 commit comments

Comments
 (0)