Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
askuric committed Mar 18, 2023
2 parents 0d2168a + 94deb57 commit d791fcc
Show file tree
Hide file tree
Showing 27 changed files with 388 additions and 93 deletions.
7 changes: 5 additions & 2 deletions _includes/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ var classProps = [
"index_search_velocity",
"controller",
"velocity_limit",
"skip_align"
"skip_align",
"monitor_start_char",
"monitor_end_char"
];

var funcNames = [
Expand Down Expand Up @@ -217,7 +219,8 @@ var structProps = [
"CCW",
"nothing",
"on_request",
"user_friendly"
"user_friendly",
"machine_readable"
];
jtd.onReady(function(){
document.querySelectorAll('.n').forEach(function(e) {
Expand Down
16 changes: 8 additions & 8 deletions docs/simplefoc_libraries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: default
title: <span class="simple">Simple<span class="foc">FOC</span>utils</span>
description: "Arduino Simple Field Oriented Control (FOC) library ."
nav_order: 5
permalink: /arduino_simplefoc_libraries
permalink: /arduino_simplefoc_utils
has_children: True
has_toc: False
---
Expand All @@ -24,12 +24,12 @@ In the context of the <span class="simple">Simple<span class="foc">FOC</span>pro

<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> - <i>coming soon!</i>
- ### <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.
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>

Expand All @@ -42,15 +42,15 @@ In the context of the <span class="simple">Simple<span class="foc">FOC</span>pro

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

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

<a href ="https://github.com/geekuillaume/simplefoc-webcontroller" class="btn btn"><i class="fa fa-github"></i> Github repo</a> <a href ="https://docs.simplefoc.com/simplefoc-webcontroller/" class="btn btn-primary"><i class="fa fa-github"></i> Open <span class="simple">Simple<span class="foc">FOC</span>webcontroller</span></a>

60 changes: 60 additions & 0 deletions docs/simplefoc_libraries/libraries/dc_motors_library.md
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.



Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ layout: default
title: <span class="simple">Simple<span class="foc">FOC</span>Drivers</span>
nav_order: 1
permalink: /drivers_library
parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span>
parent: libraries
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span>
has_children: False
has_toc: False
---
Expand Down
35 changes: 35 additions & 0 deletions docs/simplefoc_libraries/libraries/index.md
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>
36 changes: 36 additions & 0 deletions docs/simplefoc_libraries/tools/index.md
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>

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ layout: default
title: Simple<b>FOC</b>Studio
nav_order: 2
permalink: /studio
parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span>
parent: tools
grand_parent: <span class="simple">Simple<span class="foc">FOC</span>utils</span>
---

# *Simple**FOC**Studio* <small>by [@JorgeMaker](https://github.com/JorgeMaker) </small>
Expand Down
95 changes: 95 additions & 0 deletions docs/simplefoc_libraries/tools/webcontroller.md
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();
}
```
3 changes: 2 additions & 1 deletion docs/simplefoc_library/cheatsheet/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ motor.controller | MotionControlType::torque | Motion control mode
motor.torque_controller | TorqueControlType::voltage | Torque control mode
motor.motion_downsample | 0 | Set to values > 1 to reduce how often move() is executed compared to loopFOC(). On fast MCUs it makes sense to reduce how often move() gets called.
motor.phase_resistance | NOT SET | Motor phase resistance. If set, used to calculate current limits based on voltage limits. Value in Ohms.
motor.K_bemf | NOT SET | motor back emf constant, as 1/KV. Units 1/rad/s/V. Set via motor constructor, where you can specify KV in RPM/V.
motor.KV_rating | NOT SET | motor KV rating, RMS value. Can also be set via motor constructor, where you can specify KV in RPM/V.
motor.phase_inductance | NOT SET | motor inductance, in H. Units Henry. Can also be set via motor constructor.
motor.voltage_limit | 12V | Global voltage limit. Limits Q-axis voltage.
motor.current_limit | 2A | Global current limit. Limits Q-axis current.
motor.velocity_limit | 20rad/s | Global velocity limit. Value in rad/s.
Expand Down
Loading

0 comments on commit d791fcc

Please sign in to comment.