Skip to content

Commit 26a4a34

Browse files
authored
Merge pull request #6 from runger1101001/master
Added drivers library page
2 parents 913b67b + dfab936 commit 26a4a34

File tree

4 files changed

+106
-1
lines changed

4 files changed

+106
-1
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
layout: default
3+
title: SimpleFOC Drivers Library
4+
nav_order: 9
5+
permalink: /drivers_library
6+
parent: Writing the Code
7+
grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
8+
has_children: False
9+
has_toc: False
10+
---
11+
12+
13+
# SimpleFOC drivers library
14+
15+
![Library Compile](https://github.com/simplefoc/Arduino-FOC-Drivers/workflows/Library%20Compile/badge.svg)
16+
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
17+
![arduino-library-badge](https://www.ardu-badge.com/badge/Simple%20FOC%20Drivers.svg?)
18+
19+
20+
The <span class="simple">Simple<span class="foc">FOC</span>library</span>'s main objective is to provide an efficient low level motion motor control for BLDC and stepper motors.
21+
22+
There are a vast number of hardware and software options you might choose when implementing a FOC controlled motor system in conjunction - things like whole driver boards, different sensors, integrated driver ICs, different communications protocols and more.
23+
24+
The main library cannot possibly cover all these topics without becoming "overloaded", and hence hard to understand, maintain and use. So our approach is to keep the core library as lean and simple as we can - just the algorithms for motor driving, the PWM support for the different MCUs, and some universal, generic sensor and communications components.
25+
26+
The philosophy is that this will be enough to help you solve your motor control objectives, and there are other sources for the other code needed for your system.
27+
28+
One of these sources is the <span class="simple">Simple<span class="foc">FOC</span></span> drivers library.
29+
30+
## What is it?
31+
32+
A collection of drivers and supporting code you can use with <span class="simple">Simple<span class="foc">FOC</span>library</span>.
33+
34+
## What's in there?
35+
36+
It is steadily growing, but at the moment we have:
37+
38+
- a driver for the DRV8316 integrated 3-phase driver from TI
39+
- various sensor drivers for different magnetic sensor ICs
40+
- a communications driver for I2C
41+
42+
## What's the advantage?
43+
44+
- The drivers in the drivers repo enable functionality for components that don't work with the standard core library. For example, the TLE5012B sensor is not supported by the generic MagneticSensorSPI class, but there is a specific driver for it in the drivers repository.
45+
46+
- The drivers in the drivers repo may have extended functionality. So for example while the AS5048A sensor is supported by the generic MagneticSensorSPI class, the specific driver for it allows querying its other registers, allows detecting sensor erros, and is easier to use because it has the correct settings "embedded".
47+
48+
- Using the comms drivers provided as a starting point not only gets you off to a quick start, but also makes it more likely your solutions will be interoperable with those of others (or at least easy to adapt).
49+
50+
## How can I use it?
51+
52+
```c++
53+
#include "SimpleFOCDrivers.h"
54+
```
55+
56+
It is in the arduino library manager, called "Simple FOC Drivers". Install as normal for arduino libraries in Arduino IDE or PlatformIO.
57+
58+
To use some code from the library, include the specific driver module you want. For example:
59+
60+
```c++
61+
#include "encoders/as5048a/MagneticSensorAS5048A.h"
62+
```
63+
64+
Then check the README for the specific driver for further instructions, or post in the forum or discord if you get stuck!
65+
66+
### GitHub
67+
68+
You can find the source code for the library here: [https://github.com/simplefoc/Arduino-FOC-drivers](https://github.com/simplefoc/Arduino-FOC-drivers).
69+
70+
71+
## Documentation
72+
73+
Each module / driver is documented in its README file that can be found in its respective sub-directory.
74+
75+
The [README](https://github.com/simplefoc/Arduino-FOC-drivers) for the main repository has an index to help you find things.
76+
77+
78+
## How do we decide what goes there?
79+
80+
While working on <span class="simple">Simple<span class="foc">FOC</span> library</span> we sometimes develop code to support our projects that doesn't directly relate to the core library, or receive contributions of code that don't quite fit. We find a home for it in the drivers library.
81+
82+
So the drivers repository is for code that falls into one of these categories:
83+
84+
- hardware-specific, like for a specific sensor or driver chip
85+
- solves problems related to motor control but that aren't needed by everyone using the library
86+
- implements specific communications protocols
87+
88+
The code in the drivers repository is:
89+
90+
- not used by as many users, so less well tested
91+
- not as completely documented as the core library
92+
- probably more suited for experienced users
93+

docs/simplefoc_library/hardware/drivers/BLDC_drivers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ grand_grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</sp
1212
# BLDC motor drivers
1313
This library will be compatible with the most of 3 phase BLDC motor drivers. Such as [<i class="fa fa-file"></i> L6234](https://www.st.com/en/motor-drivers/l6234.html), [<i class="fa fa-file"></i> DRV8305](https://www.ti.com/product/DRV8305), [<i class="fa fa-file"></i> DRV8313](https://www.ti.com/product/DRV8313) or even [<i class="fa fa-file"></i> L293](http://www.ti.com/lit/ds/symlink/l293.pdf).
1414

15-
At this moment, a low-cost BLDC driver board is still reasonably hard to find making our choice of hardware is quiet restricted. This is the one of the motivations to develop the <span class="simple">Simple<span class="foc">FOC</span>Shield</span>, a versatile and simple BLDC driver. Fortunately, the community is starting to gain momentum in this direction and it is probably a matter of time before BLDC motors become a standard in the hobby community as well, what is really exciting! 😃
15+
At this moment, a low-cost BLDC driver board is still reasonably hard to find making our choice of hardware is quite restricted. This is the one of the motivations to develop the <span class="simple">Simple<span class="foc">FOC</span>Shield</span>, a versatile and simple BLDC driver. Fortunately, the community is starting to gain momentum in this direction and it is probably a matter of time before BLDC motors become a standard in the hobby community as well, what is really exciting! 😃
1616

1717
The choice what kind of BLDC driver you will need in your project directly depends of the BLDC motor you are using. Therefore we can divide them in two groups:
1818
- [Low power BLDC drivers](#low-power-boards---gimbal-motors-) - *Gimbal motors (R>10Ω)*

docs/simplefoc_library/installation/library_platformio.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</span>lib
1212

1313
Using SimpleFOC from PlatformIO is not hard at all! The following instructions should get you set up and compiling your code in a matter of minutes.
1414

15+
## Quick setup for pros
16+
17+
You can use SimpleFOC in Arduino projects in PlatformIO. Just add the library via the library manager.
18+
19+
<b>You will need this option in your platformio.ini file:</b>
20+
```ini
21+
lib_archive = false
22+
```
23+
24+
# Detailed instructions
25+
1526
## Prerequisites
1627

1728
- You need an active internet connection throughout this process, until your project is set up.

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Therefore this is an attempt to:
4141
</ul>
4242
</li>
4343
<li>Generic sensor class - to implement a new sensor only implement one function <a href="https://docs.simplefoc.com/generic_sensor">see docs</a></li>
44+
<li>First release of the <a href="/drivers_library">Drivers Library</a> v1.0.0 to Arduino library manager</li>
4445
</ul>
4546
</blockquote>
4647

0 commit comments

Comments
 (0)