A Unipolar Stepper Motor Driver

The drive circuits for Unipolar stepper motors are usually very simple. In its simplest form, a transistor or MOSFET is used to drive each section of the windings. With this design, the control signal must be supplied programmatically to the four windings of the unipolar stepper motor via an MCU. The programming can become quite complex when the stepping mode (e.g. half stepping/full stepping), stepping direction and rotation speed all need to be controlled.

The programming burden can be shifted to a dedicated stepper motor controller such as L297 and thus free up the MCU for other tasks.

The following circuit diagram shows one such design:

Unipolar Motor Controller Using L297 and ULN2003

Unipolar Motor Controller Using L297 and ULN2003

Basically, the L297 is used to generate the stepping signals needed by the stepper motor. The SENSE, CONTROL, INH and VRef pins can be used in tandem to provide finer PWM current control and faster decay. But in all but the most strict applications, these features are rarely needed. So I omitted these features by tying CONTROL and SENSE pins to the ground and set VRef to Vcc. The INH pins are left unused. This way the complexity of the circuit is greatly reduced. If you intend to use these pins, please refer to the following application note (AN470).

To test this circuit, I used an Arduino MCU board and used digital pin 10 to generate the required clock signal. For simplicity, the step mode pin and the direction pin are grounded (full step, counter clockwise) as seen in the picture below, but these two pins can also be controlled programmatically.

Unipolar Motor Driver

Unipolar Motor Driver

The actual program is very simple, all we needed to do is to provide a clock signal. The following code used the bit-banging method to generate the clock signal at roughly 250 Hz.

int PIN_CLK = 10;

void setup()
  pinMode(PIN_CLK, OUTPUT);
  digitalWrite(PIN_CLK, LOW);

void loop()
  digitalWrite(PIN_CLK, HIGH);
  digitalWrite(PIN_CLK, LOW);
Be Sociable, Share!


  1. hashir says:

    hey how can i use this circuit with parallel port . i want to control 4 stepper motors from 8 data pins in paralell port for the project robotic arm . so i dont know whether this circuit help me or not tell me what to do extra with this circuit in order to check just single stepper motor i will use labview to check . tell me plz :/ . ihave l297 uln2003 and a uni polar stepper motor . and i want to control with paralell port .

    • kwong says:

      It would be pretty easy to use the parallel port for controlling the circuit. You will need three lines (e.g. D0, D1, D2) for the clock, direction and stepping control. The clock will have to be bit-banged in your code.

  2. hashir says:

    let me tell u what i m doing with the circuit
    i connect all the ground pins of the parallel port means shorted from 18 to 25 pins and connect to the common ground of the circuit . i m using d0 to d1 for the 3 inputs as u told . tell me what should i give inputs to d0 to d1 pin using labview.
    today i connected step direction and clock to the ground of ur circuit which i made but nothing happens motor doesnt move. i think all the coils charge . i m using uni polar stepper motor. tell me from start to end in order to run the motor using parallel port plzzz . otherwise i think the decoder is the better option

  3. hashir says:

    and what do u mean by bit banged? tell me all the things in order to run the motor plz . it is my semister course project.

    • kwong says:

      Bit banging is simply a technique of generating desired pulses via software (instead of relying on dedicated hardware circuit).

      So all you need to do is choose what kind of stepping you need (for example, set the half/full stepping pin to High, and set the DIR pin to High) and set the clock pin High/Low/High/Low…. each High/Low represents a clock cycle and by controlling how fast you issue these high/low pulses, you can control how fast the stepper motor is turning. Hope it clears up things a little bit.

  4. hashir says:

    i will try i will give 1 and 0 with delay of atleast 0.1 sec to the parallel port pin d0 which is connected to clock

  5. crazyal says:

    can i use grbl with this circuit?

  6. pico says:

    It is hard to see in the l297 datasheed, but the 33nF capacitor for the oscillator is actually a 3.3nF.

  7. pico says:

    And you may probably damage your l297 by connecting Vref to Vcc, which was my experience. A maximum of 3V is provided.

  8. theOG says:

    how would you control the speed at which the motor rotates using the same circuit?

  9. cnc_student says:

    How do you switch the L297 into “wave drive” mode at power-up, meaning only one of the ABCD outputs are on at a time? I am looking for a hardware solution to do this, versus having to clock the IC.

Leave a Reply