On this page
Supported microcontrollers
Arduino SimpleFOClibrary supports over 20 different microcontroller architectures, giving you flexibility to choose the best MCU for your specific project needs.
Supported Families
The main families supported off-the-shelf are:
- Arduino (8-bit AVR, UNO R4, DUE, Nano 33)
- STM32 (F1, F4, G4, L4, F7, H7 families)
- ESP32 and ESP8266 (ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6)
- Teensy (3.x and 4.x)
- SAMD21/SAMD51 (Arduino Zero, MKR series)
- Raspberry Pi Pico (RP2040/RP2350)
- Silicon Labs (Arduino Nano Matter) - new in v2.4.0
- Portenta H7 - initial support
- nRF52 - initial support
And we continue extending support to more architectures! π
Choosing the Right Microcontroller
There are three main parameters when choosing the microcontroller for your project:
- Processing power (clock speed, architecture, etc.) - this will determine the performance of the FOC algorithm and the maximum speed of your motor.
- PWM generation capabilities - this will determine the number of motors you can control and the control modes you can use.
- ADC sensing capabilities - this will determine the current sensing options you have for your project.
1. Processing power
When it comes to the processing power, the rule of thumb is:
- The higher the clock speed the better.
- Aim for the FOC execution time of
loopFOC()to be above 1kHz (ideally above 5kHz) depending on the motor and sensor combination you are using.
This table gives you a rough comparison of the performance of different MCUs with this library. It gives an estimated loop frequency (loopFOC() + move()) for one motor and sensor combination (BLDC + sensor) that you can expect to achieve with the library on each MCU. The values are approximate and can vary depending on the specific board, motor, sensor, and other factors.
| MCU Family | Clock | Bit | Performance | Expected loop frequency | Example boards | Recommended For |
|---|---|---|---|---|---|---|
| STM32 H7 | 480MHz | 32 | π’ Prime | >10kHz | Nucleo-144 | High-performance, multi-motor systems, High-end solution |
| STM32 F4/G4/F7 | 150-220 | 32 | π’ Excellent | >5kHz | Nucleo-64, Nucleo-144, B-G431B-ESC1 | Best overall choice for FOC control |
| STM32 F1 | 72Hz | 32 | π’ Good | 1-5kHz | Bluepill, Blackpill | Budget-friendly, good performance (β οΈ sometimes limited in memory) |
| STM32 L4 | 80MHz | 32 | π’ Good | 1-5kHz | Nucleo-64 | Low-power applications, good performance |
| Teensy 4.x | 600MHz | 32 | π’ Prime | >10kHz | Teensy 4.0, 4.1 | High-performance, High-end solution, comparable to STM32H7 (limited low-side ADC support) |
| Teensy 3.x | 72-180MHz | 32 | π’ Good | 1-5kHz | Teensy 3.2, 3.5, 3.6 | Robotics, reliable real-time control |
| ESP32, ESP32-S2/S3 | 240MHz | 32 | π’ Excellent | >5kHz | ESP32 DevKit, ESP3S2 QtPy | Great performance, IoT integration, Dual-Core |
| ESP32-C2/C3/C6 | 120-160MHz | 32 | π’ Good | 1-5kHz | ESP3C6 Xiao, ESP3C6 Xiao | Good performance Much worse than ESP32 or ESP32-S2/3 though |
| RP2040 (Pico) | 125MHz | 32 | π’ Good | 5-10kHz | Raspberry Pi Pico | Dual-core projects, cost-effective |
| Arduino DUE | 84MHz | 32 | π‘ Fair | 1-5kHz | Arduino DUE | 32-bit Arduino, good option if you already have one on hand |
| SAMD51 | 120MHz | 32 | π’ Good | 5-10kHz | Adafruit Feather M4, SparkFun Thing Plus, Metro M4 | Good performance, not common |
| SAMD21 | 48MHz | 32 | π‘ Fair | 1-5kHz | Nano 33 IoT, QtPy SAMD21, XIAO SAMD21 | Budget-friendly, OK performance (β οΈ sometimes limited in memory) |
| Renesas | 48MHz | 32 | π‘ Fair | 1-5kHz | Arduino UNO R4 | Modern Arduino, not the best performance but a significant upgrade over the AVR-based UNO |
| Silabs MGM240S | 78MHz | 32 | π’ Good | 5-10kHz | Arduino Nano Matter | Matter/IoT integration (v2.4.0+) |
| AVR (8-bit) | 16MHz | 8 | π΄ Limited | <1kHz | Arduino UNO, Arduino MEGA, Arduino Nano, Arduino Leonardo | Learning FOC, simple single-motor projects |
| ESP8266 | 80MHz | 32 | π΄ Limited | <1kHz | ESP8266 NodeMCU, Wemos D1 Mini | Good for IoT projects, very limited real-time performance |
β οΈ Arduino UNO/MEGA Encoder Limitation
For Arduino UNO/MEGA with encoders, keep total system pulses under 20,000 pulses/second to avoid execution issues.Example Calculation
With a 10,000 CPR encoder: Maximum motor speed = 120 RPM (2 rotations/second)
Recommendation: Use magnetic sensors (SPI/I2C) instead of encoders with 8-bit Arduino boards.
Performance Guidelines:
- β Optimal: Loop time < 0.5ms (>2kHz)
- β οΈ Acceptable: Loop time 1-4ms (250-1000Hz)
- β Poor: Loop time > 4ms (<250Hz)
Multi-Motor Systems: If you need to control multiple motors, remember to account for the total system load. Divide the expected loop frequency by the number of motors to ensure you stay within performance limits. The same performance guidelines apply.
2. PWM Generation Capabilities
Most supported MCUs can generate all PWM modes (2, 3, 4, and 6 PWM) with configurable frequencies. 2 and 4 PWM modes are used Stepper drivers (Stepper motors), while 3 and 6 PWM modes are used for BLDC drivers (BLDC motors and Steppers using hybrid control).
| MCU | 2 PWM | 4 PWM | 3 PWM | 6 PWM | Frequency Config |
|---|---|---|---|---|---|
| Arduino (8-bit) | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ (4kHz or 32kHz) |
| STM32 | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| ESP32 (MCPWM/LEDC) | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| Teensy | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| SAMD21/51 | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| Raspberry Pi Pico | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| Renesas (UNO R4) | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| Arduino Nano Matter | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| nRF52 | βοΈ | βοΈ | βοΈ | βοΈ | βοΈ |
| Arduino DUE | βοΈ | βοΈ | βοΈ | β | βοΈ |
| ESP8266 | βοΈ | βοΈ | βοΈ | β | βοΈ |
| Portenta H7 | βοΈ | βοΈ | βοΈ | β | βοΈ |
Note: If you need 6 PWM mode (for specific drivers), avoid MCUs marked with β.
See the guide to choosing PWM-capable pins
3. Current Sensing (ADC) Capabilities
Most of the supported MCUs can perform inline current sensing using the ADC, which is the a very common method for FOC control. However, low-side current sensing is equaly as common for high-performance applications and is supported by a smaller subset of high-end MCUs. Make sure to check the table below if you need low-side sensing for your project.
| MCU | Inline | Low-side | High-side | Notes |
|---|---|---|---|---|
| STM32 F1/F4/G4/L4/F7/H7 | βοΈ | βοΈ | β | Best current sensing support |
| ESP32/ESP32-S3 | βοΈ | βοΈ | β | Good ADC, dual-core advantage |
| Teensy 4 | βοΈ | βοΈ (one motor) | β | High-speed ADC |
| SAMD21 | βοΈ | βοΈ (one motor) | β | Limited testing |
| Arduino Nano Matter | βοΈ | βοΈ (one motor) | βοΈ (untested) | Newest support (v2.4.0) |
| Arduino AVR (8-bit) | βοΈ | β | β | Inline only |
| Arduino DUE | βοΈ | β | β | Inline only |
| SAMD51 | βοΈ | β | β | Inline only |
| Teensy 3 | βοΈ | β | β | Inline only |
| Raspberry Pi Pico | βοΈ | β | β | Inline only |
| ESP32-S2/C3 | βοΈ | β | β | Inline only |
| Portenta H7 | βοΈ | β | β | Inline only |
| nRF52 | βοΈ | β | β | Inline only |
| Renesas (UNO R4) | β | β | β | No current sensing yet |
| ESP8266 | β | β | β | No ADC support for sensing |
| STM32 B-G431B-ESC1 | β | βοΈ (one motor) | β | Dedicated ESC board |
Most boards support inline current sensing. Low-side sensing is available primarily on STM32, ESP32, Teensy 4, and SAMD21.
See the guide to choosing ADC-capable pins
Quick Selection Guide
General Recommendations
- If possible, use STM32 - Best overall choice for FOC control
- ESP32 or Teensy - Excellent alternatives, each one with their own strengths and limitations
- Other 32-bit boards - Fine if current sensing isnβt required or not crucial for your project
- 8-bit Arduino - Acceptable for learning and simple single-motor projects
- Custom optimization - If you have specific requirements, start with what you have and optimize the library for your use case
Specific Use Cases
Best Overall Performance:
- STM32 H7 - Top-tier performance for demanding applications and multi-motor systems
- STM32 F4/G4/F7 - Excellent performance and features for most FOC projects
Alternative High-Performance Options with some limitations
- Teensy 4.x - Amazing performance (comparable to STM32 H7), can handle fast multi-motor systems
- β οΈ limited low-side sensing support (one motor only)
- ESP32 - Excellent for IoT/wireless projects, great performance
- If possible, choose ESP32 or ESP32-S3 for better ADC performance and low-side sensing support
- If using ESP32C2/C3/C6, be aware of the significantly lower CPU performance and lack of low-side sensing support
- β οΈ Aim for one motor with current sensing for optimal performance,
- multi-motor systems with current sensing may require optimization and careful load management
- multiple motors without current sensing should be fine
Budget-Friendly with Good Performance:
- Need current sensing?
- STM32 F1 - Best price/performance ratio (especially Bluepill/Blackpill boards)
- β οΈ check memory limits (use 128KB flash versions)
- SAMD21 - Affordable with good enough performance for simple projects
- β οΈ check memory limits (should have more than 64kB flash)
- STM32 F1 - Best price/performance ratio (especially Bluepill/Blackpill boards)
- Donβt need current sensing?
- Arduino DUE - 32-bit Arduino with good performance if you already have one on hand
- Raspberry Pi Pico (RP2040) - Dual-core capability at low cost, good for projects without current sensing
- nRF52 - Good for low-power wireless projects without current sensing
- SAMD51 - Good performance but less common, check availability
Other Options:
- Arduino UNO/MEGA - Acceptable for learning and simple single-motor projects
- β οΈ limited performance with encoders, use magnetic sensors instead
- β οΈ poor current sensing capabilities (inline only, no low-side sensing)
- ESP8266 - Good for IoT projects, very limited real-time performance, not recommended for FOC control
- β οΈ no ADC support for sensing, not suitable for FOC control
SimpleFOC Community
If you have ported the library to another device or need help porting to a specific platform, please visit our community forum!
Youβll find answered questions, implementation stories, and helpful community members ready to assist.