Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
_site
Gemfile.lock
node_modules
.jekyll-cache
.jekyll-cache
bin/just-the-docs
assets/images/.DS_Store
Binary file removed .jekyll-metadata
Binary file not shown.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# simplefoc.github.io
Documentation website for SimpleFOCproject

- [Documentation](https://docs.simplefoc.com)
- [Community forum](https://community.simplefoc.com)
- [Shop](https://simplefoc.com/shop)
Expand All @@ -26,7 +26,7 @@ bundle install
```
And you're ready to go!

Just make sure that whenever you open your terminal to generate the webiste to activate the conda anvironment:
Just make sure that whenever you open your terminal to generate the website to activate the conda environment:
```
conda activate simpledocs
```
Expand All @@ -41,4 +41,13 @@ bundle exec jekyll serve
Since the site is quiet large sometimes the `--incremental` flag helps with faster execution
```
bundle exec jekyll serve --incremental
```
```

## Olddocs generating

1) Add the library version to the index.md
2) modify the `_config.yaml`
- `url: "http://olddocs.simplefoc.com" `
- `baseurl: "v2.2.3"`
3) run `bundle exec jekyll build`
4) in `_site` you have the generated html
4 changes: 3 additions & 1 deletion _includes/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ var libraires =[
"LowsideCurrentSense.h",
"InlineCurrentSense.h",
"MySensor.h",
"Sensor.h"
"Sensor.h",
"SimpleFOCDrivers.h",
"MagneticSensorAS5048A.h"
]

