Stepper Motor is VERY SLOW...too slow. How do I speed it up?

Hey Everybody,

I wanted to create a very simple stepper motor circuit and driver software using an Arduino Uno.

I started with MOSFETS P/N IRF510 and could not get these to work.

So I had some TRANSISTORS P/N N4921G in my shop and plugged these into my breadboard. With a small amount of rewiring, I got these to work great.

The PROBLEM is that my stepper motor turns VERY SLOWLY. When I decrease the time delay in my software to about 2000 microseconds (2 milliseconds), the motor does not turn at all…probably switching power in coils faster than the motor can physically turn.

(42BYGH404-R: Jameco Reliapro : Unipolar Stepper Motor 12VDC 400mA : Electromechanical)

My circuit diagram looks similar to the attached GIF file. I have added pull-down resistors, not shown.

My code looks like:

int t = 3000; //time delay in microseconds

void setup() {
DDRB = B11111111;

void loop() {
PORTB = B00000001;
PORTB = B00000011;
PORTB = B00000010;
PORTB = B00000110;
PORTB = B00000100;
PORTB = B00001100;
PORTB = B00001000;
PORTB = B00001001;



You will need a decent motor driver and a suitable motor power supply to get the rated performance. There is not enough information in your post to make any further suggestions.


I have 12V on the common on the stepper motor and 5V powering the Arduino Uno. The N4921G transistors can run up to 40V and 1A. The stepper motor is only running at 12V and draws 400mA.


These links may help
Stepper Motor Basics
Simple Stepper Code


You need polarized properly each transistor with resistors in order to reach the current. Also, diodes must be used to protect the transistors ( if you turn-on without these diodes, the transistor will be damaged ).

The N4921G transistors can run up to 40V and 1A.

Presumably you mean 2N4921G.

Are you driving them properly? That transistor requires about 100 mA base current at 1 A collector current and an Arduino output pin can't supply that without being severely damaged. Post your complete circuit diagram.

We recommend to use logic level MOSFETs (don't forget the kickback diodes on each motor coil) or use a proper motor driver.

My circuit diagram looks similar to the attached GIF file. I have added pull-down resistors, not shown.

Without free-wheel diodes you likely destroyed all of those transistors the first time you ran the code...
Stepper motor windings are large inductive loads and must have protection from inductive kickback.

I originally tried mosfets P/N IRF510. I could not get the stepper motor to take a single step. And then I swapped out the mosfets for transistors, did a small amount of rewiring, and whallah....IT WORKED!!!

So what was I missing? The diodes?


The IRF510 is not a logic level MOSFET, and requires 10V on the gate to turn on. Won't work well, or at all with Arduino.

The diodes are absolutely required.

What you are missing is a whole lot of stepper motor basics.

if you have a motor that is rated for 5 volts, and you want to use transistors or FET's you can only power it with 5 volts.

each coil is an inductor and will need to be charged with some value.

if it is rated for 5 volts, and you connect it to 5 volts, it will draw, say, 100 units.
however, if you make or buy a chopper style driver, like an L298 so many people have great success with, you must select and set the feedback resistors so the driver can work properly.

if you use a chopper and use a 12V power supply, the chopper 'sees' the 100 units and chops the power. if you think of voltage as speed, an actual stepper driver like an L298, will push in the power much faster than if you use the nameplate voltage.

the L298 does require 4 pins and a lot more of your sketch to work
than the more popular 4988 driver chips. the L298 is very old technology in most discussion and many have a bias against it for reasons known only to the winds.

but the 4988 has some big advantages. first off, it needs only 2 pins. one for the pulse, and the other sets direction.
another reason is the fact that it offers microstepping. these are artificial (aka FAKE) steps that offer no real value except smooth operation.
and this brings us to the next point. a stepper needs a VERY CRISP pulse. not some slow ramp up and slow ramp down, but a very sharp ON and OFF. something not possible with an Arduino that has interupts or does other things. These are the typical cause of miss-steps. imagine running at your fastest speed, down hill, and every 3rd step, you have to stop your legs for just a few seconds.

fortunately few applications run at top speed and most people have learned to cope with the incompatibilities by poor steps by either up-sizing their motors or some such.

not knowing the specific motors you have, it would be hard to tell if the 4988 can power them. but, for the low cost, and the good links Robin2 posted, you might find that they will make your motors move much better. and by that, a LOT better. especially because you can take advantage of the higher voltages.

lastly, the greater of the ratio of your power supply to the motor natural voltage, the faster you can push it. if you have a 1.3V stepper and run it at 13 volts (10X) it will sing. if you have a 5v stepper, sadly the best you can get is a 24V power supply as the chips in the driver cannot handle more and the 5X will make your motors move rather briskly compared to what you can get from the natural voltage.

if you have a motor that is rated for 5 volts

Then its not a stepper motor! Steppers are current-driven, should be rated in amps...

Well the important parameters are nominal current, winding resistance and inductance, especially
the latter, since that sets the max speed per volt of supply.


if you have a motor that is rated for 5 volts

Then its not a stepper motor! Steppers are current-driven, should be rated in amps...

I understand the sense in which you mean that but I think it could be very confusing for a newbie. Whether we like it or not many stepper motor datasheets list the nominal voltage.