Skip to content

Commit b8967ba

Browse files
committed
Merge remote-tracking branch 'origin/master' into dev
2 parents 58d1be8 + 5014e0c commit b8967ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1290
-104
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# simplefoc.github.io
22
Documentation website for SimpleFOCproject
3-
3+
44
- [Documentation](https://docs.simplefoc.com)
55
- [Community forum](https://community.simplefoc.com)
66
- [Shop](https://simplefoc.com/shop)
@@ -26,7 +26,7 @@ bundle install
2626
```
2727
And you're ready to go!
2828

29-
Just make sure that whenever you open your terminal to generate the webiste to activate the conda anvironment:
29+
Just make sure that whenever you open your terminal to generate the website to activate the conda environment:
3030
```
3131
conda activate simpledocs
3232
```
@@ -41,4 +41,13 @@ bundle exec jekyll serve
4141
Since the site is quiet large sometimes the `--incremental` flag helps with faster execution
4242
```
4343
bundle exec jekyll serve --incremental
44-
```
44+
```
45+
46+
## Olddocs generating
47+
48+
1) Add the library version to the index.md
49+
2) modify the `_config.yaml`
50+
- `url: "http://olddocs.simplefoc.com" `
51+
- `baseurl: "v2.2.3"`
52+
3) run `bundle exec jekyll build`
53+
4) in `_site` you have the generated html

_includes/js/custom.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ var libraires =[
1616
"LowsideCurrentSense.h",
1717
"InlineCurrentSense.h",
1818
"MySensor.h",
19-
"Sensor.h"
19+
"Sensor.h",
20+
"SimpleFOCDrivers.h",
21+
"MagneticSensorAS5048A.h"
2022
]
2123

