Skip to content

Coder-Soder/Arduino-FOC

Repository files navigation

Arduino Simple FOC library minimal example

MinimalBuild License: MIT arduino-library-badge

This is the minimal Arduino example of the Simple FOC arduino library intended for mostly for easier experimentation and modification!

Minimal repository structure

├───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 
                                   # AS5048/47   

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.

PI controller parameters change:
- P value : Prefix P (ex. P0.1)
- I value : Prefix I (ex. I0.1)

Velocity filter:
- Tf value : Prefix F (ex. F0.001)

Average loop execution time:
- Type T

Control loop type:
- C0 - angle control
- C1 - velocity control
- C2 - voltage control

Initial parameters:
PI velocity P: 0.20,	 I: 20.00,	 Low pass filter Tf: 0.0000

Installation

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.

Github website download

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

Using terminal

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

Documentation

Find out more information about the Arduino SimpleFOC project in docs website

Arduino FOC repo structure

Branch Description Status
master Stable and tested library version Library Compile
dev Development library version Library Dev Compile
minimal Minimal Arduino example with integrated library MinimalBuild

About

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.0%
  • C 5.0%