Bipolar stepper motors tend to have just two motor windings; they are called bipolar because these windings must change polarity in a determined order sequence to move with each step. They require more circuitry to be adequately controlled, but in exchange they offer some advantages compared to unipolar motors.

Figure 1

We should note that the main advantage of bipolar stepper motors, as opposed to unipolar, is that the torque of
a bipolar stepper motor can be up to 40% greater than that of a unipolar stepper motor of equal dimensions and
consumption. This means that we can achieve greater power with smaller motors and/or motors with lower consumption.
We will access its two motor windings via four connection threads as shown in Figure 1.

Figure 2

The excitation of each winding and the direction of current flow are typically controlled by a configuration known
as an H-Bridge (Figure 2), and we will need an H-Bridge for each winding. The way it works is very simple: when the
Q1 and Q4 transistors are excited, a current is circulated which polarizes the winding in one direction, and when
you want to flip the direction of polarization you excite the Q2 and Q3 transistors. The four diodes are used exclusively
to protect the transistors from voltage peaks generated by the coils. Currently there exist integrated circuits
specializing in controlling bipolar stepper motors, such as the L293B or the L298N, which will really help us simplify
things in terms of the circuitry. In addition, there are electronics boards on the market designed to interconnect and
control this type of motor, such as the one I have used.

For the motor to move, we must flip the polarity of the terminals of coils 1 and 2 in the sequence given in the table
below. It consists of four possible combinations which will allow us to move the motor in one direction; if we want
to change the direction, we simply have to send the sequence reverse direction.

Logic

Function

Paso

1a

1b

2a

2b

1º

+Vcc

GND

+Vcc

GND

2º

+Vcc

GND

GND

+Vcc

3º

GND

+Vcc

GND

+Vcc

4º

GND

+Vcc

+Vcc

GND

In the sample Python code I’ve defined four channels as the output needed to control the motor correctly. The
bipolar motor used in these tests is a KP54FP8-755 salvaged from an old laser printer. This motor advances 7.5°
per step, so to make a complete turn it needs 48 steps (360/7.5). If you have some other motor on hand, you’ll
just have to make some small adjustments with the function “set_degrees” to get a similar result.