Stepper Driver configuration



Arduino SimpleFOClibrary implements support for two types of Stepper driver control interfaces:
Classes StepperDriver2PWM and 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 (2 PWM)
- Complementary direction channel (2 PWM)
- 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.
Digging deeper
For more theoretical explanations and source code implementations of the FOC algorithm and the motion control approaches check out the digging deeper section.
Copyright © 2026. Distributed by an MIT license.