var defines =[
Expand Down
3 changes: 3 additions & 0 deletions _includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
{%- endif -%}
{%- endunless -%}
{%- endfor -%}
<li class="nav-item navigation-list-item" style="padding:5px">
<a href="http://olddocs.simplefoc.com" style="padding:0px"><i class="fa fa-archive fa-lg"></i> Docs archive</a>
</li>
<li class="nav-item navigation-list-item" style="padding:5px">
<a href="https://docs.simplefoc.com/docs_chinese" style="padding:0px"><i class="fa fa-language fa-lg"></i> Docs in Chinese</a>
</li>
Expand Down
56 changes: 28 additions & 28 deletions docs/boards/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ has_toc: false
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!

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

## 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>

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


## 📢**NEW**: <span class="simple">Simple<span class="foc">FOC</span>Mini</span> <small>v1.0</small> - <small>[Find out more](simplefocmini)</small>

Small package, low-cost BLDC driver board fully compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>


<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"/>




## Features
- **Plug & play**: In combination with Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
- **DRV8313 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8313.pdf?ts=1650461862269&ref_url=https%253A%252F%252Fwww.google.com%252F)
- Power supply: 8-24V
- Max current: 2.5A per phase
- Onboard 3.3V LDO
- **Small size**: 26x20 mm
- **Fully open-source**:
- [EasyEDA](https://easyeda.com/the.skuric/simplefocmini)
- [GitHub](https://github.com/simplefoc/SimpleFOCMini)
- **Low-cost**:
- JLCPCB production cost ~3-5€
- Will be available in the [shop](https://www.simplefoc.com/shop) soon: 7-10€

Read more about this board at [link](https://github.com/simplefoc/SimpleFOCMini)

## 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>

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.
Expand Down Expand Up @@ -78,29 +104,3 @@ This does not mean that the board itself is not functional or that it will not w
- schematics

Read more about this board at [link](https://github.com/simplefoc/Arduino-SimpleFOC-PowerShield)

## 📢**NEW**: <span class="simple">Simple<span class="foc">FOC</span>Mini</span> <small>v1.0</small>

Small package, low-cost BLDC driver board fully compatible with the <span class="simple">Simple<span class="foc">FOC</span>library</span>


<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"/>




## Features
- **Plug & play**: In combination with Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
- **DRV8313 based** - [datasheet](https://www.ti.com/lit/ds/symlink/drv8313.pdf?ts=1650461862269&ref_url=https%253A%252F%252Fwww.google.com%252F)
- Power supply: 8-24V
- Max current: 2.5A per phase
- Onboard 3.3V LDO
- **Small size**: 26x20 mm
- **Fully open-source**:
- [EasyEDA](https://easyeda.com/the.skuric/simplefocmini)
- [GitHub](https://github.com/simplefoc/SimpleFOCMini)
- **Low-cost**:
- JLCPCB production cost ~3-5€
- Will be available in the [shop](https://www.simplefoc.com/shop) soon: 7-10€

Read more about this board at [link](https://github.com/simplefoc/SimpleFOCMini)
102 changes: 102 additions & 0 deletions docs/boards/simplefoc_mini/getting_started/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
layout: default
title: Writing the code
parent: Starting with Mini
description: "Writing the Arduino program for your SimpleFOCMini."
nav_order: 2
permalink: /mini_code
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>Mini</span>
grand_grand_parent: <span class="simple">Simple<span class="foc">FOC</span> Boards</span>
---

# Writing the code
Once you have all the [hardware connected](mini_connect_hardware):
- Microcontroller
- BLDC motor
- Position sensor
- Power supply

we can start the most exciting part, coding!

<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).

Suggested approach when starting coding for the Arduino <span class="simple">Simple<span class="foc">FOC</span>Mini</span> is:

- [Test the sensor](#step-1-testing-the-sensor)
- [Test the motor](#step-2-testing-the-motor)
- [Voltage motion control](#step-3-voltage-motion-control)
- [More complex control strategies](#step-4-more-complex-control-strategies) - position and velocity

You can also follow our [Getting started](example_from_scratch) guide!

## Step 1. Testing the sensor
First make sure your sensor works properly. Run one of the library examples specific to your sensors. You can find the library examples in
```sh
utils >
sensor_test >
encoder >
- encoder_example
- encoder_software_interrupts_example
magnetic_sensors >
- magnetic_sensor_i2c_example
- magnetic_sensor_spi_example
- magnetic_sensor_analog_example
hall_sensors >
- hall_sensor_example
- hall_sensor_software_interrupts_example
```
Once you have your sensor reading the good values you can continue the testing the combination of the motor and the sensor.

<blockquote class="warning"> <p class="heading">Update the example pinout</p>
When testing the sensor make sure to update the pinout.</blockquote>

## Step 2. Testing the motor
To test the BLDC motor before running FOC algorithm we suggest to run the open loop examples!
```sh
motion_control >
open_loop_motor_control >
- open_loop_position_example
- open_loop_velocity_example
```
<blockquote class="warning"> <p class="heading">Update the example pinout</p>
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>

If you are not sure what is the number of pole pairs your motor has, please check the example code:
```sh
utils >
find_pole_pair_number >
- encoder
- magnetic_sensor
```
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.


## Step 3. Voltage motion control
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:
```sh
motion_control >
torque_voltage_control >
- encoder
- magnetic_sensor
- hall_sensors
```

## Step 4. More complex control strategies
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:

```sh
motion_control >
position_motion_control >
- encoder
- magnetic_sensor
- hall_sensors
torque_voltage_control >
- encoder
- magnetic_sensor
- hall_sensors
velocity_motion_control >
- encoder
- magnetic_sensor
- hall_sensors
```
For more information about the possible <span class="simple">Simple<span class="foc">FOC</span>Mini</span> projects visit [example projects](examples)
136 changes: 136 additions & 0 deletions docs/boards/simplefoc_mini/getting_started/connections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
layout: default
title: Connecting the hardware
parent: Starting with Mini
description: "Connecting SimpleFOCMini with your hardware."
nav_order: 1
permalink: /mini_connect_hardware
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>Mini</span>
grand_grand_parent: <span class="simple">Simple<span class="foc">FOC</span> Boards</span>
---

# Connecting the hardware

<p>
<img src="extras/Images/mini_gif1.gif" class="width50">
</p>

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.

<p>
<img src="extras/Images/mini_where.png" class="width40">
</p>

## Microcontroller
- <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.
- This board has 10 pins exposed for the connection to the microcontroller

<p>
<img src="extras/Images/mini_req_opt.png" class="width30">
</p>

There are 5 pins that are required to be connected

Pin Name | Description
--- | ---
GND | Ground (common ground)
IN1 | PWM input phase 1
IN2 | PWM input phase 2
IN3 | PWM input phase 3
EN | Driver Enable

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.

```cpp
BLDCDriver3PWM driver = BLDCDriver3PWM(IN1, IN2, IN3, EN);
```

In addition to these pins there are 5 pins that are optional.

Pin Name | Description
--- | ---
3.3V | 3.3V output - **NOT INPUT**
GND | Ground
nRT | Reset (active LOW)
nSP | Sleep (active LOW)
nFT | Fault output (active LOW)

<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.
<blockquote class="warning"><p class="heading">BEWARE: 3.3V LDO Power limitations</p>
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.
</blockquote>

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.





## BLDC motor
- Motor phases `a`, `b` and `c` are connected directly the motor terminal connector `M1`,`M2` and `M3`

<blockquote class="warning"><p class="heading">BEWARE: Power limitations</p>
<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>
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>
For a bit more information about the choice of motors visit <a href="bldc_motors"> BLDC motor docs</a>
</blockquote>

## Power supply
- Power supply cables are connected directly to the terminal pins `+` and `-`
- Required power supply voltage is from 8V to 24V.


## Examples of connection schematics

<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.


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.

<img src="extras/Images/mini_connection_mucleo.png" class="">

<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).

--- | --- | --- | ---| --- | ---
Mini Pin | EN | IN3 | IN2 | IN1 | GND
Nucleo Pin | 10 | 11 | 12 | 13 | GND

```cpp
BLDCDriver3PWM driver = BLDCDriver3PWM(13, 12, 11, 10);
```

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.
<img src="extras/Images/mini_connection_uno.png" class="">

<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).

--- | --- | --- | ---| --- | ---
Mini Pin | EN | IN3 | IN2 | IN1 | GND
UNO Pin | 8 | 9 | 10 | 11 | 12

```cpp
BLDCDriver3PWM driver = BLDCDriver3PWM(11, 10, 9, 8);
```

Another example of connecting the Arduino UNO with <span class="simple">Simple<span class="foc">FOC</span>Mini</span> is shown below
<img src="extras/Images/mini_connection_uno2.png" class="">

--- | --- | --- | ---| --- | ---
Mini Pin | EN | IN3 | IN2 | IN1 | GND
UNO Pin | 4 | 5 | 6 | 9 | GND

```cpp
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 6, 5, 4);
```

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.
<img src="extras/Images/mini_connection_bluepill.png" class="">


--- | --- | --- | ---| --- | ---
Mini Pin | EN | IN3 | IN2 | IN1 | GND
Bluepill Pin | PB15 | PA8 | PA9 | PA10 | GND

```cpp
BLDCDriver3PWM driver = BLDCDriver3PWM(PA10, PA9, PA8, PB15);
```
Loading