# Unipolar Driving

I am confused as to why the included stepper motor library with IDE, and other 3rd party stepper libraries such as AcellStepper drive a unipolar stepper motor using the following step table:

in1 in2 in3 in4
seqA 0 1 1 0
seqB 1 1 0 0
seqC 1 0 0 1
seqD 0 0 1 1

I can get the same action to occur using this step scheme:
in1 in2 in3 in4
seqA 1 0 0 0
seqB 0 1 0 0
seqC 0 0 1 0
seqD 0 0 0 1

Why is that the professionals wrote the code to fire two coils simutanseouly on a unipolar stepper motor. It seems logical to only fire 1 pole at time at in a "clockwise" or "counter-clockwise" sequence.

Excuse my inexperience please - I am hoping someone can provide a good explanation or a reading source so that I may understand this drive sequence better. I am using a 28BYJ-48 5V Stepper with what is apparently a common driver board the ULN2003 driver board.

If someone would like a visual representation of what I am talking about if I did a poor job explaining in textual format there is a YouTube video by the DroneBot Workshop: 17:11 / 50:21
Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors

1. sequence only powers one coil at a time, 2. sequence powers 2 coils at a time. 2. sequence provides double torque of sequence 1. When you combine both sequences, you double the number of steps per revolution.

I wonder if you get more torque when you operate two coils at a time?

...R

WaWa's TPIC6B595 code describes Low torque and High torque modes, with Low driving one coil, and High driving two.

WaWa's TPIC6B595 code describes Low torque and High torque modes, with Low driving one coil, and High driving two.

Can you post a link for the benefit of the OP? Without it he is unlikely to know what you refer to.

...R

Thanks for the responses. Makes sense that multiple phases being involved yield a higher torque. I didn't know if it was just a matter of running the motor in a half-step mode.

WaWa’s code:
(with tweaks for my specific hardware with 12xTPIC6B595)

if (newPos[i] == nowPos[i])val[i & 3] = 0; // cut coil power when there
else {
switch (nowPos[i] & 3) { // the two LSB translated to motor coils (full step)
// this block for torque
//case 0: val[i & 3] = B00000011; break;
//case 1: val[i & 3] = B00001001; break;
//case 2: val[i & 3] = B00001100; break;
//case 3: val[i & 3] = B00000110; break;
// or this block for low power
case 0: val[i & 3] = B00000001; break;
case 1: val[i & 3] = B00001000; break;
case 2: val[i & 3] = B00000100; break;
case 3: val[i & 3] = B00000010; break;
} // order is important for not missing steps when coil power is cut
}

TPIC6B595_stepper_driver.ino (4.83 KB)

Here’s my program for 28BYJ-48, ULN2003 and Nano (pins 8 - 11) that has 3 step patterns, on line 39, change “wSteps” (wave - 1 coil at a time) to “fSteps” (full step - like Arduino) or “hSteps” (half step - 4096 steps per rev). Set speed on line 9, “tEnd” as microseconds per step. Enter steps to go in serial monitor.

/* pin 8 to pin 1 on ULN2003, pin 16 to pink,   coilA
9 to pin 2,                15    yellow, coilC
10 to pin 3,                14    orange, coilB
11 to pin 4,                13    blue,   coilD

Type a number in top of serial monitor for steps to go,
-2 billion (CCW) to 2 billion (CW) & press [ENTER].
*/
uint32_t tStart,
tEnd = 7324UL; // microSeconds per step, 4 RPM here
const byte wSteps [8] = {0x01, 0x02, 0x04, 0x08, 0x01, 0x02, 0x04, 0x08};
const byte fSteps [8] = {0x03, 0x06, 0x0C, 0x09, 0x03, 0x06, 0x0C, 0x09};
const byte hSteps [8] = {0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09};
long stg; // steps to go
byte cntr; // step counter

void setup()
{
Serial.begin(9600);
DDRB = 0x0F; // set pins 8,9,10,11 to OUTPUT
PORTB = (PINB & 0xF0) | wSteps[0]; // set motor to first position
}
void loop()
{
if (Serial.available() > 0)
{
stg =  Serial.parseInt();
Serial.println(stg);
if(Serial.read() == '\n'); // skip 1 second delay
}
if (stg != 0)
{
if(micros() - tStart > tEnd)
{
tStart = micros();
stg < 0 ? cntr-- : cntr++; // sets direction
stg < 0 ? stg++ : stg--; // adds to or subtracts from stg
// depending on direction
PORTB = (PINB & 0xF0) | wSteps[cntr & 0x07];
}
}
}

Jaren:
I am confused as to why the included stepper motor library with IDE, and other 3rd party stepper libraries such as AcellStepper drive a unipolar stepper motor using the following step table:

in1 in2 in3 in4
seqA 0 1 1 0
seqB 1 1 0 0
seqC 1 0 0 1
seqD 0 0 1 1

I can get the same action to occur using this step scheme:
in1 in2 in3 in4
seqA 1 0 0 0
seqB 0 1 0 0
seqC 0 0 1 0
seqD 0 0 0 1

Why is that the professionals wrote the code to fire two coils simutanseouly on a unipolar stepper motor. It seems logical to only fire 1 pole at time at in a "clockwise" or "counter-clockwise" sequence.

Full step driving like this means that when the motor is stationary both windings share the
thermal dissipation, which in theory should maximize the available torque as steppers are always
thermally limited by winding dissipation.

Actually its not clear it makes much difference as torque with two coils energized is about sqrt(2)
times the torque with one energized at the same current - simply increasing the current by sqrt(2)
in one winding both generates about the same torque at the same dissipation.

So if the motor is rated for 1A you use 1A per winding, or 0.7A each in both windings for the
rated dissipation and torque. - dissipation goes with I-squared, torque roughly as sqrt(Ia^2+Ib^2)
due to the geometry of the rotor teeth.

However sharing the dissipation equally will mean the peak temperature in a winding is going
to be somewhat less due to local heat buildup, when the motor is stationary for long periods.

Excuse my inexperience please - I am hoping someone can provide a good explanation or a reading source so that I may understand this drive sequence better. I am using a 28BYJ-48 5V Stepper with what is apparently a common driver board the ULN2003 driver board.

If someone would like a visual representation of what I am talking about if I did a poor job explaining in textual format there is a YouTube video by the DroneBot Workshop: 17:11 / 50:21
Stepper Motors with Arduino - Controlling Bipolar & Unipolar stepper motors

The normal stepper motor is 2-phase quadrature, so the two windings can be thought of as vectors or phasors
at right angles, like xy graph.