Stepper motors are motors which turn due electromagnetic coils
pulling the axle round in a circle. There is an amination of this on
this website:
Stepper Motor
This
is useful for two reasons: you can make the stepper motor turn to a
particular position and it has a "holding torque" meaning that as long
as two of the magnets are energised it can hold something in position.
To
make the stepper motor turn you must use a particular pattern to make
sure that the coils energise in a circle. To make the stepper motor
turn clockwise you type the pattern in as seen, to make it turn
anticlockwise you simply use the same pattern but in reverse:
i.e.
symbol delay = b0
let delay = 100
clock: let pins = %10100000
pause delay
let pins = %10010000
pause delay
let pins = %01010000
pause delay
let pins = %01100000
pause delay
goto clock
anti: let pins = %01100000
pause delay
let pins = %01010000
pause delay
let pins = %10010000
pause delay
let pins = %10100000
pause delay
goto anti
Repeating
like this will simply make the stepper motor turn continuously. By
using b0 as the delay, we can quickly change the speed of the stepper
motor by changing the value of "delay" The smaller the number the
faster the motor will turn, but if you try to turn too quickly the
magnets will not have time to pull the axle round so it may not turn at
all.
To make the motor turn to a specific position, we must use a FOR . . . NEXT . . . loop. This will allow us to repeat the pattern a set number of times. Each line of the program is 7.5 degrees, so each 4 line pattern is 30 degrees. Therefore to turn one complete revolution we must repeat the pattern 12 times.
i.e.
symbol counter = b0
symbol delay = b1
let delay = 100
clock: for counter = 1 to 12
let pins = %10100000
pause delay
let pins = %10010000
pause delay
let pins = %01010000
pause delay
let pins = %01100000
pause delay
next counter
The
stepper motor requires a 12v supply and the microprocessor can only
supply a 5v signal. Therefore we must use an external power supply (a
black box) to connect to our output driver.
No comments:
Post a Comment