Stepper Motor Control

Stepper Motor Basics

If you are not familiar with stepper motors, this note might be useful. The particular motor you are supplied with is described here (body size 17) with more details here.

PIC Circuit

The design is shown in this Circuit Diagram. Its purpose is to control the stepper motor using only a PIC Microcontroller and a Stepper Motor Driver Chip. In its simplest form the circuit can operate with only the Move and DirIn signals being supplied externally and all the other inputs tied either high or low.

Circuit Input/Output Pin Definitions

Pin State
Low High
Move Stop Start
DirIn Left Right
Step_Mode Step Freerun
Half_Step_In Full Step Mode Half Step Mode
Reset Don't reset Reset
Rstop Not touching right switch Touching right switch
Lstop Not touching left switch Touching left switch
~Phase A Phase A Not Phase A

Modes

Step_Mode

Free running mode is when the stepper motor will run until it either hits an end stop switch or the move pin is set low.

Step mode is when the stepper moves one step each time the move pin is raised high.

Reset mode

By toggling both the move and the reset pin high then low. The camera will then rotate left until it hits the Lstop switch before counting its way to the Rstop switch and then counting back to its centre position.

Serial Port Connections

Rx and Tx connections are supplied to the appropriate pins on the PIC but have not been implemented in this design.

MC3479 Stepper Motor Driver

R1 and R2 help reduce the power consumption of both the driver IC and the motor when the motor is not being stepped , whilst allowing the coils of the motor to retain their charge and hold their position and also preventing the IC from overheating.

Z1 is a zener diode and is connected between the Vm and Vd pins to provide a current path for the motor coil when the switching takes place to suppress any voltage spikes that might be created..

C1 is simply a smoothing capacitor which helps to maintain a stable 12 volt supply to the driver IC. It is common practice to have a 0.1uF capacitor (per IC) between the power and 0 volt rails in most designs.

R3 and R4 are pull up resistors used to prevent the Lstop and Rstop inputs to the Pic becoming open circuit when the switches are activated.

R5, R6, R7 and R8 are used to help match the electrical characteristics of the cable which prevents crosstalk between signal lines. Note that R6 and R8 are not used in this implementation.

The PIC Program

The PIC has been programmed already. A source listing of the assembly code is here for your interest.

Construction

The PIC is supplied along with the other main components and a circuit board on which to solder them. Two soldering stations have been set up in the far corner of the hall. Garry Ellard will give practical tutorials on soldering to those who need help, probably on the first Wednesday afternoon (details later).

Other Data Sheets

The MC3479 Stepper Motor Driver data sheet can be found here.

The PIC16F62X Data Sheet can be found here.

ADM232A RS232 Driver chip Data Sheet can be found here.

Additional information on PICs and the PIC programming (MPlab) software can be found at www.microchip.com.

A Simple Program to Interface with the Stepper Motor Circuit

Archie Howitt has provided a program, campan.c, which drives the control lines of a serial interface to control the stepper motor.