Skip to content

Commit

Permalink
Merge pull request #6 from runger1101001/master
Browse files Browse the repository at this point in the history
Added drivers library page
  • Loading branch information
askuric authored Feb 7, 2022
2 parents 913b67b + dfab936 commit 26a4a34
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 1 deletion.
93 changes: 93 additions & 0 deletions docs/simplefoc_library/code/drivers_library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
layout: default
title: SimpleFOC Drivers Library
nav_order: 9
permalink: /drivers_library
parent: Writing the Code
grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
has_children: False
has_toc: False
---


# SimpleFOC drivers library

![Library Compile](https://github.com/simplefoc/Arduino-FOC-Drivers/workflows/Library%20Compile/badge.svg)
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
![arduino-library-badge](https://www.ardu-badge.com/badge/Simple%20FOC%20Drivers.svg?)


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.

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.

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.

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.

One of these sources is the <span class="simple">Simple<span class="foc">FOC</span></span> drivers library.

## What is it?

A collection of drivers and supporting code you can use with <span class="simple">Simple<span class="foc">FOC</span>library</span>.

## What's in there?

It is steadily growing, but at the moment we have:

- a driver for the DRV8316 integrated 3-phase driver from TI
- various sensor drivers for different magnetic sensor ICs
- a communications driver for I2C

## What's the advantage?

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

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

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

## How can I use it?

```c++
#include "SimpleFOCDrivers.h"
```

It is in the arduino library manager, called "Simple FOC Drivers". Install as normal for arduino libraries in Arduino IDE or PlatformIO.

To use some code from the library, include the specific driver module you want. For example:

```c++
#include "encoders/as5048a/MagneticSensorAS5048A.h"
```

Then check the README for the specific driver for further instructions, or post in the forum or discord if you get stuck!

### GitHub

You can find the source code for the library here: [https://github.com/simplefoc/Arduino-FOC-drivers](https://github.com/simplefoc/Arduino-FOC-drivers).


## Documentation

Each module / driver is documented in its README file that can be found in its respective sub-directory.

The [README](https://github.com/simplefoc/Arduino-FOC-drivers) for the main repository has an index to help you find things.


## How do we decide what goes there?

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.

So the drivers repository is for code that falls into one of these categories:

- hardware-specific, like for a specific sensor or driver chip
- solves problems related to motor control but that aren't needed by everyone using the library
- implements specific communications protocols

The code in the drivers repository is:

- not used by as many users, so less well tested
- not as completely documented as the core library
- probably more suited for experienced users

2 changes: 1 addition & 1 deletion docs/simplefoc_library/hardware/drivers/BLDC_drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ grand_grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</sp
# BLDC motor drivers
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).

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! 😃
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! 😃

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:
- [Low power BLDC drivers](#low-power-boards---gimbal-motors-) - *Gimbal motors (R>10Ω)*
Expand Down
11 changes: 11 additions & 0 deletions docs/simplefoc_library/installation/library_platformio.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</span>lib

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.

## Quick setup for pros

You can use SimpleFOC in Arduino projects in PlatformIO. Just add the library via the library manager.

<b>You will need this option in your platformio.ini file:</b>
```ini
lib_archive = false
```

# Detailed instructions

## Prerequisites

- You need an active internet connection throughout this process, until your project is set up.
Expand Down
1 change: 1 addition & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Therefore this is an attempt to:
</ul>
</li>
<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>
<li>First release of the <a href="/drivers_library">Drivers Library</a> v1.0.0 to Arduino library manager</li>
</ul>
</blockquote>

Expand Down

0 comments on commit 26a4a34

Please sign in to comment.