Tutorial Microcontroller MCS-51 ATMEL ISP
 

 

Super MCS51 Trainer

Standart MCS51 Trainer

Standart AVR Trainer

Programmer USBASP

Standart ARM Trainer

 

 

7. Driving Stepper Motor

General Theory of Stepper Motors

An ordinary DC motor will turn around and around as long as power is supplied. No intelligent circuitry is required to drive such a motor, unless you want to slow it down or reverse direction - just apply power and it spins. A stepper motor is very different. If you just feed it power, it will stay where it is. In order to make the motor move, you have to feed it a changing signal. This is best illustrated by thinking of a magnetic compass with electromagnets around it:

Figure 2.17. Motor Stepper

The drawing on the bottom shows power applied to the N electromagnet, drawing the compass toward it. On the right, power is instead applied to the E electromagnet, and the needle has rotated toward that side.


Figure 2.18. Basic Stepper Motor

Just four electromagnets would give coarse jumpy motion. Now imagine a similar arrangement with 100 electromagnets around the compass. By energizing each electromagnet in sequence, the needle takes 100 steps around the circle. But driving 100 individual electromagnets would require complex electronics. We fake it:



Figure 2.19. Basic Motor Stepper with more electromagnet

In these drawing, the circled letters represent electromagnets. All the magnets with the same letter are wired together. When you energize that circuit, all of the electromagnets torn on at once. On the left, there are 8 magnets, but only 4 circuits. Sequencing through the four circuits gives half of a rotation. One more run through the sequence completes the rotation. This setup requires that both ends of the compass needle be north-seeking. On the right, the same 4 circuits energize 16 magnets. This setup requires 16 steps (4 repetitions of a 4-step cycle) to complete one rotation.

On the right, the same 4 circuits energize 16 magnets. This setup requires 16 steps (4 repetitions of a 4-step cycle) to complete one rotation. In actual practice, just four control wires can provide just about as many steps as you might want. One of the characteristics of a given stepper motor is the number of steps necessary to make a complete circle, usually expressed as number of degrees per step.

Table g.1. Full Step Mode

A
B
C
D
Comment
1 0 0 0 Take a step clock wise
0 1 0 0 another step clock wise
0 0 1 0 another step clock wise
0 0 0 1 another step clock wise
0 0 0 1 No step take
0 0 1 0 Take a step back

More Complex Drive
As we have seen, it is very easy to drive a stepper motor, by simply turning one electromagnet fully on at a time. But there are other ways to drive a stepper motor.

Half Steps
By turning on two coils at once, the motor will take a position between the two steps.

Figure 2.20. Half step mode

Table g.2. Half Step Mode

A
B
C
D
Comment
1
0
0
0
Take a step clock wise
1
1
0
0
Half a step clock wise
0
1
0
0
The complete full step clock wise
0
1
1
0
another half step clock wise
0
0
1
0
The complete full step clock wise
0
0
1
1
Another half step clock wise
0
0
0
1
The complete full step clock wise
1
0
0
1
another half step clock wise
1
0
0
0
Start position

7.1. Get to run your stepper motor

A basic example of stepper motor driver is shown in figure 2.21. Notice the separate voltages for logic and for the stepper motor. Usually the motor will require a different voltage than the logic portion of the system. Typically logic voltage is +5 Vdc and the stepper motor voltage can range from +5 Vdc up to about +48 Vdc. The driver is also an "open collector" driver, wherein it takes its outputs to GND to activate the motor's windings.


Figure 2.21. Driving motor stepper

Step 1st
Build the circuit as shown in figure 2.21. As you seen on figure 2.21. P0.4 trough P0.7 is connected to driver motor stepper. Remember, that all we want to do with this lesson is write data to stepper motor.

Step 2nd
In this step, you must tipe the assembly program to make your stepper motor run, we assume that you have already known the editor, we used MIDE-51 to edit the program.

       org 0h
start: mov P0,#11101111b; Turn on driver 1
call delay ; call delay time
mov P0,#11011111b; Turn on driver 2
call delay ; call delay time
mov P0,#10111111b; Turn on driver 3
call delay ; call delay time
mov P0,#01111111b; Turn on driver 4
call delay ; call delay time
sjmp start
; delay: mov R0,#0
delay1:mov R2,#0fh
djnz R2,$
djnz R0,delay1
ret end

Step 3rd
Safe your assembly program above, and name it with stepper1.asm (for example) Compile the program that you have been save by using MIDE-51, see the software instruction.

Step 4th
Download your hex file ( stepper1.hex ) into the microcontroller by using Microcontroller ATMEL ISP software, see the instruction.After download this hex file you'll see the action of Stepper Motor ( of course if your cable connection and your program are corrected ).

NEXT