This is the minimal Arduino example of the Simple FOC arduino library intended for mostly for easier experimentation and modification!
├───arduino_foc_minimal_encoder # Arduino minimal code for running a motor with Encoder
│
└───arduino_foc_minimal_magnetic # Arduino minimal code for running a motor with magnetic sensor
Each of the examples will give you the opportunity to change the PI velocity parameters P
and I
, Low pass filter time constant Tf
, change the control loop in real time and check the average loop execution time, all from the serial terminal.
List of commands:
- P: velocity PI controller P gain
- I: velocity PI controller I gain
- L: velocity PI controller voltage limit
- R: velocity PI controller voltage ramp
- F: velocity Low pass filter time constant
- K: angle P controller P gain
- N: angle P controller velocity limit
- C: control loop
- 0: voltage
- 1: velocity
- 2: angle
- V: get motor variables
- 0: currently set voltage
- 1: current velocity
- 2: current angle
- 3: current target value
Find more information about the motor commands in the docs.simplefoc.com
For those willing to experiment and to modify the code I suggest using the minimal version of the code.
This code is completely independent and you can run it as any other Arduino Sketch without the need for any libraries.
- Make sure you are in minimal branch
- Download the code by clicking on the
Clone or Download > Download ZIP
. - Unzip it and open the sketch in Arduino IDE.
- Open the terminal:
cd *to you desired directory* git clone -b minimal https://github.com/askuric/Arduino-FOC.git
- Then you just open it with the Arduino IDE and run it.
Find out more information about the Arduino SimpleFOC project in docs website
Branch | Description | Status |
---|---|---|
master | Stable and tested library version | |
dev | Development library version | |
minimal | Minimal Arduino example with integrated library |