I'm considering using stepper motors for a balancing robot because the backlash is very low and torque is highest at low RPM. Been having backlash feedback issues with my banebots motors (RS454 motor with 26:1 gearbox). I measured 3 degrees of backlash.
Just not sure how to control them in my Arduino Due under a fixed time step program loop. Typically I use standard DC motors driven by a VNH2SP30 Motor Driver and I simply change the PWM duty cycle to change RPM without upsetting the program loop timing. I use the "pwm01.h" library to setup the hardware PWM frequency and the signal just runs in the background.
The problem: To drive a stepper motor I need to send a step command to a stepper driver. The command is in the form of a pulse, like a PWM wave with 50% duty cycle. To change RPM, I need to change the period or frequency of that wave. Changing hardware PWM frequency in a loop is not practical. Is there a way to setup variable frequency PWM signals with fixed 50% duty cycle in a loop without upsetting the program loop timing?