Introduction
Proper low-cost and low-power FOC supporting boards are very hard to find these days and even may not exist.
Even harder to find is a stable and simple FOC algorithm code capable of running on Arduino devices. Therefore this is an attempt to:
- Demystify FOC algorithm and make a robust but simple Arduino library: Arduino SimpleFOC library
- Develop a modular BLDC driver board: Arduino SimpleFOC shield.
Features
- Arduino compatible: Arduino library code
- Easy to setup and configure:
- Easy hardware configuration
- Easy tuning the control loops
- Modular:
- Supports as many sensors , BLDC motors and driver boards as possible
- Supports as many application requirements as possible
- Plug & play: Arduino SimpleFOC shield
Supported Hardware
- Motors
- BLDC motors
- Stepper motors
- Hybrid Stepper motors
Drivers
- BLDC drivers
- Gimbal drivers
- Stepper drivers
Position sensors
- Encoders
- Magnetic sensors
- Hall sensors
Microcontrollers
- Arduino
- STM32
- ESP32
- Teensy
- many more ...
How to Use Examples
- 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
Example code
void setup() {
}
void loop() {
}
@ velocity
Velocity motion control.
virtual void linkDriver(BLDCDriver *driver)
void enableInterrupts(void(*doA)()=nullptr, void(*doB)()=nullptr, void(*doIndex)()=nullptr)
float voltage_power_supply
power supply voltage
void linkSensor(Sensor *sensor)
MotionControlType controller
parameter determining the control loop to be used
virtual void move(float target=NOT_SET)
License
MIT license, all text here must be included in any redistribution.