Link

Arduino Simple Field Oriented Control (FOC) project

Library Compile License: MIT arduino-library-badge status

GitHub release (latest by date) GitHub Release Date GitHub commits since tagged version GitHub commit activity (branch)

We live in very exciting times 😃! BLDC motors are entering the hobby community more and more and many great projects have already emerged leveraging their far superior dynamics and power capabilities. BLDC motors have numerous advantages over regular DC motors but they have one big disadvantage, the complexity of control. Even though it has become relatively easy to design and manufacture PCBs and create our own hardware solutions for driving BLDC motors the proper low-cost solutions are yet to come. One of the reasons for this is the apparent complexity of writing the BLDC driving algorithms, Field oriented control (FOC) being an example of one of the most efficient ones. The solutions that can be found on-line are almost exclusively very specific for certain hardware configuration and the microcontroller architecture used. Additionally, most of the efforts at this moment are still channeled towards the high-power applications of the BLDC motors and proper low-cost and low-power FOC supporting boards are very hard to find today and even may not exist.
Therefore this is an attempt to:

NEWS 📢: SimpleFOClibrary has been published in the Journal of Open Source Software read more

SimpleFOC: A Field Oriented Control (FOC) Library for Controlling Brushless Direct Current (BLDC) and Stepper Motors.
A. Skuric, HS. Bank, R. Unger, O. Williams, D. González-Reyes
Journal of Open Source Software, 7(74), 4232

NEW RELEASE 📢: SimpleFOClibrary v2.2.3 see release

  • stm32 low-side current sensing
    • g4 supported
    • thoroughly tested f1/f4/g4 - #187
    • bg431b: added support for VBAT and TEMPERATURE readings #222
  • bugfixing
    • leonardo
    • mega2560 #190
    • inline current sense without driver #188
    • bg431b support current sense fix #210
    • StepperDriver4PWM wrong init #182
    • open loop back-emf voltage issue #219
    • SAMD51 compile issue #217
    • ESP32-S3 compile issue #198
    • ESP32 compile issue #208, #207
    • magnetic sensor direction finding more robust #173, #164
    • StepDirListener improved timing #169, #209
    • HallSensor velocity calculation fix #192
  • API changes
    • setPhaseVoltage is now public function
    • getVelocity can now be called as many times as necessary - see in docs
      • it recalculates the velocity if the time between calls is longer then min_elapsed_time - default 0.1ms
    • HallSensor velocity calculation outlier removal using max expected velocity velocity_max - see in docs
    • BG431 board can be used only with LowsideCurrentSense class! - see in docs
    • initFOC fails if current sense not initialised - see in docs
      • driver and current sense have to be well initialised for initFOC to start - see in docs
      • cs.init() and driver.init() return 1 if well initialised and 0 if failed

Arduino SimpleFOClibrary v2.2.3

This video demonstrates the Simple FOC library basic usage, electronic connections and shows its capabilities.

Features

  • Easy install:
    • Arduino IDE: Arduino Library Manager integration
    • PlatformIO
  • Open-Source: Full code and documentation available on github
  • Goal:
    • Support as many sensor + motor + driver + current sense combination as possible.
    • Provide the up-to-date and in-depth documentation with API references and the examples
  • Easy to setup and configure:
  • Cross-platform:
    • Seamless code transfer from one microcontroller family to another
    • Supports multiple MCU architectures:
      • Arduino: UNO, MEGA, DUE, Leonardo ….
      • STM32
      • ESP32
      • Teensy
      • many more …

Arduino SimpleFOCShield v2.0.4

Features

  • Plug & play: In combination with Arduino SimpleFOClibrary - github
  • Low-cost: Price of €15 - Check the pricing
  • In-line current sensing: Up to 3Amps/5Amps bidirectional
    • configurable: 3.3Amps - 3.3V adc, 5Amps - 5V adc
  • Integrated 8V regulator:
    • Enable/disable by soldering pads
  • Max power 120W - max current 5A, power-supply 12-35V
    • Designed for Gimbal motors with the internal resistance >10 Ωs.
  • Stackable: running 2 motors in the same time
  • Encoder/Hall sensors interface: Integrated 3.3kΩ pullups (configurable)
  • I2C interface: Integrated 4.7kΩ pullups (configurable)
  • Configurable pinout: Hardware configuration - soldering connections
  • Arduino headers: Arduino UNO, Arduino MEGA, STM32 Nucleo boards…
  • Open Source: Fully available fabrication files - how to make it yourself

Alternative FOC supporting projects

These are just a few of the alternative FOC supporting projects which provide hardware and software solutions.

OdriveTrinamicInfineonFOC-Arduino-Brushless
✔️ Open Source❌ Open Source✔️ Open Source(recently)✔️ Open Source
✔️Simple to use✔️ Simple to use✔️Simple to use❌ Simple to use
❌ Low cost ($100)❌ Low cost ($100)✔️Low cost ($40)✔️ Low cost
❌ Low power (>50A)✔️ Low power✔️ Low power✔️ Low power
❌ Stepper support❌ Stepper support❌ Stepper support❌ Stepper support