Unipolar motor -- am I crazy? [now with code/schematic]

So I can get some super cheap unipolar stepper motors here:
http://www.mpja.com/prodinfo.asp?number=4315+MS
It's wired with a common center tap for the coils:

I can't use a regular motor shield (for bipolars) with this motor, but that's half the fun :slight_smile: I put up four power MOSFETs driven by four digital pins in the proper cadence. I feed in 12V in the common, and have the MOSFETs ground out the other wires as appropriate (with suitable snubbing diodes pointing "up" towards the 12V rail) I verified the cadence by hooking up LEDs and driving it slowly.

However, the motor just jerks back and forth. No matter if I run it at five steps a second or a hundred steps a second, all I get is vibration. I'm pretty sure I wired it correctly, but I also permuted various connections to test all possible permutations, with the same result (no rotation, just vibration/back-and-forth.)

I feel like this is one of those noob problems, except I tried everything I can find and think of, and it still doesn't work. I tried two of the motors, so it's not just one bum motor. Do I have multiple bum motors, or is there some mechanical thing I'm missing? (something like "oh, it needs a specific load/inertia to actually pull it around to the next phase" -- that'd be crazy, though, based on what I know)

I've measured the windings, they all have continuity and all seem to have the same resistance. The power supply shows exactly the expected amount of current drawn (0.15A per winding at 12.0V.) I've run only one winding at a time, and it jerks back and forth as expected, weaker than with both windings, but in a similar way. It's like I can't pull the rotor sideways to make it turn instead of vibrate...

Also, code:

void setup()
{
  for (int i = 2; i < 14; ++i)
  {
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }
}

bool on = true;
int sdelay = 200;
int delaydelay = 3000;

void ctl(bool a, bool b) {
  if (a) {
    digitalWrite(8, LOW);
    digitalWrite(7, HIGH);
  }
  else {
    digitalWrite(7, LOW);
    digitalWrite(8, HIGH);
  }
  if (b) {
    digitalWrite(10, LOW);
    digitalWrite(9, HIGH);
  }
  else {
    digitalWrite(9, LOW);
    digitalWrite(10, HIGH);
  }
}

void loop()
{
  ctl(true, true);
  delay(sdelay);
  ctl(true, false);
  delay(sdelay);
  ctl(false, false);
  delay(sdelay);
  ctl(false, true);
  delay(sdelay);
  digitalWrite(13, on ? HIGH : LOW);
  on = !on;
  delaydelay -= sdelay;
  if (delaydelay < 0) {
    delaydelay = 3000;
    if (sdelay == 200) {
      sdelay = 10;
    }
    else {
      sdelay = 200;
    }
  }
}

And a schematic of my driver attached.

So, I opened one up, and looked at it. It turns out, the documentation is simply wrong. The "A-" and "B+" mappings in the table in the data sheet are flipped.
This means that, specifically, flipping white and brown (which means flipping between the two windings,) will make it work.
Also, by changing the cadence, half-stepping is easy as well.

Your code seems convoluted, but it might work.

Your schematic should work fine. I'm using a driver board built with TIP110; pictured below...it works fine.

If you use the correct pins, you can create a sinewave/microstep drive.

The code doesn't turn off A winding when B winding is activated or vice versa - what stepping scheme are you thinking you are using?

MarkT:
The code doesn't turn off A winding when B winding is activated or vice versa - what stepping scheme are you thinking you are using?

The data sheet (and general stepping) explicitly shows turning on two windings at a time. In general, this is how stepper motors are run, to get the most torque. When you half-step, you lose about 25-30% of the torque, because you run only one winding half of the time, and two windings half of the time.
If you sequence the windings as A, B, a, b, the on cycle is generally:

AB
 Ba
  ab
A  b

As I said in the follow-up: Now that I changed the hook-up to match the internals of the motor, rather than the documentation (which was wrong on the wiring AFAICT,) the motor runs well.
Posting the question pretty much made me look through everything again and realize that I had to check the interior to actually get any further, so it helped in that sense :slight_smile: