Unipolar Stepper Motor Control Examples with PIC12F1822 – CCS C

This topic shows how to drive 5V unipolar stepper motor in 3 modes one-phase, two-phase and half step. The microcontroller used in this project is Microchip PIC12F1822 and the motor drive circuit is ULN2003.
Usually the unipolar stepper motor has 5 wires one for motor supply and the other for coils. This motor has 4 coils and they are connected as shown in the figure below:

Unipolar stepper motor coils

Unipolar Stepper Motor Control Example with PIC12F1822  circuit:
All the three control modes have the same circuit schematic as shown below.

PIC12F1822 unipolar stepper motor control circuit

Here PIC12F1822 uses its internal oscillator.
The potentiometer connected to AN0 is used to control motor speed and direction of rotation.

Unipolar Stepper Motor Control Example with PIC12F1822 CCS C code:

One Phase On Mode (Full Step mode):
In one phase control mode only one coil is energized at once. This mode produces smooth motion with low power consumption. Control sequence has 4 steps as shown in the table below:

Unipolar stepper motor one phase sequence

CCS C code:

Two Phases On Mode (Alternate Full Step mode):
In two-phase mode two coils are energized. This mode produces high torque but its motion is not smooth like the one phase mode. The following table shows this mode sequence:

Unipolar stepper motor two phase sequence

CCS C code:

Half Step Mode:
This mode is just mix of the previous two mode sequences. The half step mode increases motor number of steps by 2, for example a stepper motor of 24 steps of 15 degrees each, it becomes using half step mode 28 steps of 7.5 degrees. Mode sequence shown below:

Unipolar stepper motor half step sequence

CCS C code:

Example Video:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top