Electronic – Stepper Motor Pulses Making it reverse

picaxestepper motor

I have 2 stepper motors in my micromouse. Every so often one of the stepper motors will turn back one step. My set up is a PICAXE and a ULN2803A and to clock the pulses i just turn the outputs on or off on the picaxe. The stepper motors are back to back so if one is rotating clockwise the other must be going anticlockwise to make it go forwards. This leads me to powering my outputs using the following:

; Coil 1 of one stepper motor is output 0
; Coil 4 of one stepper motor is output 3
; Coil 1 of the other stepper motor is output 4
; Coil 4 of the other stepper motor is output 7
let pins = %10000001
wait 1 ;wait 1 second
let pins = %01000010
wait 1 ;wait 1 second
let pins = %00100100
wait 1 ;wait 1 second
let pins = %00011000

So why is it rotating backwards after 2 puleses? Have I got the coils the wrong way?
UPDATE:
I've just again checked that i have the correct coil numbers and this is correct. So the coils are the correct.

Best Answer

You're skipping steps.

Full drive mode for a stepper looks like this:

 Step A  A' B  B'
  1   1  0  1  0
  2   1  0  0  1
  3   0  1  0  1
  4   0  1  1  0
  1   1  0  1  0

One of the A windings and one of the B windings are always on, and the rotor is resting halfway between the two powered windings. This gives you maximum torque.

Half stepping sacrifices some torque to give you twice the resolution:

 Step  A  A' B  B'
  1    1  0  1  0
  1.5  1  0  0  0
  2    1  0  0  1
  2.5  0  0  0  1
  3    0  1  0  1
  3.5  0  1  0  0
  4    0  1  1  0
  4.5  0  0  1  0
  1    1  0  1  0

The half steps don't have as much torque, since only one winding is on part of the time. But, the half steps are close to a full step, so it doesn't take much to get the rotor there.

You're skipping the full steps and just using the half steps. You might also be sequencing the windings wrong. I can't tell because your numbering scheme is atypical.

See a reference like this one for more information and pictures.