|
5 | 5 | [](https://opensource.org/licenses/MIT)
|
6 | 6 | [](https://www.ardu-badge.com/badge/Simple%20FOC.svg)
|
7 | 7 |
|
8 |
| -Proper low cost FOC supporting boards are very hard to find these days and even may not exist. The reason may be that the hobby community has not yet dug into it properly. But even if you would find a hardware which is capable of runing BLDC motors, a good FOC code capable of running on Arduino devices is even harder to find. Therefore this is the attempt to ***demistify the Field Oriented Control (FOC) algorithm*** and make a ***robust but simple implementation*** for ***Arduino hadrware***, as well as to introduce the new [Arduino FOC shield board](https://askuric.github.io/simplefoc.html). |
| 8 | +Proper low-cost and low-power FOC supporting boards are very hard to find these days and even may not exist. Even harder to find is a stable and simple FOC algorithm code capable of running on Arduino devices. |
| 9 | +Therefore this is an attempt to: |
| 10 | +- Demistify FOC algorithm and make a robust but simple Arduino library: [Arduino SimpleFOC library](https://askuric.github.io/Arduino-FOC/arduino_simplefoc_library_showcase) |
| 11 | +- Develop a modular BLDCdriver boards: [Arduino SimpleFOC shield](https://askuric.github.io/Arduino-FOC/arduino_simplefoc_shield_showcase). |
9 | 12 |
|
10 |
| -<p> <img src="extras/Images/shield_top_v13.png" height="200px"> <img src="extras/Images/shield_v13.png" height="200px"> |
| 13 | +## Arduino SimpleFOC Shield |
| 14 | +<p> <img src="https://askuric.github.io/Arduino-FOC/extras/Images/shield_top_v13.png" height="300px"> <img src="https://askuric.github.io/Arduino-FOC/extras/Images/shield_v13.png" height="300px"></p> |
11 | 15 |
|
12 | 16 | ### Features
|
13 |
| -- Plug and play capability with the Arduino Simple FOC library |
14 |
| -- Price in the range of \$20-\$40 |
15 |
| -- Gerber files and BOM available Open Source |
16 |
| -- Stackable: running at least 2 motors in the same time |
| 17 | +- **Plug & play**: Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span> |
| 18 | +- **Low-cost**: Price in the range of \$20-\$40 |
| 19 | +- **Open Source**: Gerber files and BOM available |
| 20 | +- **Stackable**: running 2 motors in the same time |
17 | 21 |
|
18 | 22 | ##### If you are interested in this board, find more information on this link: [Arduino Simple FOC Shield](https://askuric.github.io/simplefoc.html)
|
19 | 23 |
|
20 |
| - |
21 |
| -## A short library YouTube demonstration video |
| 24 | +## Arduino SimpleFOClibrary |
22 | 25 | [](https://youtu.be/N_fRYf7Z80k)
|
23 | 26 |
|
24 |
| -This video explains the Simple FOC library basic usage, electronic connections and demonstrates its capabilities. |
| 27 | +This video demonstrates the Simple FOC library basic usage, electronic connections and shows its capabilities. |
25 | 28 |
|
26 |
| -### This project aims to close the gap in the areas: |
27 |
| -- Low cost applications <50$ |
28 |
| -- Low current operation < 5A |
29 |
| -- Simple usage and scalability (Arduino) |
30 |
| - - Plug and play arduino library for beginers |
31 |
| - - Arudino minimal code for easy integration and customisation for different advanced projects |
32 |
| -- Introducing [Arduino FOC shield board](#arduino-simple-foc-shield) |
33 | 29 |
|
34 |
| -#### The closest you can get to FOC support and low cost (I was able to find) is: |
| 30 | +### Features |
| 31 | +- **Arduino compatibe**: Arduino library code |
| 32 | +- **Easy to setup and configure**: |
| 33 | + - Easy hardware configuration |
| 34 | + - Easy [tuning the control loops](https://askuric.github.io/Arduino-FOC/control_loops) |
| 35 | +- **Modular**: |
| 36 | + - Supports as many [sensors , BLDC motors and driver boards](https://askuric.github.io/Arduino-FOC/electrical_connections) as possible |
| 37 | + - Supports as many applicaiton requirements as possible |
| 38 | +- **Plug & play**: Arduino SimpleFOC shield |
| 39 | + |
| 40 | +## Getting Started |
| 41 | +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. |
| 42 | + |
| 43 | +- Full library installation [Docs](https://askuric.github.io/Arduino-FOC/library_download) |
| 44 | +- Minimal code instalation [Docs](https://askuric.github.io/Arduino-FOC/minimal_download) |
| 45 | + |
| 46 | +### Arduino SimpleFOC library installation to Arduino IDE |
| 47 | +#### Arduino Library Manager |
| 48 | +The simplest way to get hold of the library is direclty by using Arduino IDE and its integrated Library Manager. |
| 49 | +- Open Arduino IDE and start Arduino Library Manager by clicking: `Tools > Manage Libraries...`. |
| 50 | +- Serarch for `Simple FOC` library and install the lates version. |
| 51 | +- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`. |
| 52 | + |
| 53 | +### Using Github website |
| 54 | +- Go to the [github repository](https://github.com/askuric/Arduino-FOC) |
| 55 | +- Click first on `Clone or Download > Download ZIP`. |
| 56 | +- Unzip it and place it in `Arduino Libraries` forlder. Windows: `Documents > Arduino > libraries`. |
| 57 | +- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`. |
| 58 | + |
| 59 | +### Using terminal |
| 60 | +- Open terminal and run |
| 61 | +```sh |
| 62 | +cd *arduino libraries folder* |
| 63 | +git clone https://github.com/askuric/Arduino-FOC.git |
| 64 | +``` |
| 65 | +- Reopen Arduino IDE and you should have the library examples in `File > Examples > Simple FOC`. |
| 66 | + |
| 67 | +### SimpleFOC library minimal scketch example |
| 68 | + |
| 69 | +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. |
| 70 | + > This code is completely indepenedet and you can run it as any other Arduino Schetch without the need for any libraries. |
| 71 | +
|
| 72 | +#### Github webiste downlaod |
| 73 | +- Go to [minimal branch](https://github.com/askuric/Arduino-FOC/tree/minimal) |
| 74 | +- Downlaod the code by clicking on the `Clone or Download > Download ZIP`. |
| 75 | +- Unzip it and open the schetch in Arduino IDE. |
| 76 | + |
| 77 | +#### Using terminal |
| 78 | +- Open the terminal: |
| 79 | + ```sh |
| 80 | + cd *to you desired directory* |
| 81 | + git clone -b minimal https://github.com/askuric/Arduino-FOC.git |
| 82 | + ``` |
| 83 | +- Then you just open it with the Arduino IDE and run it. |
| 84 | + |
| 85 | +## Documentation |
| 86 | +Find out more information about the Arduino SimpleFOC project in [docs website](https://askuric.github.io/Arduino-FOC/) |
35 | 87 |
|
36 |
| -<a href="https://odriverobotics.com/" >Odroid</a> | <a href="https://www.youtube.com/watch?v=g2BHEdvW9bU">Trinamic</a> | <a href="https://www.infineon.com/cms/en/product/evaluation-boards/bldc_shield_tle9879/" >Infineon</a> | <a href="https://github.com/gouldpa/FOC-Arduino-Brushless">FOC-Arduino-Brushless</a> |
37 |
| ------------- | ------------- | ------------ | ------------- |
38 |
| -<img src="https://static1.squarespace.com/static/58aff26de4fcb53b5efd2f02/t/5c2c766921c67c143049cbd3/1546417803031/?format=1200w" width="400px"> | <img src="http://i3.ytimg.com/vi/g2BHEdvW9bU/maxresdefault.jpg" width="400px"> | <img src="https://www.infineon.com/export/sites/default/_images/product/evaluation-boards/BLDC_Motor_Shild_with_TLE9879QXA40.jpg_1711722916.jpg" width="400px">| <img src="https://hackster.imgix.net/uploads/attachments/998086/dev_kit_89eygMekks.jpg?auto=compress%2Cformat&w=1280&h=960&fit=max" width="400px"> |
39 |
| -:heavy_check_mark: Open Source | :x: Open Source | :x: Open Source | :heavy_check_mark: Open Source |
40 |
| -:heavy_check_mark:Simple to use | :heavy_check_mark: Simple to use | :heavy_check_mark:Simple to use | :x: Simple to use |
41 |
| -:x: Low cost ($100) | :x: Low cost ($100) | :heavy_check_mark:Low cost ($40) | :heavy_check_mark: Low cost |
42 |
| -:x: Low power (>50A) | :heavy_check_mark: Low power | :heavy_check_mark: Low power | :heavy_check_mark: Low power |
43 | 88 |
|
44 | 89 | ## Arduino FOC repo structure
|
45 | 90 | Branch | Description | Status
|
46 | 91 | ------------ | ------------- | ------------
|
47 | 92 | [master](https://github.com/askuric/Arduino-FOC) | Stable and tested library version | 
|
48 | 93 | [dev](https://github.com/askuric/Arduino-FOC/tree/dev) | Developement library version | 
|
49 | 94 | [minimal](https://github.com/askuric/Arduino-FOC/tree/minimal) | Minimal Arduino example with integrated library | 
|
50 |
| - |
51 |
| - |
52 |
| -# Contents |
53 |
| -- [Installation](#arduino-simple-foc-instalation) |
54 |
| - - [Installing the full Arduino Simple FOC library](#installing-simple-foc-full-library) |
55 |
| - - [Installing the minimal Arduino example](#download-simple-foc-arduino-minimal-example) |
56 |
| -- [Electrical connecitons and schematic](#electrical-connections) |
57 |
| - - [Minimal setup](#all-you-need-for-this-project) |
58 |
| - - [Arduino Simple FOC Shield](#arduino-simple-foc-shield) |
59 |
| - - [Arduino UNO + L6234 driver](#arduino-uno-l6234-driver) |
60 |
| - - [HMBGC gimbal contorller example](#hmbgc-v22) |
61 |
| -- [Code explanation and examples](#arduino-simple-foc-library-code) |
62 |
| - - [Encoder setup](#encoder-setup) |
63 |
| - - [Magentic sensor setup](#magnetic-sensor-setup) |
64 |
| - - [BLDC motor setup](#motor-setup) |
65 |
| - - [Control loop setup](#control-loop-setup) |
66 |
| - - [Voltage control loop](#voltage-control-loop) |
67 |
| - - [Velcoity control loop](#velocity-control-loop) |
68 |
| - - [Angle control loop](#angle-control-loop) |
69 |
| - - [Debugging practice](#debugging) |
70 |
| -- [Future work and work in progress](#work-roadmap) |
71 |
| -- [Contact](#contact) |
72 |
| - |
73 |
| - |
74 |
| - |
75 |
| -# Work Roadmap |
76 |
| -## Future work |
77 |
| -- [ ] Proper introduction of the **Arudino FOC Shield V1.2** |
78 |
| -- [ ] Publish a video tutorial fir using the library and the samples |
79 |
| - - [x] Initial video with simple demonstration |
80 |
| - - [ ] Coding setup and procedure video |
81 |
| - - [ ] Two motors running on HMBGC example |
82 |
| - - [ ] .... |
83 |
| -- [ ] Implement Space Vector Modulation method |
84 |
| - - [ ] Pure SVM |
85 |
| - - [ ] PWM SVM |
86 |
| -- [ ] Implement support for MOSFET control low and high pairs |
87 |
| - |
88 |
| -## Work in progress |
89 |
| -- [x] Make the library accesible in the Arduino Library Manager |
90 |
| -- [x] Make minimal version of the arduino code - all in one arduino file |
91 |
| -- [x] Encoder index proper implementation |
92 |
| -- [x] Enable more dirver types |
93 |
| -- [x] Make support for magnetic encoder AS5048 ABI |
94 |
| -- [x] Make support for magnetic encoder AS5048 SPI |
95 |
| -- [x] Add support for acceleration ramping |
96 |
| -- [x] Velocity Low pass filter |
97 |
| -- [x] Timer interrupt execution rather than in the `loop()` |
98 |
| - - FAIL: Perfromance not improved |
99 |
| -- [x] Sine wave lookup table implementation |
0 commit comments