-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
388 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
layout: default | ||
title: <span class="simple">Simple<span class="foc">DC</span>Motor</span> | ||
nav_order: 1 | ||
permalink: /dc_motors_library | ||
parent: libraries | ||
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
has_children: False | ||
has_toc: False | ||
--- | ||
|
||
|
||
# <span class="simple">Simple<span class="foc">DC</span> Motor</span> library | ||
|
||
![Library Compile](https://github.com/simplefoc/Arduino-FOC-dcmotor/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/SimpleDCMotor.svg?) | ||
|
||
|
||
The <span class="simple">Simple<span class="foc">DC</span>Motor library</span> extends <span class="simple">Simple<span class="foc">FOC</span> library to handle DC motors via their commonly used driver types. | ||
|
||
## What is it? | ||
|
||
A collection of `DCDriver` classes and a `DCMotor` class that build on <span class="simple">Simple<span class="foc">FOC</span>library</span>. | ||
|
||
## What's in there? | ||
|
||
- `DCMotor` class | ||
- `DCDriver` classes for different DC motor driver types | ||
- Some examples how to use them | ||
|
||
## What's the advantage? | ||
|
||
- The core library doesn't work with DC motors, that's not its purpose. This library adds DC motor functionality. | ||
|
||
- This lets you use the many sensor drivers available in SimpleFOC, as well as helpful classes like the Commander, when working with DC motors also. | ||
|
||
- And it allows you to use SimpleFOC's control architecture to use closed loop control, so in combination with a sensor, you can turn even a cheap DC motor into an accurate digital servo. | ||
|
||
## How can I use it? | ||
|
||
```cpp | ||
#include "SimpleDCMotor.h" | ||
``` | ||
|
||
It is in the arduino library manager, called "SimpleDCMotor". Install as normal for arduino libraries in Arduino IDE or PlatformIO. | ||
|
||
Please see the readme file on github and the library examples for how to use it. | ||
|
||
### GitHub | ||
|
||
You can find the source code for the library here: [https://github.com/simplefoc/Arduino-FOC-dcmotor](https://github.com/simplefoc/Arduino-FOC-dcmotor). | ||
|
||
|
||
## Documentation | ||
|
||
Please see the documentation on github. Note that there is additional documentation in the `drivers` subdirectory describing the individual DC motor drivers. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
layout: default | ||
title: libraries | ||
parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
description: "Arduino Simple Field Oriented Control (FOC) library ." | ||
nav_order: 1 | ||
permalink: /additional_libraries | ||
has_children: True | ||
has_toc: False | ||
--- | ||
|
||
|
||
# <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
In the context of the <span class="simple">Simple<span class="foc">FOC</span>project</span> many different open-source community projects have been developed. | ||
|
||
|
||
## Arduino libraries | ||
|
||
- ### <span class="simple">Simple<span class="foc">FOC</span>Drivers</span> | ||
|
||
This library contains an assortment of drivers and supporting code for <span class="simple">Simple<span class="foc">FOC</span>library</span>. | ||
|
||
|
||
The intent is to keep the core of <span class="simple">Simple<span class="foc">FOC</span>library</span> clean, and thus easy to maintain, understand and port to different platforms. In addition to this core, there are various drivers and supporting code which has grown around <span class="simple">Simple<span class="foc">FOC</span>library</span>, and which we would like to make available to the community. [Read more ...](drivers_library) | ||
|
||
<a href ="https://github.com/simplefoc/Arduino-FOC-drivers" class="btn"><i class="fa fa-github"></i> Github repo</a> | ||
|
||
- ### <span class="simple">Simple<span class="foc">DC</span>Motor</span> | ||
|
||
<span class="simple">Simple<span class="foc">FOC</span>library</span> is really intended for field oriented control of PMSM/BLDC motors, it's in the name ;-). But for different reasons, sometimes DC motors are preferred, and while we're not focused on this use-case, we do have a fair amount of code that can be leveraged to help with DC-Motor control applications. | ||
|
||
|
||
So this represents a less-supported effort to provide some useful building blocks for DC-Motors. [Read more ...](dc_motors_library) | ||
|
||
<a href ="https://github.com/simplefoc/Arduino-FOC-dcmotor" class="btn"><i class="fa fa-github"></i> Github repo</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
layout: default | ||
title: tools | ||
parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
description: "Arduino Simple Field Oriented Control (FOC) library ." | ||
nav_order: 2 | ||
permalink: /additional_tools | ||
has_children: True | ||
has_toc: False | ||
--- | ||
|
||
|
||
# <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
In the context of the <span class="simple">Simple<span class="foc">FOC</span>project</span> many different open-source community projects have been developed. | ||
|
||
|
||
## User interface applications | ||
|
||
- ### <span class="simple">Simple<span class="foc">FOC</span>Studio</span> by [@jorgemaker](https://github.com/JorgeMaker) | ||
|
||
Graphical user interface for the <span class="simple">Simple<span class="foc">FOC</span>library</span> based on python3 and PyQt5. This application allows to tune and configure any BLDC/Stepper <span class="simple">Simple<span class="foc">FOC</span>library</span> controlled device, using serial port communications and the [Commander](commander_interface) interface. [Read more ... ](studio) | ||
|
||
<a href ="https://github.com/simplefoc/Arduino-FOC-dcmotor" class="btn"><i class="fa fa-github"></i> Github repo</a> | ||
|
||
- ### <span class="simple">Simple<span class="foc">FOC</span>webcontroller</span> by [@geekuillaume](https://github.com/geekuillaume) | ||
|
||
This is a controller interface for the <span class="simple">Simple<span class="foc">FOC</span>library</span>. It uses WebSerial to communicate with a suitable micro-controller using serial port communications and the [Commander](commander_interface) interface. [Read more ... ](webcontroller) | ||
|
||
<a href ="https://github.com/geekuillaume/simplefoc-webcontroller" class="btn btn"><i class="fa fa-github"></i> Github repo</a> <a href ="https://webcontroller.simplefoc.com/" class="btn btn-primary"><i class="fa fa-github"></i> Open <span class="simple">Simple<span class="foc">FOC</span>webcontroller</span></a> | ||
|
||
- ### <span class="simple">Simple<span class="foc">FOC</span>Generator</span> by [@stijnsprojects](https://github.com/stijnsprojects) | ||
|
||
A web application which helps you generate <span class="simple">Simple<span class="foc">FOC</span>library</span> arduino sketches based on the hardware that you are using. | ||
|
||
<a href ="https://github.com/stijnsprojects/simplefocgenerator" class="btn btn"><i class="fa fa-github"></i> Github repo</a> <a href ="https://stijnsprojects.github.io/simplefocgenerator/" class="btn btn-primary"><i class="fa fa-github"></i> Open <span class="simple">Simple<span class="foc">FOC</span>Generator</span></a> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
layout: default | ||
title: Simple<b>FOC</b>WebController | ||
nav_order: 3 | ||
permalink: /webcontroller | ||
parent: tools | ||
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span> | ||
--- | ||
|
||
# *Simple**FOC**WebController* <small>by [@geekuillaume](https://github.com/geekuillaume) </small> | ||
|
||
This is a controller interface for the <span class="simple">Simple<span class="foc">FOC</span>library</span>. It uses WebSerial to communicate with a suitable micro-controller using serial port communications and the [Commander](commander_interface) interface. | ||
|
||
Most of the code for this application was provided by [@geekuillaume](https://github.com/geekuillaume), his github repository can be found [here](https://github.com/geekuillaume/simplefoc-webcontroller) and his application can be found [here](https://simplefoc.besson.co/). | ||
Our app is a fork of his code, that has been further extended to support more devices and configuration parameters, as well as to ease the monitoring visualisation. | ||
|
||
<a href ="https://github.com/geekuillaume/simplefoc-webcontroller" class="btn btn"><i class="fa fa-github"></i> Github repo</a> <a href ="https://webcontroller.simplefoc.com/" class="btn btn-primary"><i class="fa fa-github"></i> Open <span class="simple">Simple<span class="foc">FOC</span>webcontroller</span></a> | ||
|
||
|
||
|
||
<img src="extras/Images/webcontroller.gif" > | ||
|
||
<blockquote class="info"> | ||
<p class="heading">📢 Early stage project</p> | ||
This project is still in its early stage, we are counting on your patience and looking forward to hear your feedback. As there are many people in the community with far more knowledge about these kinds of apps than we do, don't hesitate to leave the issues and do the pull requests. | ||
</blockquote> | ||
|
||
### Features: | ||
- Plug and play with the *Simple**FOC**library* version 2.3+ | ||
- Real-time tuning and configuration of the motors | ||
- Real-time plotting and monitoring of motor variables | ||
- Support for multiple motors | ||
|
||
|
||
## Using the *Simple**FOC**WebController* | ||
|
||
<a href ="https://webcontroller.simplefoc.com/" class="btn btn-primary"><i class="fa fa-github"></i> Open <span class="simple">Simple<span class="foc">FOC</span>webcontroller</span></a> | ||
|
||
*Simple**FOC**WebController* does not require any installation, its only requirement is that your browser has `WebSerial` support. Check the supportedd browsers [here](https://caniuse.com/web-serial). | ||
|
||
### Motion control tunning blocks | ||
Once you have your application running in your browser, connected to your microcontroller running the <span class="simple">Simple<span class="foc">FOC</span>library</span>. You can easily change most of the control parameters of different motion control loops and visualise different monitored variables. | ||
|
||
<img src="extras/Images/webcontroller_motor.png" class="width80"> | ||
|
||
### Integrated serial terminal | ||
|
||
*Simple**FOC**WebController* also has integrated serial terminal for easier debugging and monitoring. | ||
|
||
<img src="extras/Images/webcontroller_init.png" class="width80"> | ||
|
||
|
||
## Arduino code | ||
Basically there are three things you need to do: | ||
1. Use the commander interface and add the motor to the commander | ||
2. Use the monitoring and add the `motor.monitor()` in the loop | ||
3. Make set the `motor.monitor_start_char` and `motor.monitor_end_char` to the same character as the motor id added to the commander | ||
|
||
Here is a mockup of the code: | ||
|
||
```cpp | ||
#include <SimpleFOC.h> | ||
|
||
.... | ||
|
||
// include commander interface | ||
Commander command = Commander(Serial); | ||
void doMotor(char* cmd) { command.motor(&motor, cmd); } | ||
|
||
void setup(){ | ||
.... | ||
// add the motor to the commander interface | ||
// The letter id (here 'M') of the motor | ||
char motor_id = 'M'; | ||
command.add(motor_id,doMotor,'motor'); | ||
// tell the motor to use the monitoring | ||
motor.useMonitoring(Serial); | ||
// configuring the monitoring to be well parsed by the webcontroller | ||
motor.monitor_start_char = motor_id; // the same latter as the motor id in the commander | ||
motor.monitor_end_char = motor_id; // the same latter as the motor id in the commander | ||
|
||
commander.verbose = VerboseMode::machine_readable; // can be set using the webcontroller - optional | ||
... | ||
|
||
} | ||
void loop(){ | ||
.... | ||
|
||
.... | ||
// real-time monitoring calls | ||
motor.monitor(); | ||
// real-time commander calls | ||
command.run(); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.