I’m using SimpleFOC to control a NEMA17 stepper with StepperDriver4PWM, an SPI encoder and inline current sensing. It works quite well overall, but I’m struggling with smoothness and response to load at low speeds.
In closed-loop velocity mode, around 1–2 rad/s and below, rotation isn’t particularly smooth. When I apply mechanical resistance, it also takes longer than I’d like to recover the requested speed. I’m not sure whether this comes from detent torque, velocity measurement noise or my tuning. Above roughly 5 rad/s, the motion is noticeably smoother.
My hardware is:
-
STM32 Nucleo-F446RE
-
LDO-42STH48-2004AC NEMA17 stepper, 1.8°, 2A/phase, 1.6 ohms and 3mH per phase
-
Pololu Dual MC33926 carrier, using both H-bridges for one stepper
-
AS5047P SPI encoder with a magnet on the motor shaft
-
Two INA240A2 current-sensing modules, one per phase, with 0.01-ohm shunts and 1:2 voltage dividers on their outputs
I’m using foc_current torque control underneath the velocity loop, with 50 pole pairs configured.
My velocity PI settings are P=0.4, I=1, D=0, with a 20ms velocity filter. Both current loops use P=10, I=600, D=0 and 1ms filters. Motion downsampling is set to 4. The current-request limit is normally 1.5A, and the voltage ceiling is adjustable up to 11V.
Has anyone had good results running a similar stepper setup smoothly at these speeds while maintaining a reasonably quick response to load? Would you start with the velocity PI/filter settings, current-loop tuning, or checking ADC sampling relative to PWM?
I’d like to keep closed-loop control across the speed range without having to stop and reinitialize when switching between slow and fast operation. Happy to share the sketch or collect specific measurements.
Thanks!