Skip to content

Commit d430f69

Browse files
committed
FEAT a bit of docs update
1 parent 9f984c2 commit d430f69

File tree

2 files changed

+63
-63
lines changed

2 files changed

+63
-63
lines changed

README.md

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Arduino Simple Field Oriented Control (FOC) library
22

33

4-
![Library Compile](https://github.com/askuric/Arduino-FOC/workflows/Library%20Compile/badge.svg)
4+
![Library Compile](https://github.com/simplefoc/Arduino-FOC/workflows/Library%20Compile/badge.svg)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![arduino-library-badge](https://www.ardu-badge.com/badge/Simple%20FOC.svg?)](https://www.ardu-badge.com/badge/Simple%20FOC.svg)
77

@@ -14,7 +14,7 @@ Therefore this is an attempt to:
1414
<blockquote class="info"><p> <b>NEW RELEASE 📢:</b> <i>Simple<b>FOC</b>library v1.7.0</i><br></p><ul>
1515
<li><strong>6PWM support </strong>
1616
<ul>
17-
<li>Arduino UNO</li>
17+
<li>Arduino UNO (atmega328)</li>
1818
<li>stm32 boards</li>
1919
<li>esp32 boards</li>
2020
</ul>
@@ -52,7 +52,7 @@ Therefore this is an attempt to:
5252
- **Arduino headers**: Arduino UNO, Arduino MEGA, STM32 Nucleo boards...
5353
- **Open Source**: Fully available fabrication files - [how to make it yourself](https://www.simplefoc.com/arduino_simplefoc_shield_fabrication),
5454

55-
##### If you are interested in this board, order your version on this link: [Simple FOC Shop](https://www.simplefoc.com/simplefoc_shield_product)
55+
##### If you are interested in this board, order your version on this link: [Shop](https://www.simplefoc.com/simplefoc_shield_product)
5656

5757
<p align=""><img src="https://docs.simplefoc.com/extras/Images/shield_to_v13.jpg" height="180px"> <img src="https://docs.simplefoc.com/extras/Images/shield_bo_v13.jpg" height="180px"> <img src="https://docs.simplefoc.com/extras/Images/simple_foc_shield_v13_small.gif" height="180x"></p>
5858

@@ -65,7 +65,7 @@ Therefore this is an attempt to:
6565
</a>
6666
</p>
6767

68-
This video demonstrates the Simple FOC library basic usage, electronic connections and shows its capabilities.
68+
This video demonstrates the *Simple**FOC**library* basic usage, electronic connections and shows its capabilities.
6969

7070

7171
### Features
@@ -91,46 +91,37 @@ This video demonstrates the Simple FOC library basic usage, electronic connectio
9191
Depending on if you want to use this library as the plug and play Arduino library or you want to get insight in the algorithm and make changes there are two ways to install this code.
9292

9393
- Full library installation [Docs](https://docs.simplefoc.com/library_download)
94-
- Minimal code installation [Docs](https://docs.simplefoc.com/minimal_download)
94+
- Minimal project builder [Docs](https://docs.simplefoc.com/minimal_download)
9595

96-
### Arduino SimpleFOC library installation to Arduino IDE
96+
### Arduino *SimpleFOClibrary* installation to Arduino IDE
9797
#### Arduino Library Manager
9898
The simplest way to get hold of the library is directly by using Arduino IDE and its integrated Library Manager.
9999
- Open Arduino IDE and start Arduino Library Manager by clicking: `Tools > Manage Libraries...`.
100100
- Search for `Simple FOC` library and install the latest version.
101101
- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`.
102102

103-
### Using Github website
104-
- Go to the [github repository](https://github.com/askuric/Arduino-FOC)
103+
#### Using Github website
104+
- Go to the [github repository](https://github.com/simplefoc/Arduino-FOC)
105105
- Click first on `Clone or Download > Download ZIP`.
106106
- Unzip it and place it in `Arduino Libraries` folder. Windows: `Documents > Arduino > libraries`.
107107
- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`.
108108

109-
### Using terminal
109+
#### Using terminal
110110
- Open terminal and run
111111
```sh
112-
cd *arduino libraries folder*
113-
git clone https://github.com/askuric/Arduino-FOC.git
112+
cd #Arduino libraries folder
113+
git clone https://github.com/simplefoc/Arduino-FOC.git
114114
```
115115
- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`.
116116

117-
### SimpleFOC library minimal sketch example
117+
### *SimpleFOClibrary* minimal project builder
118118

119-
For those willing to experiment and to modify the code I suggest using the [minimal version](https://github.com/askuric/Arduino-FOC/tree/minimal) of the code.
119+
For those willing to experiment and to modify the code I suggest using the minimal project builder [minimal branch](https://github.com/simplefoc/Arduino-FOC/tree/minimal).
120120
> This code is completely independent and you can run it as any other Arduino Sketch without the need for any libraries.
121121
122-
#### Github website download
123-
- Go to [minimal branch](https://github.com/askuric/Arduino-FOC/tree/minimal)
124-
- Download the code by clicking on the `Clone or Download > Download ZIP`.
125-
- Unzip it and open the sketch in Arduino IDE.
126-
127-
#### Using terminal
128-
- Open the terminal:
129-
```sh
130-
cd *to you desired directory*
131-
git clone -b minimal https://github.com/askuric/Arduino-FOC.git
132-
```
133-
- Then you just open it with the Arduino IDE and run it.
122+
All you need to do is:
123+
- Go to [minimal branch](https://github.com/simplefoc/Arduino-FOC/tree/minimal)
124+
- Follow the tutorial in the README file and choose only the library files that are necessary for your application.
134125

135126
## Arduino code example
136127
This is a simple Arduino code example implementing the velocity control program of a BLDC motor with encoder.
@@ -187,23 +178,22 @@ void loop() {
187178
You can find more details in the [SimpleFOC documentation](https://docs.simplefoc.com/).
188179

189180
## Example projects
190-
Here are some of the SimpleFOC application examples.
191-
### Arduino Field Oriented Controlled Reaction Wheel Inverted Pendulum
192-
This is a very cool open-source project of one of the simplest setups of the Reaction wheel inverted pendulum. Check out all the components and projects notes in the [github repository](https://github.com/askuric/Arduino-FOC-reaction-wheel-inverted-pendulum).
193-
<p align="">
181+
Here are some of the *Simple**FOC**library* and *Simple**FOC**Shield* application examples.
182+
<p align="center">
194183
<a href="https://youtu.be/Ih-izQyXJCI">
195-
<img src="https://docs.simplefoc.com/extras/Images/youtube_pendulum.png" height="320px">
184+
<img src="https://docs.simplefoc.com/extras/Images/youtube_pendulum.png" height="250px" >
185+
</a>
186+
<a href="https://youtu.be/xTlv1rPEqv4">
187+
<img src="https://docs.simplefoc.com/extras/Images/youtube_haptic.png" height="250px" >
188+
</a>
189+
<a href="https://youtu.be/RI4nNMF608I">
190+
<img src="https://docs.simplefoc.com/extras/Images/youtube_drv8302.png" height="250px" >
191+
</a>
192+
<a href="https://youtu.be/zcb86TRxTxc">
193+
<img src="https://docs.simplefoc.com/extras/Images/youtube_stepper.png" height="250px" >
196194
</a>
197195
</p>
198196

199-
**The main benefits of using the BLDC motor in this project are:**
200-
- High torque to weight ratio
201-
- The lighter the better
202-
- Lots of torque for low angular velocities
203-
- No need to spin the motor to very high PRM to achieve high torques
204-
- No gearboxes and backlash
205-
- Very smooth operation = very stable pendulum
206-
207197

208198
## Documentation
209199
Find out more information about the Arduino SimpleFOC project in [docs website](https://docs.simplefoc.com/)
@@ -212,6 +202,6 @@ Find out more information about the Arduino SimpleFOC project in [docs website](
212202
## Arduino FOC repo structure
213203
Branch | Description | Status
214204
------------ | ------------- | ------------
215-
[master](https://github.com/askuric/Arduino-FOC) | Stable and tested library version | ![Library Compile](https://github.com/askuric/Arduino-FOC/workflows/Library%20Compile/badge.svg)
216-
[dev](https://github.com/askuric/Arduino-FOC/tree/dev) | Development library version | ![Library Dev Compile](https://github.com/askuric/Arduino-FOC/workflows/Library%20Dev%20Compile/badge.svg?branch=dev)
217-
[minimal](https://github.com/askuric/Arduino-FOC/tree/minimal) | Minimal Arduino example with integrated library | ![MinimalBuild](https://github.com/askuric/Arduino-FOC/workflows/MinimalBuild/badge.svg?branch=minimal)
205+
[master](https://github.com/simplefoc/Arduino-FOC) | Stable and tested library version | ![Library Compile](https://github.com/simplefoc/Arduino-FOC/workflows/Library%20Compile/badge.svg)
206+
[dev](https://github.com/simplefoc/Arduino-FOC/tree/dev) | Development library version | ![Library Dev Compile](https://github.com/simplefoc/Arduino-FOC/workflows/Library%20Dev%20Compile/badge.svg?branch=dev)
207+
[minimal](https://github.com/simplefoc/Arduino-FOC/tree/minimal) | Minimal Arduino example with integrated library | ![MinimalBuild](https://github.com/simplefoc/Arduino-FOC/workflows/MinimalBuild/badge.svg?branch=minimal)

src/SimpleFOC.h

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,33 @@
2020
* - Plug & play: Arduino SimpleFOC shield
2121
*
2222
* @section dependencies Supported Hardware
23-
*
24-
* This library supports any arduino device and it is especially optimized for Arduino UNO boards and
25-
* other Atmega328 boards. But it supports Arrduinio MEGA boards and similar.
26-
*
27-
* From the version 1.3.0 it will support the STM32 boards such as Bluepill and Nucelo devices.<br>
28-
* The programming is done the same way as for the Arduino UNO but stm32 devices require STM32Duino package. <br>
29-
* You can download it directly from library manager.
23+
* - Motors
24+
* - BLDC motors
25+
* - Stepper motors
26+
* - Drivers
27+
* - BLDC drivers
28+
* - Gimbal drivers
29+
* - Stepper drivers
30+
* - Position sensors
31+
* - Encoders
32+
* - Magnetic sensors
33+
* - Hall sensors
34+
* - Open-loop control
35+
* - Microcontrollers
36+
* - Arduino
37+
* - STM32
38+
* - ESP32
39+
* - Teensy
3040
*
3141
* @section example_code Example code
3242
* @code
3343
#include <SimpleFOC.h>
3444
35-
// initialize the motor
36-
BLDCMotor motor = BLDCMotor(9, 10, 11, 11, 8);
37-
// initialize the encoder
45+
// BLDCMotor( pole_pairs )
46+
BLDCMotor motor = BLDCMotor(11);
47+
// BLDCDriver( pin_pwmA, pin_pwmB, pin_pwmC, enable (optional) )
48+
BLDCDriver3PWM motor = BLDCDriver3PWM(9, 10, 11, 8);
49+
// Encoder(pin_A, pin_B, CPR)
3850
Encoder encoder = Encoder(2, 3, 2048);
3951
// channel A and B callbacks
4052
void doA(){encoder.handleA();}
@@ -46,20 +58,21 @@ void setup() {
4658
encoder.init();
4759
// hardware interrupt enable
4860
encoder.enableInterrupts(doA, doB);
49-
50-
// set control loop type to be used
51-
motor.controller = ControlType::velocity;
52-
53-
// use monitoring with the BLDCMotor
54-
Serial.begin(115200);
55-
// monitoring port
56-
motor.useMonitoring(Serial);
57-
5861
// link the motor to the sensor
5962
motor.linkSensor(&encoder);
63+
64+
// power supply voltage [V]
65+
driver.voltage_power_supply = 12;
66+
// initialise driver hardware
67+
driver.init();
68+
// link driver
69+
motor.linkDriver(&driver);
6070
71+
// set control loop type to be used
72+
motor.controller = ControlType::velocity;
6173
// initialize motor
6274
motor.init();
75+
6376
// align encoder and start FOC
6477
motor.initFOC();
6578
}
@@ -71,9 +84,6 @@ void loop() {
7184
// velocity control loop function
7285
// setting the target velocity or 2rad/s
7386
motor.move(2);
74-
75-
// monitoring function outputting motor variables to the serial terminal
76-
motor.monitor();
7787
}
7888
* @endcode
7989
*

0 commit comments

Comments
 (0)