16F Bipolar Stepper Motor Example

    Stepper motors have a major advantage over normal DC motors, and that's in the fact that they turn / travel a commanded amount. Many steppers move in 5 degree steps, others in 7.5 etc, and come in either a bipolar or unipolar design. Bipolar require a little more circuitry to run, as they require the current to change polarity, where as the unipolar drivers do not, and are in comparison much easier/cheaper to interface with. The internal coils for each look like this,

    The step sequence of the bipolar is as follows,

    This section will cover the Bipolar in more detail from here, for more information on Unipolar Steppers, see this project. It details a much simpler design for Unipolar interfacing, although the following can be used with them, its depth is not required.

    The L297 can drive both unipolar and bipolar steppers, although, when using unipolar, there are some losses. This is because the L297 can control 2 coils, and thus the center 2 taps are ignored and the unipolar stepper is a make shift bipolar. Bipolar steppers win hands down for torque capabilities, and are used in this example. Stepper motors cant drive at the same speed as a typical DC motor, they have their uses though, whether it be for robotics, or rotating displays such as compass cards etc..

    An example of how to interface with a L297 is shown below, note that the L298 is used aswell, its for the current side of the control. Its easy to see that the PIC only has to control 2 signals to control the stepper - clock and CW/CCW. Every rising edge from an active low will initiate a "step" on the motor. The pulses must not be to fast or else the motor will not step correctly. A pulse of around 25ms is a safe figure to start at with steppers, and you can modify it depending on the stepper your using later.

Note the PIC's power supply/oscillator are not shown

Click here too see this circuit in action!

    For better reverse current protection on the H-Bridge, use these diodes

    One pulse from the PIC will result in a 1/2 step on the motor, and it will hold there awaiting the next step. Note C1 and R1 - 3, they form the chopper circuit. This is a form of current control for the motor, to allow the input voltage to be greater than that of what the motor is rated for. To find out how much current the stepper can handle, read the datasheet, or divide its nominal voltage by the resistance of the coil. The ammeter in this circuit was used to ascertain the values of R1 and R2, as the supply voltage was 24VDC and the stepper nominal voltage is 12V. Without chopper control the motor will draw too much current, so R1 and R2 are increased in value until the current being consumed by the motor is the same to that as if it were only connected to 12VDC (~.05A).

 Skip Navigation Links.

Collapse Site Tutorial IndexSite Tutorial Index
Collapse 16F PIC Examples16F PIC Examples
LED's
Switches
Keypads
LCD's
7 Seg Displays
ADC
DAC
Collapse MotorsMotors
DC Motors
Servo's
Bipolar Stepper
Unipolar Stepper
Expand ThermometersThermometers
DS1307 RTC Chip
DS275
EEPROM's
RF Modules
RGB LED's
Code Snippets
Expand Code SnippetsCode Snippets
Expand 18F PIC Examples18F PIC Examples
Expand Handy TipsHandy Tips