2224
var defines =[

_includes/nav.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
{%- endif -%}
7878
{%- endunless -%}
7979
{%- endfor -%}
80+
<li class="nav-item navigation-list-item" style="padding:5px">
81+
<a href="http://olddocs.simplefoc.com" style="padding:0px"><i class="fa fa-archive fa-lg"></i> Docs archive</a>
82+
</li>
8083
<li class="nav-item navigation-list-item" style="padding:5px">
8184
<a href="https://docs.simplefoc.com/docs_chinese" style="padding:0px"><i class="fa fa-language fa-lg"></i> Docs in Chinese</a>
8285
</li>

docs/boards/index.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ has_toc: false
1313
One of the goals of the <span class="simple">Simple<span class="foc">FOC</span>project</span> is to develop low-cost easy to use BLDC driver boards compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>and completely open source!
1414

1515
For now there have been three official BLDC drivers developed by the <span class="simple">Simple<span class="foc">FOC</span>project</span>:
16-
- <span class="simple">Simple<span class="foc">FOC</span>Shield</span>
16+
- <span class="simple">Simple<span class="foc">FOC</span>Shield</span> - <small>[Find out more](arduino_simplefoc_shield_showcase)</small>
17+
- <span class="simple">Simple<span class="foc">FOC</span>Mini</span> 📢**NEW** - <small>[Find out more](simplefocmini)</small>
1718
- <span class="simple">Simple<span class="foc">FOC</span> <b>Power</b>Shield</span>
18-
- <span class="simple">Simple<span class="foc">FOC</span>Mini</span> 📢**NEW**
1919

2020
## Arduino <span class="simple">Simple<span class="foc">FOC</span>Shield</span> <small>v2.0.4</small> - <small>[Find out more](arduino_simplefoc_shield_showcase)</small>
2121

@@ -43,6 +43,32 @@ The <span class="simple">Simple<span class="foc">FOC</span>Shield</span>, in com
4343
- **Open Source**: Fully available fabrication files - [how to make it yourself](https://docs.simplefoc.com/arduino_simplefoc_shield_fabrication)
4444

4545

46+
## 📢**NEW**: <span class="simple">Simple<span class="foc">FOC</span>Mini</span> <small>v1.0</small> - <small>[Find out more](simplefocmini)</small>
47+
48+
Small package, low-cost BLDC driver board fully compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>
49+
50+
51+
<img src="extras/Images/mini.png" class="width40"/><img src="https://user-images.githubusercontent.com/36178713/164240473-5abd7453-9d38-4f25-9195-378c39180054.jpg" class="width40"/>
52+
53+
54+
55+
56+
## Features
57+
- **Plug & play**: In combination with Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
58+
- **DRV8313 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8313.pdf?ts=1650461862269&ref_url=https%253A%252F%252Fwww.google.com%252F)
59+
- Power supply: 8-24V
60+
- Max current: 2.5A per phase
61+
- Onboard 3.3V LDO
62+
- **Small size**: 26x20 mm
63+
- **Fully open-source**:
64+
- [EasyEDA](https://easyeda.com/the.skuric/simplefocmini)
65+
- [GitHub](https://github.com/simplefoc/SimpleFOCMini)
66+
- **Low-cost**:
67+
- JLCPCB production cost ~3-5€
68+
- Will be available in the [shop](https://www.simplefoc.com/shop) soon: 7-10€
69+
70+
Read more about this board at [link](https://github.com/simplefoc/SimpleFOCMini)
71+
4672
## Arduino <span class="simple">Simple<span class="foc">FOC</span> <b>Power</b>Shield</span> <small>v0.2</small> <small>⚠️<i>( under developement)</i></small>
4773

4874
A powerful arduino shield for running BLDC motors using the FOC algorithm. This board is based on the [BTN8982](https://www.infineon.com/dgdl/Infineon-BTN8982TA-DS-v01_00-EN.pdf?fileId=db3a30433fa9412f013fbe32289b7c17) half bridges and can support currents up to 30 Amps continuos and 50Amps peak. Making it a board that can run virtually any BLDC motor.
@@ -78,29 +104,3 @@ This does not mean that the board itself is not functional or that it will not w
78104
- schematics
79105

80106
Read more about this board at [link](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield)
81-
82-
## 📢**NEW**: <span class="simple">Simple<span class="foc">FOC</span>Mini</span> <small>v1.0</small>
83-
84-
Small package, low-cost BLDC driver board fully compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>
85-
86-
87-
<img src="extras/Images/mini.png" class="width40"/><img src="https://user-images.githubusercontent.com/36178713/164240473-5abd7453-9d38-4f25-9195-378c39180054.jpg" class="width40"/>
88-
89-
90-
91-
92-
## Features
93-
- **Plug & play**: In combination with Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
94-
- **DRV8313 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8313.pdf?ts=1650461862269&ref_url=https%253A%252F%252Fwww.google.com%252F)
95-
- Power supply: 8-24V
96-
- Max current: 2.5A per phase
97-
- Onboard 3.3V LDO
98-
- **Small size**: 26x20 mm
99-
- **Fully open-source**:
100-
- [EasyEDA](https://easyeda.com/the.skuric/simplefocmini)
101-
- [GitHub](https://github.com/simplefoc/SimpleFOCMini)
102-
- **Low-cost**:
103-
- JLCPCB production cost ~3-5€
104-
- Will be available in the [shop](https://www.simplefoc.com/shop) soon: 7-10€
105-
106-
Read more about this board at [link](https://github.com/simplefoc/SimpleFOCMini)
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
layout: default
3+
title: Writing the code
4+
parent: Starting with Mini
5+
description: "Writing the Arduino program for your SimpleFOCMini."
6+
nav_order: 2
7+
permalink: /mini_code
8+
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>Mini</span>
9+
grand_grand_parent: <span class="simple">Simple<span class="foc">FOC</span> Boards</span>
10+
---
11+
12+
# Writing the code
13+
Once you have all the [hardware connected](mini_connect_hardware):
14+
- Microcontroller
15+
- BLDC motor
16+
- Position sensor
17+
- Power supply
18+
19+
we can start the most exciting part, coding!
20+
21+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> is fully supported by Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>, therefore please make sure you have the newest version of the <span class="simple">Simple<span class="foc">FOC</span>library</span> installed. If you still did not get your owm version of the library please follow the [installation instructions](installation).
22+
23+
Suggested approach when starting coding for the Arduino <span class="simple">Simple<span class="foc">FOC</span>Mini</span> is:
24+
25+
- [Test the sensor](#step-1-testing-the-sensor)
26+
- [Test the motor](#step-2-testing-the-motor)
27+
- [Voltage motion control](#step-3-voltage-motion-control)
28+
- [More complex control strategies](#step-4-more-complex-control-strategies) - position and velocity
29+
30+
You can also follow our [Getting started](example_from_scratch) guide!
31+
32+
## Step 1. Testing the sensor
33+
First make sure your sensor works properly. Run one of the library examples specific to your sensors. You can find the library examples in
34+
```sh
35+
utils >
36+
sensor_test >
37+
encoder >
38+
- encoder_example
39+
- encoder_software_interrupts_example
40+
magnetic_sensors >
41+
- magnetic_sensor_i2c_example
42+
- magnetic_sensor_spi_example
43+
- magnetic_sensor_analog_example
44+
hall_sensors >
45+
- hall_sensor_example
46+
- hall_sensor_software_interrupts_example
47+
```
48+
Once you have your sensor reading the good values you can continue the testing the combination of the motor and the sensor.
49+
50+
<blockquote class="warning"> <p class="heading">Update the example pinout</p>
51+
When testing the sensor make sure to update the pinout.</blockquote>
52+
53+
## Step 2. Testing the motor
54+
To test the BLDC motor before running FOC algorithm we suggest to run the open loop examples!
55+
```sh
56+
motion_control >
57+
open_loop_motor_control >
58+
- open_loop_position_example
59+
- open_loop_velocity_example
60+
```
61+
<blockquote class="warning"> <p class="heading">Update the example pinout</p>
62+
When testing the motor make sure to update the pinout that you have chosen in the <a href="mini_connect_hardware">hardware configuration</a>.</blockquote>
63+
64+
If you are not sure what is the number of pole pairs your motor has, please check the example code:
65+
```sh
66+
utils >
67+
find_pole_pair_number >
68+
- encoder
69+
- magnetic_sensor
70+
```
71+
This code will estimate the pole pairs number that your motor has. Please run this code several times to get a good estimation. The code will, generally show a good reading 7/10 times.
72+
73+
74+
## Step 3. Voltage motion control
75+
Once you have your sensor working, and you have the right number of pole pairs of your motor you can start using FOC algorithm. The best practice is to start with an example of the Voltage control:
76+
```sh
77+
motion_control >
78+
torque_voltage_control >
79+
- encoder
80+
- magnetic_sensor
81+
- hall_sensors
82+
```
83+
84+
## Step 4. More complex control strategies
85+
Now when you have your torque control using voltage ready you can continue to the position and velocity control algorithms. They will take a bit more time to tune but they will give you a chance to have great results. You can find the library examples for motion control loops in by navigating the examples:
86+
87+
```sh
88+
motion_control >
89+
position_motion_control >
90+
- encoder
91+
- magnetic_sensor
92+
- hall_sensors
93+
torque_voltage_control >
94+
- encoder
95+
- magnetic_sensor
96+
- hall_sensors
97+
velocity_motion_control >
98+
- encoder
99+
- magnetic_sensor
100+
- hall_sensors
101+
```
102+
For more information about the possible <span class="simple">Simple<span class="foc">FOC</span>Mini</span> projects visit [example projects](examples)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
layout: default
3+
title: Connecting the hardware
4+
parent: Starting with Mini
5+
description: "Connecting SimpleFOCMini with your hardware."
6+
nav_order: 1
7+
permalink: /mini_connect_hardware
8+
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>Mini</span>
9+
grand_grand_parent: <span class="simple">Simple<span class="foc">FOC</span> Boards</span>
10+
---
11+
12+
# Connecting the hardware
13+
14+
<p>
15+
<img src="extras/Images/mini_gif1.gif" class="width50">
16+
</p>
17+
18+
Connecting the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> to the microcontroller, BLDC motor and power-supply is very straight forward.
19+
20+
<p>
21+
<img src="extras/Images/mini_where.png" class="width40">
22+
</p>
23+
24+
## Microcontroller
25+
- <span class="simple">Simple<span class="foc">FOC</span>Mini</span> is designed as a standalone BLDC driver, which will basically work with any microcontroller.
26+
- This board has 10 pins exposed for the connection to the microcontroller
27+
28+
<p>
29+
<img src="extras/Images/mini_req_opt.png" class="width30">
30+
</p>
31+
32+
There are 5 pins that are required to be connected
33+
34+
Pin Name | Description
35+
--- | ---
36+
GND | Ground (common ground)
37+
IN1 | PWM input phase 1
38+
IN2 | PWM input phase 2
39+
IN3 | PWM input phase 3
40+
EN | Driver Enable
41+
42+
These pins need to ba connected whenever using the <span class="simple">Simple<span class="foc">FOC</span>Mini</span>. The 3 pwm pins and the enable pin are used to control the DRV8313 driver and in terms of the <span class="simple">Simple<span class="foc">FOC</span>library</span> they correspond to the entries of the `BLDCDriver3PWM` class. The common ground pin is very important as well in order to make sure that all the PWM and Enable pins are read properly by the driver chip. Once you decide which pins you will be using for `INx` and `EN` pins you will be able to porvide them to the `BLDCDriver3PWM` class in your Arduino sketch.
43+
44+
```cpp
45+
BLDCDriver3PWM driver = BLDCDriver3PWM(IN1, IN2, IN3, EN);
46+
```
47+
48+
In addition to these pins there are 5 pins that are optional.
49+
50+
Pin Name | Description
51+
--- | ---
52+
3.3V | 3.3V output - **NOT INPUT**
53+
GND | Ground
54+
nRT | Reset (active LOW)
55+
nSP | Sleep (active LOW)
56+
nFT | Fault output (active LOW)
57+
58+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> is based on the DRV8313 driver which has integrated 3.3V regulator which might be useful in some applications to power a sensor or similar. The 3.3v pin of the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> can therefore be used as a 3.3v source pin with the maximum current output of 10mA. Both GND pins exposed in the <span class="simple">Simple<span class="foc">FOC</span>Mini</span>'s header are connected to the same ground, so you can choose the one which is more convenient to your application.
59+
<blockquote class="warning"><p class="heading">BEWARE: 3.3V LDO Power limitations</p>
60+
DRV8313 comes with the 3.3V voltage regulator and it is connected to the <span class="simple">Simple<span class="foc">FOC</span>Mini</span>'s 3.3V pin. However it has a limitation of 10mA, which is in general not enough to power a microcontroller. But it might be enough to power a LED light or some position sensors.
61+
</blockquote>
62+
63+
Pin `nFT` (fault) is an active LOW output of the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> which can be read to verify if the DRV8313 driver is working properly. If this pin is in LOW it means the DRV8313 is its fault state and it cannot drive the motor. Then the pin `nRT` (reset), which is also active LOW, can be used to reset the DRV8313 driver to reinitialise its internal state and exit the fault state, this cannot be done by simply toggling the enable pin. Finally the pin `nSP` (sleep) is an active LOW pin that puts the DRV8313 in the low-power sleep mode, consuming the current of under 1uA.
64+
65+
66+
67+
68+
69+
## BLDC motor
70+
- Motor phases `a`, `b` and `c` are connected directly the motor terminal connector `M1`,`M2` and `M3`
71+
72+
<blockquote class="warning"><p class="heading">BEWARE: Power limitations</p>
73+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> is designed for gimbal motors with internal resistance higher than R>10Ohm. The absolute maximal current of this board is 5A. Please make sure when using this board in your projects that the BLDC motor used does comply with these limits. <br>
74+
If you still want to use this driver with the BLDC motors with very low resistance R < 1Ohm make sure to limit the voltage set to the board. <br>
75+
For a bit more information about the choice of motors visit <a href="bldc_motors"> BLDC motor docs</a>
76+
</blockquote>
77+
78+
## Power supply
79+
- Power supply cables are connected directly to the terminal pins `+` and `-`
80+
- Required power supply voltage is from 8V to 24V.
81+
82+
83+
## Examples of connection schematics
84+
85+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> can be connected to any microcontroller (MCU) pin combination that can ensure that the mini's `GND` pin is connected to the MCU's `GND` pin, MCU's 3 pwm capable pins are connected to the `IN1`,`IN2` and `IN3` pins, and one MCU's digital pin is connected to the `EN` pin.
86+
87+
88+
An example connection of the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> and Nucleo board is shown on the image below.
89+
90+
<img src="extras/Images/mini_connection_mucleo.png" class="">
91+
92+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> can be directly plugged into the Arduino headers of teh Nucleo board from the pin `10` to the `GND` pin and in that way reduce the amount of wires necessary. For more information on this example connection see [this library example](mini_example_nucleo).
93+
94+
--- | --- | --- | ---| --- | ---
95+
Mini Pin | EN | IN3 | IN2 | IN1 | GND
96+
Nucleo Pin | 10 | 11 | 12 | 13 | GND
97+
98+
```cpp
99+
BLDCDriver3PWM driver = BLDCDriver3PWM(13, 12, 11, 10);
100+
```
101+
102+
An example connection of the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> and Arduino UNO is shown on the image below.
103+
<img src="extras/Images/mini_connection_uno.png" class="">
104+
105+
<span class="simple">Simple<span class="foc">FOC</span>Mini</span> can be directly plugged into the Arduino headers of the UNO board from the pin `8` to the `12` pin (pin 12 can act as a GND pin) and in that way reduce the amount of wires necessary. For more information on this example connection see [this library example](mini_example).
106+
107+
--- | --- | --- | ---| --- | ---
108+
Mini Pin | EN | IN3 | IN2 | IN1 | GND
109+
UNO Pin | 8 | 9 | 10 | 11 | 12
110+
111+
```cpp
112+
BLDCDriver3PWM driver = BLDCDriver3PWM(11, 10, 9, 8);
113+
```
114+
115+
Another example of connecting the Arduino UNO with <span class="simple">Simple<span class="foc">FOC</span>Mini</span> is shown below
116+
<img src="extras/Images/mini_connection_uno2.png" class="">
117+
118+
--- | --- | --- | ---| --- | ---
119+
Mini Pin | EN | IN3 | IN2 | IN1 | GND
120+
UNO Pin | 4 | 5 | 6 | 9 | GND
121+
122+
```cpp
123+
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 6, 5, 4);
124+
```
125+
126+
An example connection of the <span class="simple">Simple<span class="foc">FOC</span>Mini</span> and stm32 Bluepill is shown on the image below.
127+
<img src="extras/Images/mini_connection_bluepill.png" class="">
128+
129+
130+
--- | --- | --- | ---| --- | ---
131+
Mini Pin | EN | IN3 | IN2 | IN1 | GND
132+
Bluepill Pin | PB15 | PA8 | PA9 | PA10 | GND
133+
134+
```cpp
135+
BLDCDriver3PWM driver = BLDCDriver3PWM(PA10, PA9, PA8, PB15);
136+
```

0 commit comments

Comments
 (0)