You are on page 1of 11

Controlling a Stepper Motor

Roland Jay Miguel Instrumentation, Robotics and Control Laboratory University of the Philippines, Diliman

Stepper Motors
Moves in steps or increments of about 1.8degrees per step A sequence of pulses in the inputs is used to control the stepping Easier to use than a DC motor with position encoder Normally high torque Used in disc drives, robot locomotion Compose only of salient permanent magnets. Use external transistor for DC motor function.

How stepper motors work


Several coils are inside Coils are activated in a sequence

Some considerations
Limits on the stepping frequency. The greater the motors load torque, the lower is its maximum stepping rate. If the step rate is too fast, the motor can react in one of several ways: it might not move at all, vibrate in place, rotate erratically, or rotate in the opposite direction. Static holding torque/ static stall torque Amount of torque that can be applied to the motor shaft by the mechanical load without the motor losing its grip and slipping out of a steady position.

How to connect to the uC


Need to use a driver IC 4 Pins of the microcontroller to be exited in sequence Note that this driver inverts the input signal

Now lets try the code


#include <ez8.h> void delay(void) { unsigned int i = 0; for (i = 0; i < 0x1FFF; i++); } void main (void){ PADD &= ~0x0F; // Set as output pins PAHDE |= 0x0F; // High-Drive Enable: For Higher Current Output while (1){ PAOUT = ~0x08; delay(); PAOUT = ~0x04; delay(); PAOUT = ~0x02; delay(); PAOUT = ~0x01; delay(); } }

Challenge Problem 1
Make the stepper turn clockwise

Why turn off only 1 pin?


PAOUT = ~0x08; Outputs are open-drain Transistors are place parallel to the coil
Coils will be excited once the transistor is OFF!

Motor Coil

Texas Instruments

Challenge Problem 2
Using timers, make the stepper motor do a full turn once every minute i.e. 1rpm

The bipolar drive


Currently, we have only done a unipolar driving of the stepper motor. Bipolar stepper motors can give a lower stepping angle and a higher holding torque 3 Ways of driving
AB/CD/BA/DC A-C-B-D A-AC-C-CB-B-BD-D-DA
http://www.super-tech.com/

2-Coil Driving
Energizing two coils will provide higher torque and better stepping response The other coils needs to have a reverse polarity Use H-Bridge!
LM297-298 pair
http://www.piclist.com

http://www.super-tech.com/

You might also like