Arduino SimpleFOClibrary implements support for two types of Stepper driver control interfaces:
StepperDriver4PWM provide an abstraction layer of all the hardware/platform specific code for all the supported platforms: atmega328, esp32, stm32, sam, samd and teensy. They implement:
- PWM configuration
- PWM frequency
- PWM center-alignment
- Direction channel handling (2PWM)
- Complementary direction channel (2PWM)
- PWM duty cycle setting
- Voltage limiting
These classes can be used as stand-alone classes and they can be used to set certain PWM value to the stepper driver outputs, see example codes in
utils > driver_standalone_test. In order for FOC algorithm to work the
StepperDriverxPWM classes are linked to a
StepperMotor class which uses the driver to set the appropriate phase voltages.
The driver code is written in a way to support as many different drivers out there as possible and in a way to be fully interchangeable.
For more theoretical explanations and source code implementations of the FOC algorithm and the motion control approaches check out the digging deeper section.