Skip to content

Commit 1931ac4

Browse files
authored
Update README.md
1 parent 73d67de commit 1931ac4

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,57 @@ Proper low cost FOC supporting board is very hard to find these days even may no
2525
## All you need for this project is (an exaple in brackets):
2626
- Brushless motor - 3 pahse (IPower GBM4198H-120T [Ebay](https://www.ebay.com/itm/iPower-Gimbal-Brushless-Motor-GBM4108H-120T-for-5N-7N-GH2-ILDC-Aerial-photo-FPV/252025852824?hash=item3aade95398:g:q94AAOSwPcVVo571:rk:2:pf:1&frcectupt=true))
2727
- Encoder - ( Incremental 2400cpr [Ebay](https://www.ebay.com/itm/600P-R-Photoelectric-Incremental-Rotary-Encoder-5V-24V-AB-2-Phases-Shaft-6mm-New/173145939999?epid=19011022356&hash=item28504d601f:g:PZsAAOSwdx1aKQU-:rk:1:pf:1))
28-
- HMBGC V2.2 [Ebay](https://www.ebay.com/itm/HMBGC-V2-0-3-Axle-Gimbal-Controller-Control-Plate-Board-Module-with-Sensor/351497840990?hash=item51d6e7695e:g:BAsAAOSw0QFXBxrZ:rk:1:pf:1)
28+
- HMBGC V2.2 [Ebay](https://www.ebay.com/itm/HMBGC-V2-0-3-Axle-Gimbal-Controller-Control-Plate-Board-Module-with-Sensor/351497840990?hash=item51d6e7695e:g:BAsAAOSw0QFXBxrZ:rk:1:pf:1)
29+
30+
# Using the library
31+
## Conneciton of encoder and motor
32+
<p>
33+
<img src="./Images/connection.png" height="400px">
34+
<img src="./Images/setup1.jpg" height="400px">
35+
<img src="./Images/pinout.jpg" height="400px">
36+
</p>
37+
To use HMBGC controller for vector control (FOC) you need to connect motor to one of the motor terminals and connect the Encoder. The shema of connection is shown on the figures above, I also took a (very bad) picture of my setup.
38+
39+
## The code
40+
The code is organised in two libraries, BLDCmotor.h and endcoder.h. BLDCmotor.h contains all the necessary FOC funciton implemented and encoder.h deals with the encoder. I will make this better in future. :D
41+
42+
### Initialization
43+
The heart of the init is the constructor call:
44+
```cpp
45+
BLDCMotor motor = BLDCMotor(9,10,11,&counter[ENCODER_1],A0,A1,11,2400);
46+
//BLDCMotorint(phA, phB, phC, long* counter, int encA, int encB , int pp, int cpr)
47+
```
48+
The first three arguments are pin numbers of them motor phases, either 9,10,11 or 6,5,3
49+
Fourth argument is a pointer to the encoder counter
50+
Fith and sixt argument are encoder pins channel A and channel B
51+
Seventh argument is number of Pole pairs of the motor
52+
And Eight argument is the cpr of the encoder
53+
54+
### Usage in loop
55+
56+
I have not made an implementation using timer intrupts just yet, but it is one of the future steps.
57+
At the motment the function control loop function has to be iteratively called in the `loop()`.
58+
59+
## Control loops
60+
There are three cascade control loops implemented in the library:
61+
### Open loop voltage Uq
62+
Using the fucntion
63+
```cpp
64+
motor.setPhaseVoltage(float Uq)
65+
```
66+
you can run BLDC motor as it is DC motor using Park transformation.
67+
<img src="./Images/voltage.png">
68+
### Closed loop velocity control
69+
Using the fucntion
70+
```cpp
71+
motor.setVelocity(float v)
72+
```
73+
you can run BLDC motor in closed loop with desired velocity.
74+
<img src="./Images/velocity.png" >
75+
### Closed loop velocity control
76+
Using the fucntion
77+
```cpp
78+
motor.setPosition(float pos)
79+
```
80+
you can run BLDC motor in closed loop with desired position.
81+
<img src="./Images/position.png">

0 commit comments

Comments
 (0)