I'm working on a project where I will drive two 12V 0.4A bipolar stepper motors. I am using an adafruit ESP8266 HUZZAH, two L293D stepper motor drivers and a SN74HC NAND gate. I am supplying the motor with 12V. The code that I am using is simple, rotate the motor clockwise and then counter clockwise. This code works fine at speeds greater than 37rpm, but not bellow this. What happens is that the motor will not fully rotate 360 degrees and stop, cancelling the loop. The higher the rpm, the closer the motor gets to completing the rotation. This is an issue since I am mounting an IR sensor that will pan and tilt, allowing the temperature of the room to be scanned. The speed needs to be low to allow readings to be made.

enter image description here NEMA 17 0.4A 12V enter image description here

Adafruit Feather HUZZAH ESP8266 enter image description here


enter image description here

I know the L293D is not an ideal driver for this setup, but I do not understand why the motor is behaving in this manner. Thanks


1 Answer 1


One of the issues with stepper motors is that when driving light loads the motor will oscillate around the next step potion. That is, it will overshoot the target step, turn around and be driven back past the target, repeating till it settles.

Unfortunately, when that oscillation is in the same frequency range as your step pulses it can cause unforeseen things to happen, including the motor backing up a cycle unexpectedly.

That instability can be alleviated by micro-stepping the motor such that the positional torque being applied to the motor is much closer to the target angular position which results in the motor oscillation being reduced to manageable levels.

Alternatively, it is common when using steppers for both positional and cruise operation to attach a shaft encoder with as many pulses as the motor has steps per rev and use that to turn the thing into a brushless DC motor.

  • \$\begingroup\$ Thanks a lot. Is there a way to verify the instability to avoid this happening again when choosing a motor? Also, is it possible to microstep with this motor? \$\endgroup\$
    – Yogi12
    May 4, 2018 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.