You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span>'s main objective is to provide an efficient low level motion motor control for BLDC and stepper motors.
In the context of the <spanclass="simple">Simple<spanclass="foc">FOC</span>project</span> many different open-source community projects have been developed.
This library contains an assortment of drivers and supporting code for <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span>.
21
+
22
+
23
+
The intent is to keep the core of <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> clean, and thus easy to maintain, understand and port to different platforms. In addition to this core, there are various drivers and supporting code which has grown around <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span>, and which we would like to make available to the community. [Read more ...](drivers_library)
<spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> is really intended for field oriented control of PMSM/BLDC motors, it's in the name ;-). But for different reasons, sometimes DC motors are preferred, and while we're not focused on this use-case, we do have a fair amount of code that can be leveraged to help with DC-Motor control applications.
30
+
31
+
32
+
So this represents a less-supported effort to provide some useful building blocks for DC-Motors.
-### <spanclass="simple">Simple<spanclass="foc">FOC</span>Studio</span> by [@jorgemaker](https://github.com/JorgeMaker)
40
+
41
+
Graphical user interface for the <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> based on python3 and PyQt5. This application allows to tune and configure any BLDC/Stepper <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> controlled device, using serial port communications and the [Commander](commander_interface) interface. [Read more ... ](studio)
-### <spanclass="simple">Simple<spanclass="foc">FOC</span>Generator</span> by [@stijnsprojects](https://github.com/stijnsprojects)
46
+
47
+
A web application which helps you generate <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> arduino sketches based on the hardware that you are using.
-### <spanclass="simple">Simple<spanclass="foc">FOC</span>webcontroller</span> by [@geekuillaume](https://github.com/geekuillaume)
52
+
53
+
This is a controller interface for the <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span>. It uses WebSerial to communicate with a suitable micro-controller using serial port communications and the [Commander](commander_interface) interface.
There are three different ways to control the torque of your motor using voltage requiring different knowledge about your motor mechanical parameters:
22
22
-[Pure voltage control](#pure-voltage-control) - no motor parameters needed
23
-
-[Estimated current control](#voltage-control-with-current-estimation) - phase resistance required
24
-
-[Estimated current control with Back-EMF compensation](#voltage-control-with-current-estimation-and-back-emf-compensation) - required phase resistance and KV rating of the motor
23
+
-[Estimated current control](#voltage-control-with-current-estimation) - phase resistance $$R$$ required
24
+
-[Estimated current control with Back-EMF compensation](#voltage-control-with-current-estimation-and-back-emf-compensation) - required phase resistance $$R$$ and $$KV$$ rating of the motor
25
+
-[Estimated current control with Back-EMF and lag compensation](#voltage-control-with-current-estimation-and-back-emf-compensation) - required phase resistance $$R$$, inductance $$L$$ and $$KV$$ rating of the motor
25
26
26
27
Block diagrams of the three torque control techniques based on voltage control can be represented as:
27
28
<scripttype="text/javascript">
@@ -36,16 +37,18 @@ Block diagrams of the three torque control techniques based on voltage control c
The voltage control algorithm reads the angle $$a$$ from the position sensor and the gets target $$U_q$$ voltage value from the user and using the FOC algorithm sets the appropriate $$u_a$$, $$u_b$$ and $$u_c$$ voltages to the motor. FOC algorithm ensures that these voltages generate the magnetic force in the motor rotor exactly with <i>90 degree</i> offset from its permanent magnetic field, which guarantees maximal torque, this is called commutation.
51
54
@@ -72,7 +75,7 @@ If you set a certain desired voltage $$U_g$$ your motor should start moving and
72
75
73
76
Block diagram of this torque control strategy is as follows
If the user provides the phase resistance $$R$$ value of the motor, the user can set the desired current $$I_d$$ (that generates the desired torque $$I_d = k\tau_d$$) and the library will automatically calculate the appropriate voltage $$U_q$$.
78
81
@@ -114,7 +117,7 @@ If your desired current is set to some value that is not 0, but your motor does
114
117
115
118
Block diagram of this torque control strategy is as follows
If the user provides the phase resistance $$R$$ value and the motor's $$KV$$ rating of the motor, the user can set the desired current $$I_d$$ (that generates the desired torque $$I_d = k\tau_d$$) directly. The library will automatically calculate the appropriate voltage $$U_q$$ while compensating for the generated Back EMF voltage by keeping track of the motor velocity $$v$$.
120
123
@@ -165,6 +168,73 @@ If your desired current is set to some value that is not 0, but your motor does
165
168
166
169
167
170
171
+
## Voltage control using current estimation with Back-EMF and lag compensation
172
+
173
+
Block diagram of this torque control strategy is as follows
If the user provides the phase resistance $$R$$ value and the motor's $$KV$$ rating of the motor, the user can set the desired current $$I_d$$ (that generates the desired torque $$I_d = k\tau_d$$) directly. The library will automatically calculate the appropriate voltage $$U_q$$ while compensating for the generated Back EMF voltage by keeping track of the motor velocity $$v$$.
178
+
179
+
$$
180
+
U_q = I_d R + U_{bemf}= (k\tau_d) R + \frac{v}{KV}
181
+
$$
182
+
183
+
Additionally if the user sets the phase inductance value $$L$$, the library will be able to compensate for the lag of the torque vector by calculating an appropriate d-axis voltage $$U_d$$
184
+
185
+
$$
186
+
U_d = -I_d L v n_{pp} = -(k\tau_d)L v n_{pp}
187
+
$$
188
+
189
+
where $$n_{pp}$$ is the number of motor's pole pairs. By compensating the lag of the torque vector due to the motor rotation velocity $$v$$, the motor will be able to spin with higher max velocity. Therefore the lag compensation will have the most effect if application requires going to the maximal motor velocity.
190
+
191
+
User can specify the phase resistance and the KV rating of the motor either through the constructor for example
BLDCMotor motor = BLDCMotor( 11, 2.5, 120, 0.01 );
195
+
```
196
+
197
+
198
+
<blockquoteclass="info">
199
+
<pclass="heading"> RULE OF THUMB: KV value</p>
200
+
KV rating of the motor is defined as speed of the motor in rpm with the set voltage \(U_q\) of 1 Volt. If you do not know your motor's KV rating you can easily measure it using the library. Run your motor int the voltage mode and set the target voltage to one 1V and read the motor velocity. <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> shows that velocity in the rad/s so in order to convert it to the rpm you just need to multiply it by \(30/\pi \approx 10\).<br><br>
201
+
202
+
As explained above as the Back-EMF constant of the motor is always a bit smaller than the inverse of the KV rating ( \(k_{bemf}<1/KV\) ), the rule of thumb is to set the KV rating 10-20% higher than the one given in the datasheet, or the one determined experimentally.
203
+
</blockquote>
204
+
205
+
206
+
207
+
With the $$R$$ and $$KV$$ information the <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> is able to estimate current set to the motor and the user will be able to control the motor torque, provided the motor parameters are correct (enough 😄).
208
+
209
+
210
+
<blockquoteclass="warning">
211
+
<pclass="heading">⚠️ Practical limitations</p>
212
+
Back-EMF voltage is defined as \(U_{bemf} = k_{bemf}v\) and calculating it based on the motor \(KV\) rating of the motor is just an approximation because the motor BEMF constant \(k_{bemf}\) is not exacly \(k_{bemf}=1/KV\).
213
+
It can be shown that the back-emf constant is always somewhat smaller than the inverse of the KV rating:
214
+
\[k_{bemf}<\frac{1}{KV}\]
215
+
</blockquote>
216
+
217
+
### Expected motor behavior
218
+
If the user sets the desired current of 0 Amps, the motor should have very low resistance, much lower than in the two torque control strategies above. The motor should feel like it is almost disconnected.
219
+
220
+
<blockquoteclass="info">
221
+
<pclass="heading"> For current 0 motor moves</p>
222
+
If your desired current is set to 0, but when you move your motor with your hand it continues moving on its own and does not come back to a complete stop, your \(KV\) value is too high. Try reducing it.
223
+
</blockquote>
224
+
225
+
If you set a certain desired current $$I_d$$ your motor should accelerate to its maximum velocity. The acceleration value is proportional to the motor torque and will be proportional to the current $$I_d$$. So for larger currents your motor will accelerate faster and for the lower currents it will accelerate slower. But for the motor without load, regardless of set target current $$I_d$$ the motor should reach its max velocity.
226
+
227
+
<blockquoteclass="info">
228
+
<pclass="heading"> For current \(I_d > 0\) motor does not move</p>
229
+
If your desired current is set to some value that is not 0, but your motor does not move, your phase resistance value \(R\) is probably too low. Try increasing it.
230
+
</blockquote>
231
+
232
+
For different values of the motor phase inductance $$L$$ motor will be able to reach different maximal velocities. The higher the inductance value the higher the maximal velocity. However, after certain inductance value the motor maximal velocity will stop being affected as it will reach its absolute max velocity.
233
+
234
+
<blockquoteclass="info">
235
+
<pclass="heading"> How to find the phase inductance \(L\) value</p>
236
+
Start with low value, such as 0.1mH and set your target current \(I_d\) to certain value to allow the motor to accelerate to it's max velocity. Then use the Commander interface to change the inductance and see see how the motor's velocity evolves. By raising the \(L\) value, the velocity should increase. After certain \(L\) value the velocity will stop increasing and if you continue it might even decrease. So use the minimal \(L\) value that reaches the max velocity.
Arduino <spanclass="simple">Simple<spanclass="foc">FOC</span>library</span> has recently started to support Teensy boards as well. The most commonly tested boards are Teensy 4.1 and Teensy 3.2, but most of the boards in 4.x and 3.x series should work out of the box with the library.
Copy file name to clipboardExpand all lines: docs/simplefoc_library/work_roadmap.md
+24-4Lines changed: 24 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,32 @@ nav_order: 8
6
6
permalink: /roadmap
7
7
---
8
8
9
-
# Roadmap
9
+
# Feature Roadmap
10
10
11
-
For more info about the features of library releases visit the [github releases <iclass="fa fa-tag"></i>](https://github.com/simplefoc/Arduino-FOC/releases). This page is not really rigorously maintained and can be outdated from time to time.
11
+
This page is not really rigorously maintained and can be a bit outdated.
For more info about the features of library releases visit the [github releases <iclass="fa fa-tag"></i>](https://github.com/simplefoc/Arduino-FOC/releases).
29
+
30
+
# Old roadmap
31
+
<detailsmarkdown=1>
12
32
13
33
## Motion Control and FOC algorithm
14
-
-[]**Motor control: Low-side current sensing** - No.1
34
+
-[x]**Motor control: Low-side current sensing** - No.1
15
35
-[ ]**Motor control: Inline current sensing with DMA** - No.2
16
36
-[ ] Motor control: High-side current sensing
17
37
-[x]**Bugfix: Floating point angle overflow**
@@ -78,6 +98,6 @@ For more info about the features of library releases visit the [github releases
78
98
-[x] VIDEO: Two motors running on HMBGC example
79
99
-[x] VIDEO: Initial video with simple demonstration
0 commit comments