Link

Arduino Simple Field Oriented Control (FOC) project

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:

  • 🎯 Demystify FOC algorithm and make a robust but simple Arduino library: Arduino SimpleFOClibrary
    • Support as many motor + sensor + driver + mcu combinations out there
  • 🎯 Develop modular and easy to use FOC supporting BLDC driver boards

NEW RELEASE πŸ“’: SimpleFOClibrary v2.3.3 see release

  • STM32 MCUs
    • support for center aligned pwm (even across multiple timers and motors/drivers) #374, #388
    • support for DMA based low-side current sensing: #383,#378
    • support for F7 architecture #388,#394
  • Teensy4 MCUs
    • support for low-side current sensing #392
    • support for center aligned 6pwm and 3pwm (optional) #392
  • KV rating calculation fix #347
  • Much more performant Park/Clarke calculation #340
  • And much more - see the complete list of bugfixes and new features of v2.3.3 fixes and PRs
  • Docs

Arduino SimpleFOClibrary

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, Nano, UNO R4, MKR ….
      • 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

Over the period of the past few years several cool FOC supporting projects which provide hardware and software solutions have emerged, here are some of them. None of the projects listed uses SimpleFOC.

ProjectOpen Source HardwareOpen source firmwareSimple to useLow costPower ratingStepper Support

Odrive
βœ”οΈ/(❌ from recently)βœ”οΈ/(❌ from recently)βœ”οΈβŒ (>200$)High >50A❌

Vesc
βœ”οΈβœ”οΈβœ”οΈβŒ (>100$)Vey High >100A❌

Trinamic
βŒβŒβœ”οΈβŒ (>200$)Low ~10Aβœ”οΈ

Infineon
βœ”οΈβŒβœ”οΈβœ”οΈ (50$)Low ~10A❌

FOC-Arduino-Brushless
βœ”οΈβœ”οΈβŒβœ”οΈ (Price ?)Low ~10A❌

Tinymovr R5.2
βŒβœ”οΈβœ”οΈβŒ (~90$)High (~30A)❌

Tinymovr M5.2
βŒβœ”οΈβœ”οΈβŒ (~90$)Low (~6Amps)❌

Mjbots moteus
βŒβœ”οΈβœ”οΈβŒ (80-160$)Mid (9-22Amps)❌


Open robotics initiative
MicroDriver
βœ”οΈβœ”οΈβŒβœ”οΈ(~50$)Mid (-20Amps)❌


SOLO
βŒβŒβœ”οΈβŒ(70$-600$)Mid (-16Amps) to Very high (-120Amps)❌
⚠️ This list is certainly not exhaustive, feel free to contribute to extending/completing/correcting it!