The SimpleFOC library includes 88+ fully documented examples covering various hardware configurations and control modes.
Examples optimized for specific hardware platforms:
- B_G431B_ESC1 - STM32 B-G431B-ESC1 development board
- Bluepill - STM32 Bluepill boards
- DRV8302 - DRV8302/DRV8305 motor drivers
- ESP32 - ESP32 microcontrollers with MCPWM and LEDC
- SAMD - SAMD21/51 boards (Arduino Zero, MKR series)
- Silabs - Silicon Labs (Arduino Nano Matter)
- Teensy - Teensy 3.x and 4.x boards
- SimpleFOCShield - SimpleFOCShield v1, v2, and v3
- SimpleFOCMini - SimpleFOCMini board
- PowerShield - SimpleFOC PowerShield
- HMBGC - HMBGC gimbal controller
- ODrive - ODrive boards
- SmartStepper - Smart Stepper configurations
Different control modes with various sensor types:
- Voltage-based torque control - encoder | hall sensor | magnetic sensor
- Current-based torque control (FOC with current sensing) - encoder
- Velocity control with encoder
- Velocity control with hall sensor
- Velocity control with magnetic sensor
- Position/angle control with encoder
- Position control with hall sensor
- Position control with magnetic sensor
- Open-loop velocity control (sensorless)
- Open-loop position control (sensorless)
- Custom motion control loop implementation
- Find pole pair number
- Find KV rating
- Find sensor offset and direction
- Measure inductance and resistance
- Alignment and cogging test
- BLDC 3PWM driver standalone test
- BLDC 6PWM driver standalone test
- Stepper 2PWM driver standalone test
- Stepper 4PWM driver standalone test
- Encoder testing (hardware and software interrupts)
- Hall sensor testing
- Magnetic sensor testing (SPI, I2C, Analog)
Examples showing full motor control via serial interface:
Open Sound Control (OSC) integration:
- Arduino IDE: Go to
File > Examples > Simple FOC > [category] > [example] - PlatformIO: Copy example code from the
examples/directory - GitHub: Browse examples at https://github.com/simplefoc/Arduino-FOC/tree/master/examples
Each example includes:
- Detailed comments explaining the code
- Hardware connection diagrams (where applicable)
- Expected behavior description
- Common troubleshooting tips
- Documentation: https://docs.simplefoc.com
- Community Forum: https://community.simplefoc.com
- GitHub Issues: https://github.com/simplefoc/Arduino-FOC/issues